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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 struct AccountState { | 97 struct AccountState { |
98 AccountInfo info; | 98 AccountInfo info; |
99 }; | 99 }; |
100 | 100 |
101 void NotifyAccountUpdated(const AccountState& state); | 101 void NotifyAccountUpdated(const AccountState& state); |
102 void NotifyAccountRemoved(const AccountState& state); | 102 void NotifyAccountRemoved(const AccountState& state); |
103 | 103 |
104 void StartTrackingAccount(const std::string& account_id); | 104 void StartTrackingAccount(const std::string& account_id); |
105 void StopTrackingAccount(const std::string& account_id); | 105 void StopTrackingAccount(const std::string& account_id); |
106 void StartFetchingUserInfo(const std::string& account_id); | 106 |
| 107 // Virtual so that tests can override the network fetching behaviour. |
| 108 virtual void StartFetchingUserInfo(const std::string& account_id); |
107 void DeleteFetcher(AccountInfoFetcher* fetcher); | 109 void DeleteFetcher(AccountInfoFetcher* fetcher); |
108 | 110 |
109 // Load the current state of the account info from the preferences file. | 111 // Load the current state of the account info from the preferences file. |
110 void LoadFromPrefs(); | 112 void LoadFromPrefs(); |
111 void SaveToPrefs(const AccountState& account); | 113 void SaveToPrefs(const AccountState& account); |
112 void RemoveFromPrefs(const AccountState& account); | 114 void RemoveFromPrefs(const AccountState& account); |
113 | 115 |
114 void LoadFromTokenService(); | 116 void LoadFromTokenService(); |
115 | 117 |
116 OAuth2TokenService* token_service_; // Not owned. | 118 OAuth2TokenService* token_service_; // Not owned. |
117 PrefService* pref_service_; // Not owned. | 119 PrefService* pref_service_; // Not owned. |
118 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 120 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
119 std::map<std::string, AccountInfoFetcher*> user_info_requests_; | 121 std::map<std::string, AccountInfoFetcher*> user_info_requests_; |
120 std::map<std::string, AccountState> accounts_; | 122 std::map<std::string, AccountState> accounts_; |
121 ObserverList<Observer> observer_list_; | 123 ObserverList<Observer> observer_list_; |
122 bool shutdown_called_; | 124 bool shutdown_called_; |
123 | 125 |
124 DISALLOW_COPY_AND_ASSIGN(AccountTrackerService); | 126 DISALLOW_COPY_AND_ASSIGN(AccountTrackerService); |
125 }; | 127 }; |
126 | 128 |
127 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_TRACKER_SERVICE_H_ | 129 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_TRACKER_SERVICE_H_ |
OLD | NEW |