OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_utils.h" | 5 #include "chrome/browser/chromeos/login/login_utils.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 41 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
42 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 42 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
43 #include "chrome/browser/chromeos/login/profile_auth_data.h" | 43 #include "chrome/browser/chromeos/login/profile_auth_data.h" |
44 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.h" | 44 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.h" |
45 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_factory
.h" | 45 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_factory
.h" |
46 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 46 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
47 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" | 47 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" |
48 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" | 48 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" |
49 #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" | 49 #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" |
50 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 50 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 51 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
51 #include "chrome/browser/chromeos/login/user_flow.h" | 52 #include "chrome/browser/chromeos/login/user_flow.h" |
52 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 53 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
53 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 54 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
54 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 55 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
55 #include "chrome/browser/chromeos/settings/cros_settings.h" | 56 #include "chrome/browser/chromeos/settings/cros_settings.h" |
56 #include "chrome/browser/extensions/extension_service.h" | 57 #include "chrome/browser/extensions/extension_service.h" |
57 #include "chrome/browser/first_run/first_run.h" | 58 #include "chrome/browser/first_run/first_run.h" |
58 #include "chrome/browser/google/google_brand_chromeos.h" | 59 #include "chrome/browser/google/google_brand_chromeos.h" |
59 #include "chrome/browser/lifetime/application_lifetime.h" | 60 #include "chrome/browser/lifetime/application_lifetime.h" |
60 #include "chrome/browser/pref_service_flags_storage.h" | 61 #include "chrome/browser/pref_service_flags_storage.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 bool has_auth_cookies, | 194 bool has_auth_cookies, |
194 bool has_active_session, | 195 bool has_active_session, |
195 LoginUtils::Delegate* delegate) override; | 196 LoginUtils::Delegate* delegate) override; |
196 virtual void DelegateDeleted(LoginUtils::Delegate* delegate) override; | 197 virtual void DelegateDeleted(LoginUtils::Delegate* delegate) override; |
197 virtual scoped_refptr<Authenticator> CreateAuthenticator( | 198 virtual scoped_refptr<Authenticator> CreateAuthenticator( |
198 AuthStatusConsumer* consumer) override; | 199 AuthStatusConsumer* consumer) override; |
199 virtual bool RestartToApplyPerSessionFlagsIfNeed(Profile* profile, | 200 virtual bool RestartToApplyPerSessionFlagsIfNeed(Profile* profile, |
200 bool early_restart) override; | 201 bool early_restart) override; |
201 | 202 |
202 // UserSessionManager::Delegate implementation: | 203 // UserSessionManager::Delegate implementation: |
203 virtual void OnProfilePrepared(Profile* profile) override; | 204 virtual void OnProfilePrepared(Profile* profile, |
| 205 bool browser_launched) override; |
204 #if defined(ENABLE_RLZ) | 206 #if defined(ENABLE_RLZ) |
205 virtual void OnRlzInitialized() override; | 207 virtual void OnRlzInitialized() override; |
206 #endif | 208 #endif |
207 | 209 |
208 private: | 210 private: |
209 void DoBrowserLaunchInternal(Profile* profile, | 211 void DoBrowserLaunchInternal(Profile* profile, |
210 LoginDisplayHost* login_host, | 212 LoginDisplayHost* login_host, |
211 bool locale_pref_checked); | 213 bool locale_pref_checked); |
212 | 214 |
213 // Switch to the locale that |profile| wishes to use and invoke |callback|. | 215 // Switch to the locale that |profile| wishes to use and invoke |callback|. |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 | 366 |
365 void LoginUtilsImpl::PrepareProfile( | 367 void LoginUtilsImpl::PrepareProfile( |
366 const UserContext& user_context, | 368 const UserContext& user_context, |
367 bool has_auth_cookies, | 369 bool has_auth_cookies, |
368 bool has_active_session, | 370 bool has_active_session, |
369 LoginUtils::Delegate* delegate) { | 371 LoginUtils::Delegate* delegate) { |
370 // TODO(nkostylev): We have to initialize LoginUtils delegate as long | 372 // TODO(nkostylev): We have to initialize LoginUtils delegate as long |
371 // as it coexist with SessionManager. | 373 // as it coexist with SessionManager. |
372 delegate_ = delegate; | 374 delegate_ = delegate; |
373 | 375 |
| 376 UserSessionManager::StartSessionType start_session_type = |
| 377 UserAddingScreen::Get()->IsRunning() ? |
| 378 UserSessionManager::SECONDARY_USER_SESSION : |
| 379 UserSessionManager::PRIMARY_USER_SESSION; |
| 380 |
374 // For the transition part LoginUtils will just delegate profile | 381 // For the transition part LoginUtils will just delegate profile |
375 // creation and initialization to SessionManager. Later LoginUtils will be | 382 // creation and initialization to SessionManager. Later LoginUtils will be |
376 // removed and all LoginUtils clients will just work with SessionManager | 383 // removed and all LoginUtils clients will just work with SessionManager |
377 // directly. | 384 // directly. |
378 UserSessionManager::GetInstance()->StartSession( | 385 UserSessionManager::GetInstance()->StartSession(user_context, |
379 user_context, authenticator_, has_auth_cookies, has_active_session, this); | 386 start_session_type, |
| 387 authenticator_, |
| 388 has_auth_cookies, |
| 389 has_active_session, |
| 390 this); |
380 } | 391 } |
381 | 392 |
382 void LoginUtilsImpl::DelegateDeleted(LoginUtils::Delegate* delegate) { | 393 void LoginUtilsImpl::DelegateDeleted(LoginUtils::Delegate* delegate) { |
383 if (delegate_ == delegate) | 394 if (delegate_ == delegate) |
384 delegate_ = NULL; | 395 delegate_ = NULL; |
385 } | 396 } |
386 | 397 |
387 bool LoginUtilsImpl::RestartToApplyPerSessionFlagsIfNeed(Profile* profile, | 398 bool LoginUtilsImpl::RestartToApplyPerSessionFlagsIfNeed(Profile* profile, |
388 bool early_restart) { | 399 bool early_restart) { |
389 if (ProfileHelper::IsSigninProfile(profile)) | 400 if (ProfileHelper::IsSigninProfile(profile)) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 | 433 |
423 if (authenticator_.get() == NULL) { | 434 if (authenticator_.get() == NULL) { |
424 authenticator_ = new ChromeCryptohomeAuthenticator(consumer); | 435 authenticator_ = new ChromeCryptohomeAuthenticator(consumer); |
425 } else { | 436 } else { |
426 // TODO(nkostylev): Fix this hack by improving Authenticator dependencies. | 437 // TODO(nkostylev): Fix this hack by improving Authenticator dependencies. |
427 authenticator_->SetConsumer(consumer); | 438 authenticator_->SetConsumer(consumer); |
428 } | 439 } |
429 return authenticator_; | 440 return authenticator_; |
430 } | 441 } |
431 | 442 |
432 void LoginUtilsImpl::OnProfilePrepared(Profile* profile) { | 443 void LoginUtilsImpl::OnProfilePrepared(Profile* profile, |
| 444 bool browser_launched) { |
433 if (delegate_) | 445 if (delegate_) |
434 delegate_->OnProfilePrepared(profile); | 446 delegate_->OnProfilePrepared(profile, browser_launched); |
435 } | 447 } |
436 | 448 |
437 #if defined(ENABLE_RLZ) | 449 #if defined(ENABLE_RLZ) |
438 void LoginUtilsImpl::OnRlzInitialized() { | 450 void LoginUtilsImpl::OnRlzInitialized() { |
439 if (delegate_) | 451 if (delegate_) |
440 delegate_->OnRlzInitialized(); | 452 delegate_->OnRlzInitialized(); |
441 } | 453 } |
442 #endif | 454 #endif |
443 | 455 |
444 void LoginUtilsImpl::AttemptRestart(Profile* profile) { | 456 void LoginUtilsImpl::AttemptRestart(Profile* profile) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 CrosSettings* cros_settings = CrosSettings::Get(); | 506 CrosSettings* cros_settings = CrosSettings::Get(); |
495 bool allow_new_user = false; | 507 bool allow_new_user = false; |
496 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 508 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
497 if (allow_new_user) | 509 if (allow_new_user) |
498 return true; | 510 return true; |
499 return cros_settings->FindEmailInList( | 511 return cros_settings->FindEmailInList( |
500 kAccountsPrefUsers, username, wildcard_match); | 512 kAccountsPrefUsers, username, wildcard_match); |
501 } | 513 } |
502 | 514 |
503 } // namespace chromeos | 515 } // namespace chromeos |
OLD | NEW |