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

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

Issue 11649055: OAuth2 sign-in flow for ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_OAUTH_LOGIN_VERIFIER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH1_LOGIN_VERIFIER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH_LOGIN_VERIFIER_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH1_LOGIN_VERIFIER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/net/gaia/gaia_oauth_consumer.h" 13 #include "chrome/browser/net/gaia/gaia_oauth_consumer.h"
14 #include "chrome/browser/net/gaia/gaia_oauth_fetcher.h" 14 #include "chrome/browser/net/gaia/gaia_oauth_fetcher.h"
15 #include "google_apis/gaia/gaia_auth_consumer.h" 15 #include "google_apis/gaia/gaia_auth_consumer.h"
16 #include "google_apis/gaia/gaia_auth_fetcher.h" 16 #include "google_apis/gaia/gaia_auth_fetcher.h"
17 17
18 class Profile; 18 class Profile;
19 19
20 namespace chromeos { 20 namespace chromeos {
21 21
22 // Verifies OAuth1 access token by performing OAuthLogin. Fetches user cookies 22 // Verifies OAuth1 access token by performing OAuthLogin. Fetches user cookies
23 // on successful OAuth authentication. 23 // on successful OAuth authentication.
24 class OAuthLoginVerifier : public base::SupportsWeakPtr<OAuthLoginVerifier>, 24 class OAuth1LoginVerifier : public base::SupportsWeakPtr<OAuth1LoginVerifier>,
25 public GaiaOAuthConsumer, 25 public GaiaOAuthConsumer,
26 public GaiaAuthConsumer { 26 public GaiaAuthConsumer {
27 public: 27 public:
28 class Delegate { 28 class Delegate {
29 public: 29 public:
30 virtual ~Delegate() {} 30 virtual ~Delegate() {}
31 virtual void OnOAuthVerificationSucceeded(const std::string& user_name, 31 virtual void OnOAuth1VerificationSucceeded(const std::string& user_name,
32 const std::string& sid, 32 const std::string& sid,
33 const std::string& lsid, 33 const std::string& lsid,
34 const std::string& auth) {} 34 const std::string& auth) {}
35 virtual void OnOAuthVerificationFailed(const std::string& user_name) {} 35 virtual void OnOAuth1VerificationFailed(const std::string& user_name) {}
36 virtual void OnUserCookiesFetchSucceeded(const std::string& user_name) {} 36 virtual void OnCookiesFetchWithOAuth1Succeeded(
37 virtual void OnUserCookiesFetchFailed(const std::string& user_name) {} 37 const std::string& user_name) {}
38 virtual void OnCookiesFetchWithOAuth1Failed(const std::string& user_name) {}
38 }; 39 };
39 40
40 OAuthLoginVerifier(OAuthLoginVerifier::Delegate* delegate, 41 OAuth1LoginVerifier(OAuth1LoginVerifier::Delegate* delegate,
41 Profile* user_profile, 42 Profile* user_profile,
42 const std::string& oauth1_token, 43 const std::string& oauth1_token,
43 const std::string& oauth1_secret, 44 const std::string& oauth1_secret,
44 const std::string& username); 45 const std::string& username);
45 virtual ~OAuthLoginVerifier(); 46 virtual ~OAuth1LoginVerifier();
46 47
47 bool is_done() { 48 bool is_done() {
48 return step_ == VERIFICATION_STEP_FAILED || 49 return step_ == VERIFICATION_STEP_FAILED ||
49 step_ == VERIFICATION_STEP_COOKIES_FETCHED; 50 step_ == VERIFICATION_STEP_COOKIES_FETCHED;
50 } 51 }
51 52
52 void StartOAuthVerification(); 53 void StartOAuthVerification();
53 void ContinueVerification(); 54 void ContinueVerification();
54 55
55 private: 56 private:
(...skipping 23 matching lines...) Expand all
79 // GaiaAuthConsumer overrides. 80 // GaiaAuthConsumer overrides.
80 virtual void OnIssueAuthTokenSuccess(const std::string& service, 81 virtual void OnIssueAuthTokenSuccess(const std::string& service,
81 const std::string& auth_token) OVERRIDE; 82 const std::string& auth_token) OVERRIDE;
82 virtual void OnIssueAuthTokenFailure( 83 virtual void OnIssueAuthTokenFailure(
83 const std::string& service, 84 const std::string& service,
84 const GoogleServiceAuthError& error) OVERRIDE; 85 const GoogleServiceAuthError& error) OVERRIDE;
85 virtual void OnMergeSessionSuccess(const std::string& data) OVERRIDE; 86 virtual void OnMergeSessionSuccess(const std::string& data) OVERRIDE;
86 virtual void OnMergeSessionFailure( 87 virtual void OnMergeSessionFailure(
87 const GoogleServiceAuthError& error) OVERRIDE; 88 const GoogleServiceAuthError& error) OVERRIDE;
88 89
89 OAuthLoginVerifier::Delegate* delegate_; 90 OAuth1LoginVerifier::Delegate* delegate_;
90 GaiaOAuthFetcher oauth_fetcher_; 91 GaiaOAuthFetcher oauth_fetcher_;
91 GaiaAuthFetcher gaia_fetcher_; 92 GaiaAuthFetcher gaia_fetcher_;
92 std::string oauth1_token_; 93 std::string oauth1_token_;
93 std::string oauth1_secret_; 94 std::string oauth1_secret_;
94 std::string sid_; 95 std::string sid_;
95 std::string lsid_; 96 std::string lsid_;
96 std::string username_; 97 std::string username_;
97 Profile* user_profile_; 98 Profile* user_profile_;
98 int verification_count_; 99 int verification_count_;
99 VerificationStep step_; 100 VerificationStep step_;
100 101
101 DISALLOW_COPY_AND_ASSIGN(OAuthLoginVerifier); 102 DISALLOW_COPY_AND_ASSIGN(OAuth1LoginVerifier);
102 }; 103 };
103 104
104 } // namespace chromeos 105 } // namespace chromeos
105 106
106 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH_LOGIN_VERIFIER_H_ 107 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH1_LOGIN_VERIFIER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698