| 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 correct account_id for the specified account depending on the |
| 83 // migration state. |
| 84 std::string PickAccountIdForAccount(const std::string& gaia, |
| 85 const std::string& email); |
| 86 static std::string PickAccountIdForAccount(PrefService* pref_service, |
| 87 const std::string& gaia, |
| 88 const std::string& email); |
| 89 |
| 90 // Seeds the account whose account_id is given by PickAccountIdForAccount() |
| 91 // with its corresponding gaia id and email address. |
| 92 void SeedAccountInfo(const std::string& gaia, const std::string& email); |
| 93 |
| 82 AccountIdMigrationState GetMigrationState(); | 94 AccountIdMigrationState GetMigrationState(); |
| 83 static AccountIdMigrationState GetMigrationState(PrefService* pref_service); | 95 static AccountIdMigrationState GetMigrationState(PrefService* pref_service); |
| 84 | 96 |
| 85 private: | 97 private: |
| 86 friend class AccountInfoFetcher; | 98 friend class AccountInfoFetcher; |
| 87 | 99 |
| 88 // These methods are called by fetchers. | 100 // These methods are called by fetchers. |
| 89 void OnUserInfoFetchSuccess(AccountInfoFetcher* fetcher, | 101 void OnUserInfoFetchSuccess(AccountInfoFetcher* fetcher, |
| 90 const base::DictionaryValue* user_info); | 102 const base::DictionaryValue* user_info); |
| 91 void OnUserInfoFetchFailure(AccountInfoFetcher* fetcher); | 103 void OnUserInfoFetchFailure(AccountInfoFetcher* fetcher); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 120 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 132 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
| 121 std::map<std::string, AccountInfoFetcher*> user_info_requests_; | 133 std::map<std::string, AccountInfoFetcher*> user_info_requests_; |
| 122 std::map<std::string, AccountState> accounts_; | 134 std::map<std::string, AccountState> accounts_; |
| 123 ObserverList<Observer> observer_list_; | 135 ObserverList<Observer> observer_list_; |
| 124 bool shutdown_called_; | 136 bool shutdown_called_; |
| 125 | 137 |
| 126 DISALLOW_COPY_AND_ASSIGN(AccountTrackerService); | 138 DISALLOW_COPY_AND_ASSIGN(AccountTrackerService); |
| 127 }; | 139 }; |
| 128 | 140 |
| 129 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_TRACKER_SERVICE_H_ | 141 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_TRACKER_SERVICE_H_ |
| OLD | NEW |