• Colin Blundell's avatar
    Convert chrome.identity.getAccounts() impl away from AccountTracker · 2e73f36b
    Colin Blundell authored
    As a precursor to changing the implementation of
    chrome.identity.getAccounts() to use the Identity Service, this CL
    moves that implementation away from using AccountTracker::GetAccounts()
    to using OAuth2TokenService::GetAccounts(). The latter is the function
    that we intend to back the upcoming Identity Service API.
    
    AccountTracker::GetAccounts() is fundamentally based on
    OAuth2TokenService::GetAccounts(): they both have the basic behavior
    of returning the informations of all accounts for which a refresh
    token is available. However, AccountTracker::GetAccounts() layers
    some extra information on top relating to the primary account (a
    concept of which the OAuth2TokenService is not aware). (AccountTracker
    itself gets this information via IdentityProvider; in the context of
    the chrome.identity.getAccounts() impl, this is ProfileIdentityProvider,
    which is backed by SigninManager).
    
    To avoid any behavioral changes, this CL ports the particular semantics
    of AccountTracker::GetAccounts() to live directly in the implementation
    of chrome.identity.getAccounts():
    - Returns an empty list if there is no primary account or there is no
      refresh token available for the primary account
    - Otherwise, puts the primary account first in the returned list
    
    Bug: 729536
    Change-Id: Ib4f6cff0afd2f751ec3a7409d24b797b1be0ec79
    Reviewed-on: https://chromium-review.googlesource.com/574709Reviewed-by: default avatarKen Rockot <rockot@chromium.org>
    Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
    Commit-Queue: Colin Blundell <blundell@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#488177}
    2e73f36b
identity_api.h 4.49 KB