The chrome.lockScreen.data API implementation

Desktop / Chromium - tbarzic [chromium.org] - 13 July 2017 22:18 EDT

Introduces a data item storage for data created on lock screen.

Data items are persisted on disk in per-extension value stores backed by leveldb (same backend as chrome.storage.local API).
Value store is structured as follows:
- registered_items -> dictionary whose keys are IDs of registered item Dictionary values are currently empty dictionaries, but could be extended in future to contain data item metadata, if required.
- item ID -> base64 encoded encrypted data item content

Note that data item content is encrypted because the storage is kept outside user directory. Encrypted data is base 64 encoded because value store does not currently support binary data (the DB values are preserved as JSON strings, and JSON writer does not handle binary
values well).

Additionally, this CL adds a dictionary to local state that maps extension IDs to number of lock screen data items registered for the extension. The purpose of this dictionary is to enable the lockScreen.data API to determine set of apps to which it should set OnDataItemsAvailable event when user session is activated without querying the values store database for each installed extension.

BUG=715781

Review-Url: https://codereview.chromium.org/2934293003 Cr-Commit-Position: refs/heads/master@{#486636}

d9a88fc The chrome.lockScreen.data API implementation
chrome/browser/prefs/browser_prefs.cc | 3 +
extensions/browser/BUILD.gn | 2 +
extensions/browser/api/BUILD.gn | 5 +
.../browser/api/lock_screen_data/data_item.cc | 435 ++++++++
.../browser/api/lock_screen_data/data_item.h | 144 +++
.../api/lock_screen_data/data_item_unittest.cc | 733 ++++++++++++++
.../api/lock_screen_data/lock_screen_data_api.cc | 136 ++-
.../api/lock_screen_data/lock_screen_data_api.h | 20 +
.../lock_screen_data/lock_screen_item_storage.cc | 486 +++++++++
.../lock_screen_data/lock_screen_item_storage.h | 267 +++++
.../lock_screen_item_storage_unittest.cc | 1046 ++++++++++++++++++++
.../api/lock_screen_data/operation_result.h | 26 +
.../browser/test_extensions_browser_client.cc | 19 +-
.../browser/test_extensions_browser_client.h | 19 +-
14 files changed, 3320 insertions(+), 21 deletions(-)

Upstream: git.chromium.org


  • Share