Introduce Identity Service and its initial usage
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}
25 files changed