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

Unified Diff: chrome/browser/chromeos/login/oauth_login_manager.cc

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/oauth_login_manager.cc
diff --git a/chrome/browser/chromeos/login/oauth_login_manager.cc b/chrome/browser/chromeos/login/oauth_login_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..eddafe40814c0d3a3a242e6306c7928a947e464f
--- /dev/null
+++ b/chrome/browser/chromeos/login/oauth_login_manager.cc
@@ -0,0 +1,48 @@
+// 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.
+
+#include "chrome/browser/chromeos/login/oauth_login_manager.h"
+
+#include "base/command_line.h"
+#include "chrome/browser/chromeos/login/oauth1_login_manager.h"
+#include "chrome/browser/chromeos/login/oauth2_login_manager.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/signin/token_service.h"
+#include "chrome/browser/signin/token_service_factory.h"
+#include "chrome/common/chrome_switches.h"
+
+using content::BrowserThread;
+
+namespace chromeos {
+
+// OAuthLoginManager.
+
+// static.
+OAuthLoginManager* OAuthLoginManager::Create(
+ OAuthLoginManager::Delegate* delegate) {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(::switches::kForceOAuth1))
+ return new OAuth1LoginManager(delegate);
+
+ return new OAuth2LoginManager(delegate);
+}
+
+void OAuthLoginManager::CompleteAuthentication() {
+ delegate_->OnCompletedAuthentication(user_profile_);
+ TokenService* token_service =
+ TokenServiceFactory::GetForProfile(user_profile_);
+ if (token_service->AreCredentialsValid())
+ token_service->StartFetchingTokens();
+}
+
+OAuthLoginManager::OAuthLoginManager(Delegate* delegate)
+ : delegate_(delegate),
+ user_profile_(NULL),
+ restore_from_auth_cookies_(false),
+ state_(SESSION_RESTORE_NOT_STARTED) {
+}
+
+OAuthLoginManager::~OAuthLoginManager() {
+}
+
+} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698