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

Side by Side Diff: components/signin/core/browser/account_tracker_service.h

Issue 475763005: Add flag to track migration from email to gaia id. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_TRACKER_SERVICE_H_ 5 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_TRACKER_SERVICE_H_
6 #define COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_TRACKER_SERVICE_H_ 6 #define COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_TRACKER_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 30 matching lines...) Expand all
41 41
42 // Clients of AccountTrackerService can implement this interface and register 42 // Clients of AccountTrackerService can implement this interface and register
43 // with AddObserver() to learn about account information changes. 43 // with AddObserver() to learn about account information changes.
44 class Observer { 44 class Observer {
45 public: 45 public:
46 virtual ~Observer() {} 46 virtual ~Observer() {}
47 virtual void OnAccountUpdated(const AccountInfo& info) = 0; 47 virtual void OnAccountUpdated(const AccountInfo& info) = 0;
48 virtual void OnAccountRemoved(const AccountInfo& info) = 0; 48 virtual void OnAccountRemoved(const AccountInfo& info) = 0;
49 }; 49 };
50 50
51 // Possible values for the kAccountIdMigrationState preference.
52 enum AccountIdMigrationState {
53 MIGRATION_NOT_STARTED,
54 MIGRATION_IN_PROGRESS,
55 MIGRATION_DONE
56 };
57
51 AccountTrackerService(); 58 AccountTrackerService();
52 virtual ~AccountTrackerService(); 59 virtual ~AccountTrackerService();
53 60
54 // KeyedService implementation. 61 // KeyedService implementation.
55 virtual void Shutdown() OVERRIDE; 62 virtual void Shutdown() OVERRIDE;
56 63
57 void AddObserver(Observer* observer); 64 void AddObserver(Observer* observer);
58 void RemoveObserver(Observer* observer); 65 void RemoveObserver(Observer* observer);
59 66
60 void Initialize(OAuth2TokenService* token_service, 67 void Initialize(OAuth2TokenService* token_service,
61 PrefService* pref_service, 68 PrefService* pref_service,
62 net::URLRequestContextGetter* request_context_getter); 69 net::URLRequestContextGetter* request_context_getter);
63 70
64 // Returns the list of known accounts and for which gaia IDs 71 // Returns the list of known accounts and for which gaia IDs
65 // have been fetched. 72 // have been fetched.
66 std::vector<AccountInfo> GetAccounts() const; 73 std::vector<AccountInfo> GetAccounts() const;
67 AccountInfo GetAccountInfo(const std::string& account_id); 74 AccountInfo GetAccountInfo(const std::string& account_id);
68 AccountInfo FindAccountInfoByGaiaId(const std::string& gaia_id); 75 AccountInfo FindAccountInfoByGaiaId(const std::string& gaia_id);
69 AccountInfo FindAccountInfoByEmail(const std::string& email); 76 AccountInfo FindAccountInfoByEmail(const std::string& email);
70 77
71 // Indicates if all user information has been fetched. If the result is false, 78 // Indicates if all user information has been fetched. If the result is false,
72 // there are still unfininshed fetchers. 79 // there are still unfininshed fetchers.
73 virtual bool IsAllUserInfoFetched() const; 80 virtual bool IsAllUserInfoFetched() const;
74 81
82 AccountIdMigrationState GetMigrationState();
83 static AccountIdMigrationState GetMigrationState(PrefService* pref_service);
84
75 private: 85 private:
76 friend class AccountInfoFetcher; 86 friend class AccountInfoFetcher;
77 87
78 // These methods are called by fetchers. 88 // These methods are called by fetchers.
79 void OnUserInfoFetchSuccess(AccountInfoFetcher* fetcher, 89 void OnUserInfoFetchSuccess(AccountInfoFetcher* fetcher,
80 const base::DictionaryValue* user_info); 90 const base::DictionaryValue* user_info);
81 void OnUserInfoFetchFailure(AccountInfoFetcher* fetcher); 91 void OnUserInfoFetchFailure(AccountInfoFetcher* fetcher);
82 92
83 // OAuth2TokenService::Observer implementation. 93 // OAuth2TokenService::Observer implementation.
84 virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE; 94 virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE;
(...skipping 23 matching lines...) Expand all
108 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; 118 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
109 std::map<std::string, AccountInfoFetcher*> user_info_requests_; 119 std::map<std::string, AccountInfoFetcher*> user_info_requests_;
110 std::map<std::string, AccountState> accounts_; 120 std::map<std::string, AccountState> accounts_;
111 ObserverList<Observer> observer_list_; 121 ObserverList<Observer> observer_list_;
112 bool shutdown_called_; 122 bool shutdown_called_;
113 123
114 DISALLOW_COPY_AND_ASSIGN(AccountTrackerService); 124 DISALLOW_COPY_AND_ASSIGN(AccountTrackerService);
115 }; 125 };
116 126
117 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_TRACKER_SERVICE_H_ 127 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_TRACKER_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/signin/account_tracker_service_factory.cc ('k') | components/signin/core/browser/account_tracker_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698