Chromium Code Reviews| 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_GAIA_COOKIE_MANAGER_SERVICE_H | 5 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_GAIA_COOKIE_MANAGER_SERVICE_H |
| 6 #define COMPONENTS_SIGNIN_CORE_BROWSER_GAIA_COOKIE_MANAGER_SERVICE_H | 6 #define COMPONENTS_SIGNIN_CORE_BROWSER_GAIA_COOKIE_MANAGER_SERVICE_H |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 | 153 |
| 154 GaiaCookieManagerService(OAuth2TokenService* token_service, | 154 GaiaCookieManagerService(OAuth2TokenService* token_service, |
| 155 const std::string& source, | 155 const std::string& source, |
| 156 SigninClient* signin_client); | 156 SigninClient* signin_client); |
| 157 ~GaiaCookieManagerService() override; | 157 ~GaiaCookieManagerService() override; |
| 158 | 158 |
| 159 void Init(); | 159 void Init(); |
| 160 void Shutdown() override; | 160 void Shutdown() override; |
| 161 | 161 |
| 162 void AddAccountToCookie(const std::string& account_id); | 162 void AddAccountToCookie(const std::string& account_id); |
| 163 void AddAccountToCookieWithToken(const std::string& account_id, | |
| 164 const std::string& access_token); | |
| 163 | 165 |
| 164 // Returns if the listed accounts are up to date or not (ignore the out | 166 // Returns if the listed accounts are up to date or not (ignore the out |
| 165 // parameter if return is false). The parameter will be assigned the current | 167 // parameter if return is false). The parameter will be assigned the current |
| 166 // cached accounts. If the accounts are not up to date, a ListAccounts fetch | 168 // cached accounts. If the accounts are not up to date, a ListAccounts fetch |
| 167 // is sent GAIA and Observer::OnGaiaAccountsInCookieUpdated will be called. | 169 // is sent GAIA and Observer::OnGaiaAccountsInCookieUpdated will be called. |
| 168 bool ListAccounts(std::vector<std::pair<std::string,bool> >* accounts); | 170 bool ListAccounts(std::vector<std::pair<std::string,bool> >* accounts); |
| 169 | 171 |
| 170 // Add or remove observers of this helper. | 172 // Add or remove observers of this helper. |
| 171 void AddObserver(Observer* observer); | 173 void AddObserver(Observer* observer); |
| 172 void RemoveObserver(Observer* observer); | 174 void RemoveObserver(Observer* observer); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 void OnUbertokenFailure(const GoogleServiceAuthError& error) override; | 211 void OnUbertokenFailure(const GoogleServiceAuthError& error) override; |
| 210 | 212 |
| 211 // Overridden from GaiaAuthConsumer. | 213 // Overridden from GaiaAuthConsumer. |
| 212 void OnMergeSessionSuccess(const std::string& data) override; | 214 void OnMergeSessionSuccess(const std::string& data) override; |
| 213 void OnMergeSessionFailure(const GoogleServiceAuthError& error) override; | 215 void OnMergeSessionFailure(const GoogleServiceAuthError& error) override; |
| 214 void OnListAccountsSuccess(const std::string& data) override; | 216 void OnListAccountsSuccess(const std::string& data) override; |
| 215 void OnListAccountsFailure(const GoogleServiceAuthError& error) override; | 217 void OnListAccountsFailure(const GoogleServiceAuthError& error) override; |
| 216 | 218 |
| 217 // Starts the proess of fetching the uber token and performing a merge session | 219 // Starts the proess of fetching the uber token and performing a merge session |
| 218 // for the next account. Virtual so that it can be overriden in tests. | 220 // for the next account. Virtual so that it can be overriden in tests. |
| 219 virtual void StartFetchingUbertoken(); | 221 virtual void StartFetchingUbertoken(const std::string& access_token); |
|
Andrew T Wilson (Slow)
2015/05/11 10:06:21
This seems like a clunky API, to have this method
Mike Lerman
2015/05/12 20:51:44
Broken out into two methods.
| |
| 220 | 222 |
| 221 // Virtual for testing purposes. | 223 // Virtual for testing purposes. |
| 222 virtual void StartFetchingMergeSession(); | 224 virtual void StartFetchingMergeSession(); |
| 223 | 225 |
| 224 // Virtual for testing purpose. | 226 // Virtual for testing purpose. |
| 225 virtual void StartLogOutUrlFetch(); | 227 virtual void StartLogOutUrlFetch(); |
| 226 | 228 |
| 227 // Virtual for testing purposes. | 229 // Virtual for testing purposes. |
| 228 virtual void StartFetchingListAccounts(); | 230 virtual void StartFetchingListAccounts(); |
| 229 | 231 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 268 | 270 |
| 269 std::vector<std::pair<std::string, bool> > listed_accounts_; | 271 std::vector<std::pair<std::string, bool> > listed_accounts_; |
| 270 | 272 |
| 271 bool list_accounts_fetched_once_; | 273 bool list_accounts_fetched_once_; |
| 272 scoped_ptr<net::URLFetcher> logout_url_request_; | 274 scoped_ptr<net::URLFetcher> logout_url_request_; |
| 273 | 275 |
| 274 DISALLOW_COPY_AND_ASSIGN(GaiaCookieManagerService); | 276 DISALLOW_COPY_AND_ASSIGN(GaiaCookieManagerService); |
| 275 }; | 277 }; |
| 276 | 278 |
| 277 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_GAIA_COOKIE_MANAGER_SERVICE_H | 279 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_GAIA_COOKIE_MANAGER_SERVICE_H |
| OLD | NEW |