| 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 CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_TOKEN_FETCHER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_TOKEN_FETCHER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_TOKEN_FETCHER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_TOKEN_FETCHER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 const GaiaAuthConsumer::ClientOAuthResult& oauth2_tokens) = 0; | 33 const GaiaAuthConsumer::ClientOAuthResult& oauth2_tokens) = 0; |
| 34 virtual void OnOAuth2TokensFetchFailed() = 0; | 34 virtual void OnOAuth2TokensFetchFailed() = 0; |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 OAuth2TokenFetcher(OAuth2TokenFetcher::Delegate* delegate, | 37 OAuth2TokenFetcher(OAuth2TokenFetcher::Delegate* delegate, |
| 38 net::URLRequestContextGetter* context_getter); | 38 net::URLRequestContextGetter* context_getter); |
| 39 ~OAuth2TokenFetcher() override; | 39 ~OAuth2TokenFetcher() override; |
| 40 | 40 |
| 41 void StartExchangeFromCookies(const std::string& session_index, | 41 void StartExchangeFromCookies(const std::string& session_index, |
| 42 const std::string& signin_scoped_device_id); | 42 const std::string& signin_scoped_device_id); |
| 43 void StartExchangeFromAuthCode(const std::string& auth_code); | 43 void StartExchangeFromAuthCode(const std::string& auth_code, |
| 44 const std::string& signin_scoped_device_id); |
| 44 | 45 |
| 45 private: | 46 private: |
| 46 // Decides how to proceed on GAIA |error|. If the error looks temporary, | 47 // Decides how to proceed on GAIA |error|. If the error looks temporary, |
| 47 // retries |task| until max retry count is reached. | 48 // retries |task| until max retry count is reached. |
| 48 // If retry count runs out, or error condition is unrecoverable, it runs | 49 // If retry count runs out, or error condition is unrecoverable, it runs |
| 49 // |error_handler|. | 50 // |error_handler|. |
| 50 void RetryOnError(const GoogleServiceAuthError& error, | 51 void RetryOnError(const GoogleServiceAuthError& error, |
| 51 const base::Closure& task, | 52 const base::Closure& task, |
| 52 const base::Closure& error_handler); | 53 const base::Closure& error_handler); |
| 53 | 54 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 65 std::string session_index_; | 66 std::string session_index_; |
| 66 std::string signin_scoped_device_id_; | 67 std::string signin_scoped_device_id_; |
| 67 std::string auth_code_; | 68 std::string auth_code_; |
| 68 | 69 |
| 69 DISALLOW_COPY_AND_ASSIGN(OAuth2TokenFetcher); | 70 DISALLOW_COPY_AND_ASSIGN(OAuth2TokenFetcher); |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 } // namespace chromeos | 73 } // namespace chromeos |
| 73 | 74 |
| 74 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_TOKEN_FETCHER_H_ | 75 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_TOKEN_FETCHER_H_ |
| OLD | NEW |