| OLD | NEW |
| (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 |
| OLD | NEW |