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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 }; | 49 }; |
50 | 50 |
51 // Possible values for the kAccountIdMigrationState preference. | 51 // Possible values for the kAccountIdMigrationState preference. |
52 enum AccountIdMigrationState { | 52 enum AccountIdMigrationState { |
53 MIGRATION_NOT_STARTED, | 53 MIGRATION_NOT_STARTED, |
54 MIGRATION_IN_PROGRESS, | 54 MIGRATION_IN_PROGRESS, |
55 MIGRATION_DONE | 55 MIGRATION_DONE |
56 }; | 56 }; |
57 | 57 |
58 AccountTrackerService(); | 58 AccountTrackerService(); |
59 virtual ~AccountTrackerService(); | 59 ~AccountTrackerService() override; |
60 | 60 |
61 // KeyedService implementation. | 61 // KeyedService implementation. |
62 virtual void Shutdown() override; | 62 void Shutdown() override; |
63 | 63 |
64 void AddObserver(Observer* observer); | 64 void AddObserver(Observer* observer); |
65 void RemoveObserver(Observer* observer); | 65 void RemoveObserver(Observer* observer); |
66 | 66 |
67 void Initialize(OAuth2TokenService* token_service, | 67 void Initialize(OAuth2TokenService* token_service, |
68 PrefService* pref_service, | 68 PrefService* pref_service, |
69 net::URLRequestContextGetter* request_context_getter); | 69 net::URLRequestContextGetter* request_context_getter); |
70 | 70 |
71 // Returns the list of known accounts and for which gaia IDs | 71 // Returns the list of known accounts and for which gaia IDs |
72 // have been fetched. | 72 // have been fetched. |
(...skipping 11 matching lines...) Expand all Loading... |
84 | 84 |
85 private: | 85 private: |
86 friend class AccountInfoFetcher; | 86 friend class AccountInfoFetcher; |
87 | 87 |
88 // These methods are called by fetchers. | 88 // These methods are called by fetchers. |
89 void OnUserInfoFetchSuccess(AccountInfoFetcher* fetcher, | 89 void OnUserInfoFetchSuccess(AccountInfoFetcher* fetcher, |
90 const base::DictionaryValue* user_info); | 90 const base::DictionaryValue* user_info); |
91 void OnUserInfoFetchFailure(AccountInfoFetcher* fetcher); | 91 void OnUserInfoFetchFailure(AccountInfoFetcher* fetcher); |
92 | 92 |
93 // OAuth2TokenService::Observer implementation. | 93 // OAuth2TokenService::Observer implementation. |
94 virtual void OnRefreshTokenAvailable(const std::string& account_id) override; | 94 void OnRefreshTokenAvailable(const std::string& account_id) override; |
95 virtual void OnRefreshTokenRevoked(const std::string& account_id) override; | 95 void OnRefreshTokenRevoked(const std::string& account_id) override; |
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); |
(...skipping 14 matching lines...) Expand all Loading... |
120 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 120 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
121 std::map<std::string, AccountInfoFetcher*> user_info_requests_; | 121 std::map<std::string, AccountInfoFetcher*> user_info_requests_; |
122 std::map<std::string, AccountState> accounts_; | 122 std::map<std::string, AccountState> accounts_; |
123 ObserverList<Observer> observer_list_; | 123 ObserverList<Observer> observer_list_; |
124 bool shutdown_called_; | 124 bool shutdown_called_; |
125 | 125 |
126 DISALLOW_COPY_AND_ASSIGN(AccountTrackerService); | 126 DISALLOW_COPY_AND_ASSIGN(AccountTrackerService); |
127 }; | 127 }; |
128 | 128 |
129 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_TRACKER_SERVICE_H_ | 129 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_TRACKER_SERVICE_H_ |
OLD | NEW |