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 <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
15 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
17 #include "components/keyed_service/core/keyed_service.h" | 17 #include "components/keyed_service/core/keyed_service.h" |
18 #include "google_apis/gaia/gaia_auth_util.h" | 18 #include "google_apis/gaia/gaia_auth_util.h" |
19 | 19 |
20 | 20 |
21 class PrefService; | 21 class PrefService; |
22 class SigninClient; | 22 class SigninClient; |
23 | 23 |
24 namespace base { | 24 namespace base { |
25 class DictionaryValue; | 25 class DictionaryValue; |
26 } | 26 } |
27 | 27 |
| 28 namespace user_prefs { |
| 29 class PrefRegistrySyncable; |
| 30 } |
| 31 |
28 // AccountTrackerService is a KeyedService that retrieves and caches GAIA | 32 // AccountTrackerService is a KeyedService that retrieves and caches GAIA |
29 // information about Google Accounts. | 33 // information about Google Accounts. |
30 class AccountTrackerService : public KeyedService, | 34 class AccountTrackerService : public KeyedService, |
31 public base::NonThreadSafe { | 35 public base::NonThreadSafe { |
32 public: | 36 public: |
33 // Name of the preference property that persists the account information | 37 // Name of the preference property that persists the account information |
34 // tracked by this service. | 38 // tracked by this service. |
35 static const char kAccountInfoPref[]; | 39 static const char kAccountInfoPref[]; |
36 | 40 |
37 // TODO(mlerman): Remove all references to Profile::kNoHostedDomainFound in | 41 // TODO(mlerman): Remove all references to Profile::kNoHostedDomainFound in |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // Possible values for the kAccountIdMigrationState preference. | 77 // Possible values for the kAccountIdMigrationState preference. |
74 enum AccountIdMigrationState { | 78 enum AccountIdMigrationState { |
75 MIGRATION_NOT_STARTED, | 79 MIGRATION_NOT_STARTED, |
76 MIGRATION_IN_PROGRESS, | 80 MIGRATION_IN_PROGRESS, |
77 MIGRATION_DONE | 81 MIGRATION_DONE |
78 }; | 82 }; |
79 | 83 |
80 AccountTrackerService(); | 84 AccountTrackerService(); |
81 ~AccountTrackerService() override; | 85 ~AccountTrackerService() override; |
82 | 86 |
| 87 // Registers the preferences used by AccountTrackerService. |
| 88 static void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry); |
| 89 |
83 // KeyedService implementation. | 90 // KeyedService implementation. |
84 void Shutdown() override; | 91 void Shutdown() override; |
85 | 92 |
86 void AddObserver(Observer* observer); | 93 void AddObserver(Observer* observer); |
87 void RemoveObserver(Observer* observer); | 94 void RemoveObserver(Observer* observer); |
88 | 95 |
89 // Take a SigninClient rather than a PrefService and a URLRequestContextGetter | 96 // Take a SigninClient rather than a PrefService and a URLRequestContextGetter |
90 // since RequestContext cannot be created at startup. | 97 // since RequestContext cannot be created at startup. |
91 // (see http://crbug.com/171406) | 98 // (see http://crbug.com/171406) |
92 void Initialize(SigninClient* signin_client); | 99 void Initialize(SigninClient* signin_client); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 void RemoveFromPrefs(const AccountState& account); | 150 void RemoveFromPrefs(const AccountState& account); |
144 | 151 |
145 SigninClient* signin_client_; // Not owned. | 152 SigninClient* signin_client_; // Not owned. |
146 std::map<std::string, AccountState> accounts_; | 153 std::map<std::string, AccountState> accounts_; |
147 base::ObserverList<Observer> observer_list_; | 154 base::ObserverList<Observer> observer_list_; |
148 | 155 |
149 DISALLOW_COPY_AND_ASSIGN(AccountTrackerService); | 156 DISALLOW_COPY_AND_ASSIGN(AccountTrackerService); |
150 }; | 157 }; |
151 | 158 |
152 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_TRACKER_SERVICE_H_ | 159 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_TRACKER_SERVICE_H_ |
OLD | NEW |