Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3294)

Unified Diff: chrome/browser/extensions/api/identity/identity_api.h

Issue 2673443002: Remove IdentityGetAuthTokenFunction interface dep on IdentityAPI (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/api/identity/identity_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:
« no previous file with comments | « no previous file | chrome/browser/extensions/api/identity/identity_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698