Chromium Code Reviews| Index: components/signin/core/browser/about_signin_internals.h |
| diff --git a/components/signin/core/browser/about_signin_internals.h b/components/signin/core/browser/about_signin_internals.h |
| index e305ce7099a6529f9945016504147cd897efdd49..db6f86b268b3c315d1815771875911695c5acc00 100644 |
| --- a/components/signin/core/browser/about_signin_internals.h |
| +++ b/components/signin/core/browser/about_signin_internals.h |
| @@ -12,10 +12,13 @@ |
| #include "base/observer_list.h" |
| #include "base/values.h" |
| #include "components/keyed_service/core/keyed_service.h" |
| +#include "components/signin/core/browser/signin_client.h" |
| #include "components/signin/core/browser/signin_internals_util.h" |
| #include "components/signin/core/browser/signin_manager.h" |
| +#include "google_apis/gaia/gaia_auth_consumer.h" |
| #include "google_apis/gaia/oauth2_token_service.h" |
| +class GaiaAuthFetcher; |
| class ProfileOAuth2TokenService; |
| class SigninClient; |
| class SigninManagerBase; |
| @@ -29,7 +32,8 @@ typedef std::pair<std::string, std::string> TimedSigninStatusValue; |
| class AboutSigninInternals |
| : public KeyedService, |
| public signin_internals_util::SigninDiagnosticsObserver, |
| - public OAuth2TokenService::DiagnosticsObserver { |
| + public OAuth2TokenService::DiagnosticsObserver, |
| + public GaiaAuthConsumer { |
| public: |
| class Observer { |
| public: |
| @@ -37,6 +41,10 @@ class AboutSigninInternals |
| // in the comments for GetSigninStatus() below. |
| virtual void OnSigninStateChanged( |
| scoped_ptr<base::DictionaryValue> info) = 0; |
| + |
| + // Notification that the cookie accounts are ready to be displayed. |
| + virtual void OnCookieAccountsFetched( |
| + scoped_ptr<base::DictionaryValue> info) = 0; |
| }; |
| AboutSigninInternals(ProfileOAuth2TokenService* token_service, |
| @@ -81,6 +89,10 @@ class AboutSigninInternals |
| // } |
| scoped_ptr<base::DictionaryValue> GetSigninStatus(); |
| + // Triggers a ListAccounts call to acquire a list of the email addresses |
| + // corresponding to the cookies residing on the current cookie jar. |
| + void GetCookieAccountsAsync(); |
| + |
| // OAuth2TokenService::DiagnosticsObserver implementations. |
| virtual void OnAccessTokenRequested( |
| const std::string& account_id, |
| @@ -121,6 +133,22 @@ class AboutSigninInternals |
| bool removed_; |
| }; |
| + // Encapsulates diagnostic information about cookie accounts |
| + struct CookieInfo { |
| + CookieInfo(const std::string& email); |
| + ~CookieInfo(); |
| + base::DictionaryValue* ToValue() const; |
| + |
| + static bool LessThan(const TokenInfo* a, const TokenInfo* b); |
| + |
| + // Called when the cookie is invalidated. |
| + void Invalidate(); |
| + |
| + std::string email; // Email address of the token. |
| + bool valid; // If the cookie is considered valid. |
| + bool removed_; |
|
Roger Tawa OOO till Jul 10th
2014/08/06 20:29:42
Don't need trailing _ for struct. Or put it on al
Mike Lerman
2014/08/07 16:39:26
Removed the whole struct, not even using it!
|
| + }; |
| + |
| // Map account id to tokens associated to the account. |
| typedef std::map<std::string, std::vector<TokenInfo*> > TokenInfoMap; |
| @@ -161,6 +189,21 @@ class AboutSigninInternals |
| void NotifyObservers(); |
| + |
| + // Overriden from GaiaAuthConsumer. |
| + virtual void OnListAccountsSuccess(const std::string& data) OVERRIDE; |
| + virtual void OnListAccountsFailure(const GoogleServiceAuthError& error) |
| + OVERRIDE; |
| + |
| + // Callback for ListAccounts. Once the email addresses are fetched from GAIA, |
| + // they are pushed to the signin_internals_ui. |
| + void OnListAccountsComplete( |
| + std::vector<std::pair<std::string, bool> >& gaia_accounts); |
| + |
| + // Called when a cookie changes. If the cookie relates to a GAIA LSID cookie, |
| + // then we call ListAccounts and update the UI element. |
| + void OnCookieChanged(const net::CanonicalCookie* cookie); |
| + |
| // Weak pointer to the token service. |
| ProfileOAuth2TokenService* token_service_; |
| @@ -170,12 +213,18 @@ class AboutSigninInternals |
| // Weak pointer to the client. |
| SigninClient* client_; |
| + // Fetcher for information about accounts in the cookie jar from GAIA. |
| + scoped_ptr<GaiaAuthFetcher> gaia_fetcher_; |
| + |
| // Encapsulates the actual signin and token related values. |
| // Most of the values are mirrored in the prefs for persistence. |
| SigninStatus signin_status_; |
| ObserverList<Observer> signin_observers_; |
| + scoped_ptr<SigninClient::CookieChangedCallbackList::Subscription> |
| + cookie_changed_subscription_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(AboutSigninInternals); |
| }; |