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

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

Issue 11649055: OAuth2 sign-in flow for ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clang fix 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH1_LOGIN_MANAGER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH1_LOGIN_MANAGER_H_
7
8 #include <string>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/chromeos/login/oauth1_login_verifier.h"
12 #include "chrome/browser/chromeos/login/oauth1_token_fetcher.h"
13 #include "chrome/browser/chromeos/login/oauth_login_manager.h"
14 #include "chrome/browser/chromeos/login/policy_oauth_fetcher.h"
15 #include "net/url_request/url_request_context_getter.h"
16
17 class Profile;
18
19 namespace chromeos {
20
21 // OAuth1 specialization of OAuthLoginManager.
22 // TODO(zelidrag): Get rid of this one once we move everything to OAuth2.
23 class OAuth1LoginManager : public OAuthLoginManager,
24 public OAuth1TokenFetcher::Delegate,
25 public OAuth1LoginVerifier::Delegate {
26 public:
27 explicit OAuth1LoginManager(OAuthLoginManager::Delegate* delegate);
28 virtual ~OAuth1LoginManager();
29 // OAuthLoginManager overrides.
30 virtual void RestorePolicyTokens(
31 net::URLRequestContextGetter* auth_request_context) OVERRIDE;
32 virtual void RestoreSession(
33 Profile* user_profile,
34 net::URLRequestContextGetter* auth_request_context,
35 bool restore_from_auth_cookies) OVERRIDE;
36 virtual void ContinueSessionRestore() OVERRIDE;
37 virtual void Stop() OVERRIDE;
38
39 private:
40 // OAuth1TokenFetcher::Delegate overrides.
41 virtual void OnOAuth1AccessTokenAvailable(const std::string& token,
42 const std::string& secret) OVERRIDE;
43 virtual void OnOAuth1AccessTokenFetchFailed() OVERRIDE;
44
45 // OAuth1LoginVerifier::Delegate overrides.
46 virtual void OnOAuth1VerificationSucceeded(const std::string& user_name,
47 const std::string& sid,
48 const std::string& lsid,
49 const std::string& auth) OVERRIDE;
50 virtual void OnOAuth1VerificationFailed(
51 const std::string& user_name) OVERRIDE;
52
53 // Reads OAuth1 token from user profile's prefs.
54 bool ReadOAuth1Tokens();
55
56 // Stores OAuth1 token + secret in profile's prefs.
57 void StoreOAuth1Tokens();
58
59 // Fetch user credentials (sid/lsid) from |oauth1_token_| and
60 // |oauth1_secret_|.
61 void FetchCredentialsWithOAuth1();
62
63 // Verifies OAuth1 token by performing OAuthLogin and fetching credentials.
64 void VerifyOAuth1AccessToken();
65
66 // Starts fetching device policy tokens.
67 void FetchPolicyTokens();
68
69 scoped_ptr<OAuth1TokenFetcher> oauth1_token_fetcher_;
70 scoped_ptr<OAuth1LoginVerifier> oauth1_login_verifier_;
71 scoped_ptr<PolicyOAuthFetcher> policy_oauth_fetcher_;
72 std::string oauth1_token_;
73 std::string oauth1_secret_;
74
75 DISALLOW_COPY_AND_ASSIGN(OAuth1LoginManager);
76 };
77
78 } // namespace chromeos
79
80 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH1_LOGIN_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698