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 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_RECONCILOR_H_ | 4 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_RECONCILOR_H_ |
5 #define COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_RECONCILOR_H_ | 5 #define COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_RECONCILOR_H_ |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
8 #include <functional> | 8 #include <functional> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 class AccountReconcilor : public KeyedService, | 35 class AccountReconcilor : public KeyedService, |
36 public GaiaAuthConsumer, | 36 public GaiaAuthConsumer, |
37 public MergeSessionHelper::Observer, | 37 public MergeSessionHelper::Observer, |
38 public OAuth2TokenService::Observer, | 38 public OAuth2TokenService::Observer, |
39 public SigninManagerBase::Observer { | 39 public SigninManagerBase::Observer { |
40 public: | 40 public: |
41 AccountReconcilor(ProfileOAuth2TokenService* token_service, | 41 AccountReconcilor(ProfileOAuth2TokenService* token_service, |
42 SigninManagerBase* signin_manager, | 42 SigninManagerBase* signin_manager, |
43 SigninClient* client); | 43 SigninClient* client); |
44 virtual ~AccountReconcilor(); | 44 ~AccountReconcilor() override; |
45 | 45 |
46 void Initialize(bool start_reconcile_if_tokens_available); | 46 void Initialize(bool start_reconcile_if_tokens_available); |
47 | 47 |
48 // Signal that the status of the new_profile_management flag has changed. | 48 // Signal that the status of the new_profile_management flag has changed. |
49 // Pass the new status as an explicit parameter since disabling the flag | 49 // Pass the new status as an explicit parameter since disabling the flag |
50 // doesn't remove it from the CommandLine::ForCurrentProcess(). | 50 // doesn't remove it from the CommandLine::ForCurrentProcess(). |
51 void OnNewProfileManagementFlagChanged(bool new_flag_status); | 51 void OnNewProfileManagementFlagChanged(bool new_flag_status); |
52 | 52 |
53 // KeyedService implementation. | 53 // KeyedService implementation. |
54 virtual void Shutdown() override; | 54 void Shutdown() override; |
55 | 55 |
56 // Add or remove observers for the merge session notification. | 56 // Add or remove observers for the merge session notification. |
57 void AddMergeSessionObserver(MergeSessionHelper::Observer* observer); | 57 void AddMergeSessionObserver(MergeSessionHelper::Observer* observer); |
58 void RemoveMergeSessionObserver(MergeSessionHelper::Observer* observer); | 58 void RemoveMergeSessionObserver(MergeSessionHelper::Observer* observer); |
59 | 59 |
60 ProfileOAuth2TokenService* token_service() { return token_service_; } | 60 ProfileOAuth2TokenService* token_service() { return token_service_; } |
61 SigninClient* client() { return client_; } | 61 SigninClient* client() { return client_; } |
62 | 62 |
63 protected: | 63 protected: |
64 // Used during GetAccountsFromCookie. | 64 // Used during GetAccountsFromCookie. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 void ContinueReconcileActionAfterGetGaiaAccounts( | 131 void ContinueReconcileActionAfterGetGaiaAccounts( |
132 const GoogleServiceAuthError& error, | 132 const GoogleServiceAuthError& error, |
133 const std::vector<std::pair<std::string, bool> >& accounts); | 133 const std::vector<std::pair<std::string, bool> >& accounts); |
134 void ValidateAccountsFromTokenService(); | 134 void ValidateAccountsFromTokenService(); |
135 // Note internally that this |account_id| is added to the cookie jar. | 135 // Note internally that this |account_id| is added to the cookie jar. |
136 bool MarkAccountAsAddedToCookie(const std::string& account_id); | 136 bool MarkAccountAsAddedToCookie(const std::string& account_id); |
137 | 137 |
138 void OnCookieChanged(const net::CanonicalCookie* cookie); | 138 void OnCookieChanged(const net::CanonicalCookie* cookie); |
139 | 139 |
140 // Overriden from GaiaAuthConsumer. | 140 // Overriden from GaiaAuthConsumer. |
141 virtual void OnListAccountsSuccess(const std::string& data) override; | 141 void OnListAccountsSuccess(const std::string& data) override; |
142 virtual void OnListAccountsFailure(const GoogleServiceAuthError& error) | 142 void OnListAccountsFailure(const GoogleServiceAuthError& error) override; |
143 override; | |
144 | 143 |
145 // Overriden from MergeSessionHelper::Observer. | 144 // Overriden from MergeSessionHelper::Observer. |
146 virtual void MergeSessionCompleted(const std::string& account_id, | 145 void MergeSessionCompleted(const std::string& account_id, |
147 const GoogleServiceAuthError& error) | 146 const GoogleServiceAuthError& error) override; |
148 override; | |
149 | 147 |
150 // Overriden from OAuth2TokenService::Observer. | 148 // Overriden from OAuth2TokenService::Observer. |
151 virtual void OnEndBatchChanges() override; | 149 void OnEndBatchChanges() override; |
152 | 150 |
153 // Overriden from SigninManagerBase::Observer. | 151 // Overriden from SigninManagerBase::Observer. |
154 virtual void GoogleSigninSucceeded(const std::string& account_id, | 152 void GoogleSigninSucceeded(const std::string& account_id, |
155 const std::string& username, | 153 const std::string& username, |
156 const std::string& password) override; | 154 const std::string& password) override; |
157 virtual void GoogleSignedOut(const std::string& account_id, | 155 void GoogleSignedOut(const std::string& account_id, |
158 const std::string& username) override; | 156 const std::string& username) override; |
159 | 157 |
160 void MayBeDoNextListAccounts(); | 158 void MayBeDoNextListAccounts(); |
161 | 159 |
162 // The ProfileOAuth2TokenService associated with this reconcilor. | 160 // The ProfileOAuth2TokenService associated with this reconcilor. |
163 ProfileOAuth2TokenService* token_service_; | 161 ProfileOAuth2TokenService* token_service_; |
164 | 162 |
165 // The SigninManager associated with this reconcilor. | 163 // The SigninManager associated with this reconcilor. |
166 SigninManagerBase* signin_manager_; | 164 SigninManagerBase* signin_manager_; |
167 | 165 |
168 // The SigninClient associated with this reconcilor. | 166 // The SigninClient associated with this reconcilor. |
(...skipping 27 matching lines...) Expand all Loading... |
196 | 194 |
197 std::deque<GetAccountsFromCookieCallback> get_gaia_accounts_callbacks_; | 195 std::deque<GetAccountsFromCookieCallback> get_gaia_accounts_callbacks_; |
198 | 196 |
199 scoped_ptr<SigninClient::CookieChangedCallbackList::Subscription> | 197 scoped_ptr<SigninClient::CookieChangedCallbackList::Subscription> |
200 cookie_changed_subscription_; | 198 cookie_changed_subscription_; |
201 | 199 |
202 DISALLOW_COPY_AND_ASSIGN(AccountReconcilor); | 200 DISALLOW_COPY_AND_ASSIGN(AccountReconcilor); |
203 }; | 201 }; |
204 | 202 |
205 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_RECONCILOR_H_ | 203 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_RECONCILOR_H_ |
OLD | NEW |