OLD | NEW |
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // have been fetched. | 72 // have been fetched. |
73 std::vector<AccountInfo> GetAccounts() const; | 73 std::vector<AccountInfo> GetAccounts() const; |
74 AccountInfo GetAccountInfo(const std::string& account_id); | 74 AccountInfo GetAccountInfo(const std::string& account_id); |
75 AccountInfo FindAccountInfoByGaiaId(const std::string& gaia_id); | 75 AccountInfo FindAccountInfoByGaiaId(const std::string& gaia_id); |
76 AccountInfo FindAccountInfoByEmail(const std::string& email); | 76 AccountInfo FindAccountInfoByEmail(const std::string& email); |
77 | 77 |
78 // 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, |
79 // there are still unfininshed fetchers. | 79 // there are still unfininshed fetchers. |
80 virtual bool IsAllUserInfoFetched() const; | 80 virtual bool IsAllUserInfoFetched() const; |
81 | 81 |
| 82 // Picks the corect account_id for the specified account depending on the |
| 83 // migration state. |
| 84 std::string PickAccountIdForAccount(const std::string& gaia_id, |
| 85 const std::string& email); |
| 86 static std::string PickAccountIdForAccount(PrefService* pref_service, |
| 87 const std::string& gaia_id, |
| 88 const std::string& email); |
| 89 |
| 90 // Seed the gaia id and email for the given account_id. |
| 91 void SeedAccountInfo(const std::string& account_id, |
| 92 const std::string& gaia, |
| 93 const std::string& email); |
| 94 |
82 AccountIdMigrationState GetMigrationState(); | 95 AccountIdMigrationState GetMigrationState(); |
83 static AccountIdMigrationState GetMigrationState(PrefService* pref_service); | 96 static AccountIdMigrationState GetMigrationState(PrefService* pref_service); |
84 | 97 |
85 private: | 98 private: |
86 friend class AccountInfoFetcher; | 99 friend class AccountInfoFetcher; |
87 | 100 |
88 // These methods are called by fetchers. | 101 // These methods are called by fetchers. |
89 void OnUserInfoFetchSuccess(AccountInfoFetcher* fetcher, | 102 void OnUserInfoFetchSuccess(AccountInfoFetcher* fetcher, |
90 const base::DictionaryValue* user_info); | 103 const base::DictionaryValue* user_info); |
91 void OnUserInfoFetchFailure(AccountInfoFetcher* fetcher); | 104 void OnUserInfoFetchFailure(AccountInfoFetcher* fetcher); |
(...skipping 28 matching lines...) Expand all Loading... |
120 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 133 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
121 std::map<std::string, AccountInfoFetcher*> user_info_requests_; | 134 std::map<std::string, AccountInfoFetcher*> user_info_requests_; |
122 std::map<std::string, AccountState> accounts_; | 135 std::map<std::string, AccountState> accounts_; |
123 ObserverList<Observer> observer_list_; | 136 ObserverList<Observer> observer_list_; |
124 bool shutdown_called_; | 137 bool shutdown_called_; |
125 | 138 |
126 DISALLOW_COPY_AND_ASSIGN(AccountTrackerService); | 139 DISALLOW_COPY_AND_ASSIGN(AccountTrackerService); |
127 }; | 140 }; |
128 | 141 |
129 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_TRACKER_SERVICE_H_ | 142 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_TRACKER_SERVICE_H_ |
OLD | NEW |