Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(425)

Side by Side Diff: chrome/browser/chromeos/login/oauth2_token_fetcher.h

Issue 256623002: Implemented inline login dialog for Chrome OS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_OAUTH2_TOKEN_FETCHER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH2_TOKEN_FETCHER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH2_TOKEN_FETCHER_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_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 20 matching lines...) Expand all
31 virtual ~Delegate() {} 31 virtual ~Delegate() {}
32 virtual void OnOAuth2TokensAvailable( 32 virtual void OnOAuth2TokensAvailable(
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 virtual ~OAuth2TokenFetcher(); 39 virtual ~OAuth2TokenFetcher();
40 40
41 void StartExchangeFromCookies(); 41 void StartExchangeFromCookies(const std::string& session_index);
42 void StartExchangeFromAuthCode(const std::string& auth_code); 42 void StartExchangeFromAuthCode(const std::string& auth_code);
43 43
44 private: 44 private:
45 // Decides how to proceed on GAIA |error|. If the error looks temporary, 45 // Decides how to proceed on GAIA |error|. If the error looks temporary,
46 // retries |task| until max retry count is reached. 46 // retries |task| until max retry count is reached.
47 // If retry count runs out, or error condition is unrecoverable, it runs 47 // If retry count runs out, or error condition is unrecoverable, it runs
48 // |error_handler|. 48 // |error_handler|.
49 void RetryOnError(const GoogleServiceAuthError& error, 49 void RetryOnError(const GoogleServiceAuthError& error,
50 const base::Closure& task, 50 const base::Closure& task,
51 const base::Closure& error_handler); 51 const base::Closure& error_handler);
52 52
53 // GaiaAuthConsumer overrides. 53 // GaiaAuthConsumer overrides.
54 virtual void OnClientOAuthSuccess( 54 virtual void OnClientOAuthSuccess(
55 const GaiaAuthConsumer::ClientOAuthResult& result) OVERRIDE; 55 const GaiaAuthConsumer::ClientOAuthResult& result) OVERRIDE;
56 virtual void OnClientOAuthFailure( 56 virtual void OnClientOAuthFailure(
57 const GoogleServiceAuthError& error) OVERRIDE; 57 const GoogleServiceAuthError& error) OVERRIDE;
58 58
59 OAuth2TokenFetcher::Delegate* delegate_; 59 OAuth2TokenFetcher::Delegate* delegate_;
60 GaiaAuthConsumer::ClientOAuthResult oauth_tokens_; 60 GaiaAuthConsumer::ClientOAuthResult oauth_tokens_;
61 GaiaAuthFetcher auth_fetcher_; 61 GaiaAuthFetcher auth_fetcher_;
62 62
63 // The retry counter. Increment this only when failure happened. 63 // The retry counter. Increment this only when failure happened.
64 int retry_count_; 64 int retry_count_;
65 std::string session_index_;
65 std::string auth_code_; 66 std::string auth_code_;
66 67
67 DISALLOW_COPY_AND_ASSIGN(OAuth2TokenFetcher); 68 DISALLOW_COPY_AND_ASSIGN(OAuth2TokenFetcher);
68 }; 69 };
69 70
70 } // namespace chromeos 71 } // namespace chromeos
71 72
72 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH2_TOKEN_FETCHER_H_ 73 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH2_TOKEN_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698