Commit 6f4e2c0b authored by Julie Jeongeun Kim's avatar Julie Jeongeun Kim Committed by Commit Bot

[s13n] Move IdentityAPI away from using AccountTrackerService

This CL removes AccountTrackerService from IdentityAPI and
uses IdentityManager instead of it.

Bug: 922750, 922751
Change-Id: Ibb4f2cd90fd9439b0889f25608d8491d110dcba0
Reviewed-on: https://chromium-review.googlesource.com/c/1429883Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Commit-Queue: Julie Jeongeun Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/master@{#625434}
parent 3844f8f8
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/account_consistency_mode_manager.h" #include "chrome/browser/signin/account_consistency_mode_manager.h"
#include "chrome/browser/signin/account_tracker_service_factory.h"
#include "chrome/browser/signin/chrome_signin_client_factory.h" #include "chrome/browser/signin/chrome_signin_client_factory.h"
#include "chrome/browser/signin/identity_manager_factory.h" #include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/common/extensions/api/identity.h" #include "chrome/common/extensions/api/identity.h"
...@@ -102,7 +101,6 @@ const base::Time& IdentityTokenCacheValue::expiration_time() const { ...@@ -102,7 +101,6 @@ const base::Time& IdentityTokenCacheValue::expiration_time() const {
IdentityAPI::IdentityAPI(content::BrowserContext* context) IdentityAPI::IdentityAPI(content::BrowserContext* context)
: profile_(Profile::FromBrowserContext(context)) { : profile_(Profile::FromBrowserContext(context)) {
AccountTrackerServiceFactory::GetForProfile(profile_)->AddObserver(this);
IdentityManagerFactory::GetForProfile(profile_)->AddObserver(this); IdentityManagerFactory::GetForProfile(profile_)->AddObserver(this);
} }
...@@ -145,7 +143,6 @@ const IdentityAPI::CachedTokens& IdentityAPI::GetAllCachedTokens() { ...@@ -145,7 +143,6 @@ const IdentityAPI::CachedTokens& IdentityAPI::GetAllCachedTokens() {
void IdentityAPI::Shutdown() { void IdentityAPI::Shutdown() {
on_shutdown_callback_list_.Notify(); on_shutdown_callback_list_.Notify();
AccountTrackerServiceFactory::GetForProfile(profile_)->RemoveObserver(this);
IdentityManagerFactory::GetForProfile(profile_)->RemoveObserver(this); IdentityManagerFactory::GetForProfile(profile_)->RemoveObserver(this);
} }
...@@ -178,7 +175,7 @@ void IdentityAPI::OnRefreshTokenUpdatedForAccount( ...@@ -178,7 +175,7 @@ void IdentityAPI::OnRefreshTokenUpdatedForAccount(
FireOnAccountSignInChanged(account_info.gaia, true); FireOnAccountSignInChanged(account_info.gaia, true);
} }
void IdentityAPI::OnAccountRemoved(const AccountInfo& account_info) { void IdentityAPI::OnAccountRemovedWithInfo(const AccountInfo& account_info) {
DCHECK(!account_info.gaia.empty()); DCHECK(!account_info.gaia.empty());
FireOnAccountSignInChanged(account_info.gaia, false); FireOnAccountSignInChanged(account_info.gaia, false);
} }
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "chrome/browser/extensions/api/identity/identity_remove_cached_auth_token_function.h" #include "chrome/browser/extensions/api/identity/identity_remove_cached_auth_token_function.h"
#include "chrome/browser/extensions/api/identity/web_auth_flow.h" #include "chrome/browser/extensions/api/identity/web_auth_flow.h"
#include "chrome/browser/extensions/chrome_extension_function.h" #include "chrome/browser/extensions/chrome_extension_function.h"
#include "components/signin/core/browser/account_tracker_service.h"
#include "components/signin/core/browser/signin_buildflags.h" #include "components/signin/core/browser/signin_buildflags.h"
#include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/browser/event_router.h" #include "extensions/browser/event_router.h"
...@@ -80,7 +79,6 @@ class IdentityTokenCacheValue { ...@@ -80,7 +79,6 @@ class IdentityTokenCacheValue {
}; };
class IdentityAPI : public BrowserContextKeyedAPI, class IdentityAPI : public BrowserContextKeyedAPI,
public AccountTrackerService::Observer,
public identity::IdentityManager::Observer { public identity::IdentityManager::Observer {
public: public:
typedef std::map<ExtensionTokenKey, IdentityTokenCacheValue> CachedTokens; typedef std::map<ExtensionTokenKey, IdentityTokenCacheValue> CachedTokens;
...@@ -133,17 +131,13 @@ class IdentityAPI : public BrowserContextKeyedAPI, ...@@ -133,17 +131,13 @@ class IdentityAPI : public BrowserContextKeyedAPI,
// identity::IdentityManager::Observer: // identity::IdentityManager::Observer:
void OnRefreshTokenUpdatedForAccount( void OnRefreshTokenUpdatedForAccount(
const AccountInfo& account_info) override; const AccountInfo& account_info) override;
// AccountTrackerService::Observer:
// NOTE: This class listens for signout events via this callback (which itself // NOTE: This class listens for signout events via this callback (which itself
// is triggered by O2TS::OnRefreshTokenRevoked()) rather than directly via // is triggered by O2TS::OnRefreshTokenRevoked()) rather than directly via
// OnRefreshTokenRevoked() in order to obtain the Gaia ID of the signed-out // OnRefreshTokenRevoked() in order to obtain the Gaia ID of the signed-out
// account, which is needed to send as input to the // account, which is needed to send as input to the
// chrome.identity.onSigninChanged event. That Gaia ID is not guaranteed to be // chrome.identity.onSigninChanged event. That Gaia ID is not guaranteed to be
// available from O2TS::OnRefreshTokenRevoked(). // available from O2TS::OnRefreshTokenRevoked().
// TODO(blundell): Eliminate this kludge by porting this class to interact void OnAccountRemovedWithInfo(const AccountInfo& info) override;
// with IdentityManager.
void OnAccountRemoved(const AccountInfo& info) override;
// Fires the chrome.identity.onSignInChanged event. // Fires the chrome.identity.onSignInChanged event.
void FireOnAccountSignInChanged(const std::string& gaia_id, void FireOnAccountSignInChanged(const std::string& gaia_id,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment