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