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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/oauth1_login_manager.h
diff --git a/chrome/browser/chromeos/login/oauth1_login_manager.h b/chrome/browser/chromeos/login/oauth1_login_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..9811deaa47503959ae7240a1109e5fc307802eec
--- /dev/null
+++ b/chrome/browser/chromeos/login/oauth1_login_manager.h
@@ -0,0 +1,80 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH1_LOGIN_MANAGER_H_
+#define CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH1_LOGIN_MANAGER_H_
+
+#include <string>
+
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/chromeos/login/oauth1_login_verifier.h"
+#include "chrome/browser/chromeos/login/oauth1_token_fetcher.h"
+#include "chrome/browser/chromeos/login/oauth_login_manager.h"
+#include "chrome/browser/chromeos/login/policy_oauth_fetcher.h"
+#include "net/url_request/url_request_context_getter.h"
+
+class Profile;
+
+namespace chromeos {
+
+// OAuth1 specialization of OAuthLoginManager.
+// TODO(zelidrag): Get rid of this one once we move everything to OAuth2.
+class OAuth1LoginManager : public OAuthLoginManager,
+ public OAuth1TokenFetcher::Delegate,
+ public OAuth1LoginVerifier::Delegate {
+ public:
+ explicit OAuth1LoginManager(OAuthLoginManager::Delegate* delegate);
+ virtual ~OAuth1LoginManager();
+ // OAuthLoginManager overrides.
+ virtual void RestorePolicyTokens(
+ net::URLRequestContextGetter* auth_request_context) OVERRIDE;
+ virtual void RestoreSession(
+ Profile* user_profile,
+ net::URLRequestContextGetter* auth_request_context,
+ bool restore_from_auth_cookies) OVERRIDE;
+ virtual void ContinueSessionRestore() OVERRIDE;
+ virtual void Stop() OVERRIDE;
+
+ private:
+ // OAuth1TokenFetcher::Delegate overrides.
+ virtual void OnOAuth1AccessTokenAvailable(const std::string& token,
+ const std::string& secret) OVERRIDE;
+ virtual void OnOAuth1AccessTokenFetchFailed() OVERRIDE;
+
+ // OAuth1LoginVerifier::Delegate overrides.
+ virtual void OnOAuth1VerificationSucceeded(const std::string& user_name,
+ const std::string& sid,
+ const std::string& lsid,
+ const std::string& auth) OVERRIDE;
+ virtual void OnOAuth1VerificationFailed(
+ const std::string& user_name) OVERRIDE;
+
+ // Reads OAuth1 token from user profile's prefs.
+ bool ReadOAuth1Tokens();
+
+ // Stores OAuth1 token + secret in profile's prefs.
+ void StoreOAuth1Tokens();
+
+ // Fetch user credentials (sid/lsid) from |oauth1_token_| and
+ // |oauth1_secret_|.
+ void FetchCredentialsWithOAuth1();
+
+ // Verifies OAuth1 token by performing OAuthLogin and fetching credentials.
+ void VerifyOAuth1AccessToken();
+
+ // Starts fetching device policy tokens.
+ void FetchPolicyTokens();
+
+ scoped_ptr<OAuth1TokenFetcher> oauth1_token_fetcher_;
+ scoped_ptr<OAuth1LoginVerifier> oauth1_login_verifier_;
+ scoped_ptr<PolicyOAuthFetcher> policy_oauth_fetcher_;
+ std::string oauth1_token_;
+ std::string oauth1_secret_;
+
+ DISALLOW_COPY_AND_ASSIGN(OAuth1LoginManager);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH1_LOGIN_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698