Introduce Identity Service and its initial usage

Desktop / Chromium - blundell [chromium.org] - 24 March 2017 09:56 EDT

This CL introduces the Identity Service and converts the implementation of the chrome.identity.GetProfileUserInfo() extension function to use the new service. Notable points:

- The Identity Service is embedded in //chrome rather than //content, as it needs access to per-Profile classes with //chrome-level factories.- The initial API is simply enough to satisfy the needs of the initial consumer. We will build out this API by incrementally converting further consumers.- In the long term, the //components/signin classes on which the Identity Service depends will be folded into the Identity Service implementation, and their consumers will be converted to consume the Identity Service.
- The Identity Service makes use of the existing AccountId Mojo struct. It extends that struct to be nullable, as the Identity Service needs to be able to convey to a requesting client that the user is not signed in. Note that a separate HasPrimaryAccount() => bool method would not suffice here: since the communication is asynchronous, the user could always have signed out by the time that the Identity Service receives the GetPrimaryAccountId() call.

BUG=683120, 683124 TEST=Install a Chrome extension with the identity and identity.email permissions in its manifest. Go to chrome://extensions, enable developer mode, and inspect the background page of the above app. At the JS console that that brings up, execute: chrome.identity.getProfileUserInfo((account) => {console.log(account)})
Verify that the printout corresponds to the information of the account being used for sync.

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

b85bd3b Introduce Identity Service and its initial usage
chrome/app/BUILD.gn | 5 ++-
chrome/browser/BUILD.gn | 1 +
chrome/browser/DEPS | 1 +
.../chrome_content_browser_manifest_overlay.json | 1 +
chrome/browser/extensions/BUILD.gn | 3 ++
.../identity_get_profile_user_info_function.cc | 38 +++++++++++++++-----
.../identity_get_profile_user_info_function.h | 5 +++
chrome/browser/profiles/DEPS | 8 +++++
chrome/browser/profiles/profile_impl.cc | 20 +++++++++++
chrome/browser/profiles/profile_impl.h | 4 +++
.../signin/public/interfaces/account_id_traits.h | 4 +++
services/device/device_service.cc | 1 +
services/identity/BUILD.gn | 29 ++++++++++++++++
services/identity/DEPS | 6 ++++
services/identity/OWNERS | 2 ++
services/identity/README.md | 8 +++++
services/identity/identity_manager.cc | 39 +++++++++++++++++++++
services/identity/identity_manager.h | 32 +++++++++++++++++
services/identity/identity_service.cc | 32 +++++++++++++++++
services/identity/identity_service.h | 40 ++++++++++++++++++++++
services/identity/manifest.json | 11 ++++++
services/identity/public/interfaces/BUILD.gn | 22 ++++++++++++
services/identity/public/interfaces/OWNERS | 2 ++
.../identity/public/interfaces/constants.mojom | 7 ++++
.../public/interfaces/identity_manager.mojom | 17 +++++++++
25 files changed, 328 insertions(+), 10 deletions(-)

Upstream: git.chromium.org


  • Share