Index: chrome/browser/extensions/api/identity/identity_api.h |
diff --git a/chrome/browser/extensions/api/identity/identity_api.h b/chrome/browser/extensions/api/identity/identity_api.h |
index 66599fc924ce67065631de2186a9281ee5fdf9a0..61ccf0a1a76987a4b1afca77911e682ecff92bc2 100644 |
--- a/chrome/browser/extensions/api/identity/identity_api.h |
+++ b/chrome/browser/extensions/api/identity/identity_api.h |
@@ -41,6 +41,7 @@ class BrowserContext; |
namespace extensions { |
class GetAuthTokenFunctionTest; |
+class IdentityGetAuthTokenFunction; |
class MockGetAuthTokenFunction; |
class IdentityTokenCacheValue { |
@@ -79,11 +80,6 @@ class IdentityAPI : public BrowserContextKeyedAPI, |
public: |
typedef std::map<ExtensionTokenKey, IdentityTokenCacheValue> CachedTokens; |
- class ShutdownObserver { |
- public: |
- virtual void OnShutdown() = 0; |
- }; |
- |
explicit IdentityAPI(content::BrowserContext* context); |
~IdentityAPI() override; |
@@ -114,11 +110,13 @@ class IdentityAPI : public BrowserContextKeyedAPI, |
void OnAccountSignInChanged(const gaia::AccountIds& ids, |
bool is_signed_in) override; |
- void AddShutdownObserver(ShutdownObserver* observer); |
- void RemoveShutdownObserver(ShutdownObserver* observer); |
- |
void SetAccountStateForTest(gaia::AccountIds ids, bool is_signed_in); |
+ void set_get_auth_token_function( |
+ IdentityGetAuthTokenFunction* get_auth_token_function) { |
+ get_auth_token_function_ = get_auth_token_function; |
+ } |
+ |
private: |
friend class BrowserContextKeyedAPIFactory<IdentityAPI>; |
@@ -131,7 +129,9 @@ class IdentityAPI : public BrowserContextKeyedAPI, |
CachedTokens token_cache_; |
ProfileIdentityProvider profile_identity_provider_; |
gaia::AccountTracker account_tracker_; |
- base::ObserverList<ShutdownObserver> shutdown_observer_list_; |
+ |
+ // May be null. |
+ IdentityGetAuthTokenFunction* get_auth_token_function_; |
}; |
template <> |
@@ -173,8 +173,7 @@ class IdentityGetAuthTokenFunction : public ChromeAsyncExtensionFunction, |
public IdentityMintRequestQueue::Request, |
public OAuth2MintTokenFlow::Delegate, |
public IdentitySigninFlow::Delegate, |
- public OAuth2TokenService::Consumer, |
- public IdentityAPI::ShutdownObserver { |
+ public OAuth2TokenService::Consumer { |
public: |
DECLARE_EXTENSION_FUNCTION("identity.getAuthToken", |
EXPERIMENTAL_IDENTITY_GETAUTHTOKEN); |
@@ -185,6 +184,8 @@ class IdentityGetAuthTokenFunction : public ChromeAsyncExtensionFunction, |
return token_key_.get(); |
} |
+ void Shutdown(); |
+ |
protected: |
~IdentityGetAuthTokenFunction() override; |
@@ -250,9 +251,6 @@ class IdentityGetAuthTokenFunction : public ChromeAsyncExtensionFunction, |
void OnMintTokenFailure(const GoogleServiceAuthError& error) override; |
void OnIssueAdviceSuccess(const IssueAdviceInfo& issue_advice) override; |
- // IdentityAPI::ShutdownObserver implementation: |
- void OnShutdown() override; |
- |
#if defined(OS_CHROMEOS) |
// Starts a login access token request for device robot account. This method |
// will be called only in Chrome OS for: |