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

Unified Diff: components/signin/core/browser/about_signin_internals.h

Issue 421583002: Show GAIA/cookie accounts on the signin-internals page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unit tests fix up Created 6 years, 4 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
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..f3458219fa0f40210268a67eaa9d95ffa3403a89 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,
@@ -161,6 +173,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 +197,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);
};

Powered by Google App Engine
This is Rietveld 408576698