| 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" |
| 11 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
| 12 #include "components/signin/core/browser/signin_client.h" | 12 #include "components/signin/core/browser/signin_client.h" |
| 13 #include "google_apis/gaia/gaia_auth_consumer.h" | 13 #include "google_apis/gaia/gaia_auth_consumer.h" |
| 14 #include "google_apis/gaia/gaia_auth_util.h" |
| 14 #include "google_apis/gaia/ubertoken_fetcher.h" | 15 #include "google_apis/gaia/ubertoken_fetcher.h" |
| 15 #include "net/base/backoff_entry.h" | 16 #include "net/base/backoff_entry.h" |
| 16 #include "net/url_request/url_fetcher_delegate.h" | 17 #include "net/url_request/url_fetcher_delegate.h" |
| 17 | 18 |
| 18 class GaiaAuthFetcher; | 19 class GaiaAuthFetcher; |
| 19 class GaiaCookieRequest; | 20 class GaiaCookieRequest; |
| 20 class GoogleServiceAuthError; | 21 class GoogleServiceAuthError; |
| 21 class OAuth2TokenService; | 22 class OAuth2TokenService; |
| 22 | 23 |
| 23 namespace net { | 24 namespace net { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 const GoogleServiceAuthError& error) {} | 75 const GoogleServiceAuthError& error) {} |
| 75 | 76 |
| 76 // Called whenever the GaiaCookieManagerService's list of GAIA accounts is | 77 // Called whenever the GaiaCookieManagerService's list of GAIA accounts is |
| 77 // updated. The GCMS monitors the APISID cookie and triggers a /ListAccounts | 78 // updated. The GCMS monitors the APISID cookie and triggers a /ListAccounts |
| 78 // call on change. The GCMS will also call ListAccounts upon the first call | 79 // call on change. The GCMS will also call ListAccounts upon the first call |
| 79 // to ListAccounts(). The GCMS will delay calling ListAccounts if other | 80 // to ListAccounts(). The GCMS will delay calling ListAccounts if other |
| 80 // requests are in queue that would modify the APISID cookie. | 81 // requests are in queue that would modify the APISID cookie. |
| 81 // If the ListAccounts call fails and the GCMS cannot recover, the reason | 82 // If the ListAccounts call fails and the GCMS cannot recover, the reason |
| 82 // is passed in |error|. | 83 // is passed in |error|. |
| 83 virtual void OnGaiaAccountsInCookieUpdated( | 84 virtual void OnGaiaAccountsInCookieUpdated( |
| 84 const std::vector<std::pair<std::string, bool> >& accounts, | 85 const std::vector<gaia::ListedAccount>& accounts, |
| 85 const GoogleServiceAuthError& error) {} | 86 const GoogleServiceAuthError& error) {} |
| 86 | 87 |
| 87 protected: | 88 protected: |
| 88 virtual ~Observer() {} | 89 virtual ~Observer() {} |
| 89 }; | 90 }; |
| 90 | 91 |
| 91 // Class to retrieve the external connection check results from gaia. | 92 // Class to retrieve the external connection check results from gaia. |
| 92 // Declared publicly for unit tests. | 93 // Declared publicly for unit tests. |
| 93 class ExternalCcResultFetcher : public GaiaAuthConsumer, | 94 class ExternalCcResultFetcher : public GaiaAuthConsumer, |
| 94 public net::URLFetcherDelegate { | 95 public net::URLFetcherDelegate { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 void Shutdown() override; | 160 void Shutdown() override; |
| 160 | 161 |
| 161 void AddAccountToCookie(const std::string& account_id); | 162 void AddAccountToCookie(const std::string& account_id); |
| 162 void AddAccountToCookieWithToken(const std::string& account_id, | 163 void AddAccountToCookieWithToken(const std::string& account_id, |
| 163 const std::string& access_token); | 164 const std::string& access_token); |
| 164 | 165 |
| 165 // 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 |
| 166 // 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 |
| 167 // 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 |
| 168 // is sent GAIA and Observer::OnGaiaAccountsInCookieUpdated will be called. | 169 // is sent GAIA and Observer::OnGaiaAccountsInCookieUpdated will be called. |
| 169 bool ListAccounts(std::vector<std::pair<std::string,bool> >* accounts); | 170 bool ListAccounts(std::vector<gaia::ListedAccount>* accounts); |
| 170 | 171 |
| 171 // Add or remove observers of this helper. | 172 // Add or remove observers of this helper. |
| 172 void AddObserver(Observer* observer); | 173 void AddObserver(Observer* observer); |
| 173 void RemoveObserver(Observer* observer); | 174 void RemoveObserver(Observer* observer); |
| 174 | 175 |
| 175 // Cancel all login requests. | 176 // Cancel all login requests. |
| 176 void CancelAll(); | 177 void CancelAll(); |
| 177 | 178 |
| 178 // Signout all accounts. | 179 // Signout all accounts. |
| 179 void LogOutAllAccounts(); | 180 void LogOutAllAccounts(); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 // List of observers to notify when merge session completes. | 269 // List of observers to notify when merge session completes. |
| 269 // Makes sure list is empty on destruction. | 270 // Makes sure list is empty on destruction. |
| 270 base::ObserverList<Observer, true> observer_list_; | 271 base::ObserverList<Observer, true> observer_list_; |
| 271 | 272 |
| 272 // Source to use with GAIA endpoints for accounting. | 273 // Source to use with GAIA endpoints for accounting. |
| 273 std::string source_; | 274 std::string source_; |
| 274 | 275 |
| 275 // True once the ExternalCCResultFetcher has completed once. | 276 // True once the ExternalCCResultFetcher has completed once. |
| 276 bool external_cc_result_fetched_; | 277 bool external_cc_result_fetched_; |
| 277 | 278 |
| 278 std::vector<std::pair<std::string, bool> > listed_accounts_; | 279 std::vector<gaia::ListedAccount> listed_accounts_; |
| 279 | 280 |
| 280 bool list_accounts_fetched_once_; | 281 bool list_accounts_fetched_once_; |
| 281 | 282 |
| 282 DISALLOW_COPY_AND_ASSIGN(GaiaCookieManagerService); | 283 DISALLOW_COPY_AND_ASSIGN(GaiaCookieManagerService); |
| 283 }; | 284 }; |
| 284 | 285 |
| 285 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_GAIA_COOKIE_MANAGER_SERVICE_H | 286 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_GAIA_COOKIE_MANAGER_SERVICE_H |
| OLD | NEW |