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

Side by Side 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 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 #include "chrome/browser/chromeos/login/oauth_login_manager.h"
6
7 #include "base/command_line.h"
8 #include "chrome/browser/chromeos/login/oauth1_login_manager.h"
9 #include "chrome/browser/chromeos/login/oauth2_login_manager.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/signin/token_service.h"
12 #include "chrome/browser/signin/token_service_factory.h"
13 #include "chrome/common/chrome_switches.h"
14
15 using content::BrowserThread;
16
17 namespace chromeos {
18
19 // OAuthLoginManager.
20
21 // static.
22 OAuthLoginManager* OAuthLoginManager::Create(
23 OAuthLoginManager::Delegate* delegate) {
24 if (CommandLine::ForCurrentProcess()->HasSwitch(::switches::kForceOAuth1))
25 return new OAuth1LoginManager(delegate);
26
27 return new OAuth2LoginManager(delegate);
28 }
29
30 void OAuthLoginManager::CompleteAuthentication() {
31 delegate_->OnCompletedAuthentication(user_profile_);
32 TokenService* token_service =
33 TokenServiceFactory::GetForProfile(user_profile_);
34 if (token_service->AreCredentialsValid())
35 token_service->StartFetchingTokens();
36 }
37
38 OAuthLoginManager::OAuthLoginManager(Delegate* delegate)
39 : delegate_(delegate),
40 user_profile_(NULL),
41 restore_from_auth_cookies_(false),
42 state_(SESSION_RESTORE_NOT_STARTED) {
43 }
44
45 OAuthLoginManager::~OAuthLoginManager() {
46 }
47
48 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698