| 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/existing_user_controller.h" | 5 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/chromeos/boot_times_loader.h" | 12 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 13 #include "chrome/browser/chromeos/cros/cros_library.h" | 13 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 14 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | 14 #include "chrome/browser/chromeos/cros/cryptohome_library.h" |
| 15 #include "chrome/browser/chromeos/cros/login_library.h" | 15 #include "chrome/browser/chromeos/cros/login_library.h" |
| 16 #include "chrome/browser/chromeos/cros/network_library.h" | 16 #include "chrome/browser/chromeos/cros/network_library.h" |
| 17 #include "chrome/browser/chromeos/customization_document.h" |
| 17 #include "chrome/browser/chromeos/login/helper.h" | 18 #include "chrome/browser/chromeos/login/helper.h" |
| 18 #include "chrome/browser/chromeos/login/login_display_host.h" | 19 #include "chrome/browser/chromeos/login/login_display_host.h" |
| 19 #include "chrome/browser/chromeos/login/views_login_display.h" | 20 #include "chrome/browser/chromeos/login/views_login_display.h" |
| 20 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" | 21 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" |
| 21 #include "chrome/browser/chromeos/login/wizard_controller.h" | 22 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 22 #include "chrome/browser/chromeos/status/status_area_view.h" | 23 #include "chrome/browser/chromeos/status/status_area_view.h" |
| 23 #include "chrome/browser/chromeos/user_cros_settings_provider.h" | 24 #include "chrome/browser/chromeos/user_cros_settings_provider.h" |
| 24 #include "chrome/browser/google/google_util.h" | 25 #include "chrome/browser/google/google_util.h" |
| 25 #include "chrome/browser/prefs/pref_service.h" | 26 #include "chrome/browser/prefs/pref_service.h" |
| 26 #include "chrome/browser/profiles/profile_manager.h" | 27 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 if (command_line->HasSwitch(switches::kEnableDevicePolicy)) { | 222 if (command_line->HasSwitch(switches::kEnableDevicePolicy)) { |
| 222 ownership_checker_.reset(new OwnershipStatusChecker(NewCallback( | 223 ownership_checker_.reset(new OwnershipStatusChecker(NewCallback( |
| 223 this, &ExistingUserController::OnEnrollmentOwnershipCheckCompleted))); | 224 this, &ExistingUserController::OnEnrollmentOwnershipCheckCompleted))); |
| 224 } | 225 } |
| 225 } | 226 } |
| 226 | 227 |
| 227 void ExistingUserController::OnEnrollmentOwnershipCheckCompleted( | 228 void ExistingUserController::OnEnrollmentOwnershipCheckCompleted( |
| 228 OwnershipService::Status status) { | 229 OwnershipService::Status status) { |
| 229 if (status == OwnershipService::OWNERSHIP_NONE) { | 230 if (status == OwnershipService::OWNERSHIP_NONE) { |
| 230 host_->StartWizard(WizardController::kEnterpriseEnrollmentScreenName, | 231 host_->StartWizard(WizardController::kEnterpriseEnrollmentScreenName, |
| 231 NULL, GURL()); | 232 GURL()); |
| 232 login_display_->OnFadeOut(); | 233 login_display_->OnFadeOut(); |
| 233 } | 234 } |
| 234 ownership_checker_.reset(); | 235 ownership_checker_.reset(); |
| 235 } | 236 } |
| 236 | 237 |
| 237 //////////////////////////////////////////////////////////////////////////////// | 238 //////////////////////////////////////////////////////////////////////////////// |
| 238 // ExistingUserController, LoginPerformer::Delegate implementation: | 239 // ExistingUserController, LoginPerformer::Delegate implementation: |
| 239 // | 240 // |
| 240 | 241 |
| 241 void ExistingUserController::OnLoginFailure(const LoginFailure& failure) { | 242 void ExistingUserController::OnLoginFailure(const LoginFailure& failure) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 330 |
| 330 } | 331 } |
| 331 | 332 |
| 332 void ExistingUserController::OnProfilePrepared(Profile* profile) { | 333 void ExistingUserController::OnProfilePrepared(Profile* profile) { |
| 333 // TODO(nkostylev): May add login UI implementation callback call. | 334 // TODO(nkostylev): May add login UI implementation callback call. |
| 334 if (!ready_for_browser_launch_) { | 335 if (!ready_for_browser_launch_) { |
| 335 #if defined(OFFICIAL_BUILD) | 336 #if defined(OFFICIAL_BUILD) |
| 336 CommandLine::ForCurrentProcess()->AppendArg(kGetStartedURL); | 337 CommandLine::ForCurrentProcess()->AppendArg(kGetStartedURL); |
| 337 #endif // OFFICIAL_BUILD | 338 #endif // OFFICIAL_BUILD |
| 338 | 339 |
| 339 if (!initial_start_page_.empty()) { | 340 ServicesCustomizationDocument* customization = |
| 340 // If initial_start_page is not empty, add it as second tab. | 341 ServicesCustomizationDocument::GetInstance(); |
| 341 // The tabs are opened in the same order as arguments in command line. | 342 if (customization->IsReady()) { |
| 342 CommandLine::ForCurrentProcess()->AppendArg(initial_start_page_); | 343 std::string locale = g_browser_process->GetApplicationLocale(); |
| 344 std::string initial_start_page = |
| 345 customization->GetInitialStartPage(locale); |
| 346 if (!initial_start_page.empty()) |
| 347 CommandLine::ForCurrentProcess()->AppendArg(initial_start_page); |
| 348 customization->ApplyCustomization(); |
| 343 } | 349 } |
| 344 | 350 |
| 345 if (two_factor_credentials_) { | 351 if (two_factor_credentials_) { |
| 346 // If we have a two factor error and and this is a new user, | 352 // If we have a two factor error and and this is a new user, |
| 347 // load the personal settings page. | 353 // load the personal settings page. |
| 348 // TODO(stevenjb): direct the user to a lightweight sync login page. | 354 // TODO(stevenjb): direct the user to a lightweight sync login page. |
| 349 CommandLine::ForCurrentProcess()->AppendArg(kSettingsSyncLoginURL); | 355 CommandLine::ForCurrentProcess()->AppendArg(kSettingsSyncLoginURL); |
| 350 } | 356 } |
| 351 | 357 |
| 352 ActivateWizard(WizardController::IsDeviceRegistered() ? | 358 ActivateWizard(WizardController::IsDeviceRegistered() ? |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 login_performer_->ResyncEncryptedData(); | 432 login_performer_->ResyncEncryptedData(); |
| 427 } | 433 } |
| 428 | 434 |
| 429 //////////////////////////////////////////////////////////////////////////////// | 435 //////////////////////////////////////////////////////////////////////////////// |
| 430 // ExistingUserController, private: | 436 // ExistingUserController, private: |
| 431 | 437 |
| 432 void ExistingUserController::ActivateWizard(const std::string& screen_name) { | 438 void ExistingUserController::ActivateWizard(const std::string& screen_name) { |
| 433 GURL start_url; | 439 GURL start_url; |
| 434 if (chromeos::UserManager::Get()->IsLoggedInAsGuest()) | 440 if (chromeos::UserManager::Get()->IsLoggedInAsGuest()) |
| 435 start_url = guest_mode_url_; | 441 start_url = guest_mode_url_; |
| 436 host_->StartWizard(screen_name, NULL, start_url); | 442 host_->StartWizard(screen_name, start_url); |
| 437 login_display_->OnFadeOut(); | 443 login_display_->OnFadeOut(); |
| 438 } | 444 } |
| 439 | 445 |
| 440 gfx::NativeWindow ExistingUserController::GetNativeWindow() const { | 446 gfx::NativeWindow ExistingUserController::GetNativeWindow() const { |
| 441 return host_->GetNativeWindow(); | 447 return host_->GetNativeWindow(); |
| 442 } | 448 } |
| 443 | 449 |
| 444 void ExistingUserController::SetStatusAreaEnabled(bool enable) { | 450 void ExistingUserController::SetStatusAreaEnabled(bool enable) { |
| 445 host_->SetStatusAreaEnabled(enable); | 451 host_->SetStatusAreaEnabled(enable); |
| 446 } | 452 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 467 help_topic_id = login_performer_->login_timed_out() ? | 473 help_topic_id = login_performer_->login_timed_out() ? |
| 468 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT_OFFLINE : | 474 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT_OFFLINE : |
| 469 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT; | 475 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT; |
| 470 break; | 476 break; |
| 471 } | 477 } |
| 472 | 478 |
| 473 login_display_->ShowError(error_id, num_login_attempts_, help_topic_id); | 479 login_display_->ShowError(error_id, num_login_attempts_, help_topic_id); |
| 474 } | 480 } |
| 475 | 481 |
| 476 } // namespace chromeos | 482 } // namespace chromeos |
| OLD | NEW |