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

Side by Side Diff: chrome/browser/signin/signin_account_id_helper.h

Issue 186773005: Move SigninAccountIdHelper away from listening to Signin notifications (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/signin/signin_account_id_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_SIGNIN_SIGNIN_ACCOUNT_ID_HELPER_H_ 5 #ifndef CHROME_BROWSER_SIGNIN_SIGNIN_ACCOUNT_ID_HELPER_H_
6 #define CHROME_BROWSER_SIGNIN_SIGNIN_ACCOUNT_ID_HELPER_H_ 6 #define CHROME_BROWSER_SIGNIN_SIGNIN_ACCOUNT_ID_HELPER_H_
7 7
8 #include "content/public/browser/notification_observer.h" 8 #include "chrome/browser/signin/signin_manager.h"
9 #include "content/public/browser/notification_registrar.h"
10 #include "google_apis/gaia/gaia_oauth_client.h" 9 #include "google_apis/gaia/gaia_oauth_client.h"
11 #include "google_apis/gaia/oauth2_token_service.h" 10 #include "google_apis/gaia/oauth2_token_service.h"
12 11
13 class CookieSettings; 12 class CookieSettings;
14 class GaiaAuthFetcher; 13 class GaiaAuthFetcher;
15 class SigninManagerBase;
16 14
17 // The helper class for managing the obfuscated GAIA ID of the primary 15 // The helper class for managing the obfuscated GAIA ID of the primary
18 // account. It fetches the ID when user first signs into Chrome or when user 16 // account. It fetches the ID when user first signs into Chrome or when user
19 // opens a connected Chrome profile without an obfuscated GAIA ID, and stores 17 // opens a connected Chrome profile without an obfuscated GAIA ID, and stores
20 // the ID in the profile preference. 18 // the ID in the profile preference.
21 class SigninAccountIdHelper 19 class SigninAccountIdHelper : public SigninManagerBase::Observer,
22 : public content::NotificationObserver, 20 public OAuth2TokenService::Observer {
23 public OAuth2TokenService::Observer {
24 public: 21 public:
25 explicit SigninAccountIdHelper(SigninManagerBase* signin_manager); 22 explicit SigninAccountIdHelper(SigninManagerBase* signin_manager);
26 virtual ~SigninAccountIdHelper(); 23 virtual ~SigninAccountIdHelper();
27 24
28 // content::NotificationObserver 25 // SigninManagerBase::Observer:
29 virtual void Observe(int type, 26 virtual void GoogleSignedOut(const std::string& username) OVERRIDE;
30 const content::NotificationSource& source,
31 const content::NotificationDetails& details) OVERRIDE;
32 27
33 // OAuth2TokenService::Observer: 28 // OAuth2TokenService::Observer:
34 virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE; 29 virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE;
35 30
36 // Disables network requests for testing to avoid messing up with irrelevant 31 // Disables network requests for testing to avoid messing up with irrelevant
37 // tests. 32 // tests.
38 static void SetDisableForTest(bool disable_for_test); 33 static void SetDisableForTest(bool disable_for_test);
39 34
40 private: 35 private:
41 // Invoked when receiving the response for |account_id_fetcher_|. 36 // Invoked when receiving the response for |account_id_fetcher_|.
42 void OnPrimaryAccountIdFetched(const std::string& gaia_id); 37 void OnPrimaryAccountIdFetched(const std::string& gaia_id);
43 38
44 // Helper class for fetching the obfuscated account ID. 39 // Helper class for fetching the obfuscated account ID.
45 class GaiaIdFetcher; 40 class GaiaIdFetcher;
46 scoped_ptr<GaiaIdFetcher> id_fetcher_; 41 scoped_ptr<GaiaIdFetcher> id_fetcher_;
47 42
48 static bool disable_for_test_; 43 static bool disable_for_test_;
49 44
50 SigninManagerBase* signin_manager_; 45 SigninManagerBase* signin_manager_;
51 content::NotificationRegistrar registrar_;
52 46
53 DISALLOW_COPY_AND_ASSIGN(SigninAccountIdHelper); 47 DISALLOW_COPY_AND_ASSIGN(SigninAccountIdHelper);
54 }; 48 };
55 49
56 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_ACCOUNT_ID_HELPER_H_ 50 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_ACCOUNT_ID_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/signin/signin_account_id_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698