OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/login/login_performer.h" | 5 #include "chrome/browser/chromeos/login/login_performer.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 LoginPerformer* LoginPerformer::default_performer_ = NULL; | 47 LoginPerformer* LoginPerformer::default_performer_ = NULL; |
48 | 48 |
49 LoginPerformer::LoginPerformer(Delegate* delegate) | 49 LoginPerformer::LoginPerformer(Delegate* delegate) |
50 : last_login_failure_(LoginFailure::None()), | 50 : last_login_failure_(LoginFailure::None()), |
51 delegate_(delegate), | 51 delegate_(delegate), |
52 password_changed_(false), | 52 password_changed_(false), |
53 screen_lock_requested_(false), | 53 screen_lock_requested_(false), |
54 initial_online_auth_pending_(false), | 54 initial_online_auth_pending_(false), |
55 auth_mode_(AUTH_MODE_INTERNAL), | 55 auth_mode_(AUTH_MODE_INTERNAL), |
56 using_oauth_( | 56 using_oauth_( |
57 CommandLine::ForCurrentProcess()->HasSwitch( | |
58 switches::kWebUILogin) && | |
59 !CommandLine::ForCurrentProcess()->HasSwitch( | 57 !CommandLine::ForCurrentProcess()->HasSwitch( |
60 switches::kSkipOAuthLogin)), | 58 switches::kSkipOAuthLogin)), |
61 weak_factory_(this) { | 59 weak_factory_(this) { |
62 DCHECK(default_performer_ == NULL) | 60 DCHECK(default_performer_ == NULL) |
63 << "LoginPerformer should have only one instance."; | 61 << "LoginPerformer should have only one instance."; |
64 default_performer_ = this; | 62 default_performer_ = this; |
65 } | 63 } |
66 | 64 |
67 LoginPerformer::~LoginPerformer() { | 65 LoginPerformer::~LoginPerformer() { |
68 DVLOG(1) << "Deleting LoginPerformer"; | 66 DVLOG(1) << "Deleting LoginPerformer"; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 case STATUS_INITIALIZED: | 167 case STATUS_INITIALIZED: |
170 break; | 168 break; |
171 case STATUS_CREATED: | 169 case STATUS_CREATED: |
172 return; | 170 return; |
173 case STATUS_FAIL: | 171 case STATUS_FAIL: |
174 default: | 172 default: |
175 NOTREACHED(); | 173 NOTREACHED(); |
176 return; | 174 return; |
177 } | 175 } |
178 | 176 |
179 if (!using_oauth_) { | 177 if (using_oauth_) |
180 // Fetch cookies, tokens for the loaded profile only if authentication | |
181 // was performed via ClientLogin. We don't need this in the case when | |
182 // we use extension + OAuth1 access token check flow. | |
183 LoginUtils::Get()->FetchCookies(profile, credentials_); | |
184 } else { | |
185 LoginUtils::Get()->StartTokenServices(profile); | 178 LoginUtils::Get()->StartTokenServices(profile); |
186 } | 179 |
187 LoginUtils::Get()->StartSync(profile, credentials_); | 180 LoginUtils::Get()->StartSync(profile, credentials_); |
188 credentials_ = GaiaAuthConsumer::ClientLoginResult(); | 181 credentials_ = GaiaAuthConsumer::ClientLoginResult(); |
189 | 182 |
190 // Don't unlock screen if it was locked while we're waiting | 183 // Don't unlock screen if it was locked while we're waiting |
191 // for initial online auth. | 184 // for initial online auth. |
192 if (ScreenLocker::default_screen_locker() && | 185 if (ScreenLocker::default_screen_locker() && |
193 !initial_online_auth_pending_) { | 186 !initial_online_auth_pending_) { |
194 DVLOG(1) << "Online login OK - unlocking screen."; | 187 DVLOG(1) << "Online login OK - unlocking screen."; |
195 RequestScreenUnlock(); | 188 RequestScreenUnlock(); |
196 // Do not delete itself just yet, wait for unlock. | 189 // Do not delete itself just yet, wait for unlock. |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 // retry online auth, using existing Authenticator instance. | 562 // retry online auth, using existing Authenticator instance. |
570 BrowserThread::PostTask( | 563 BrowserThread::PostTask( |
571 BrowserThread::UI, FROM_HERE, | 564 BrowserThread::UI, FROM_HERE, |
572 base::Bind(&Authenticator::RetryAuth, authenticator_.get(), profile, | 565 base::Bind(&Authenticator::RetryAuth, authenticator_.get(), profile, |
573 username_, password_, captcha_token_, captcha_)); | 566 username_, password_, captcha_token_, captcha_)); |
574 } | 567 } |
575 password_.clear(); | 568 password_.clear(); |
576 } | 569 } |
577 | 570 |
578 } // namespace chromeos | 571 } // namespace chromeos |
OLD | NEW |