| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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/chrome_browser_main_chromeos.h" | 5 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 #include "chromeos/cryptohome/async_method_caller.h" | 89 #include "chromeos/cryptohome/async_method_caller.h" |
| 90 #include "chromeos/cryptohome/homedir_methods.h" | 90 #include "chromeos/cryptohome/homedir_methods.h" |
| 91 #include "chromeos/cryptohome/system_salt_getter.h" | 91 #include "chromeos/cryptohome/system_salt_getter.h" |
| 92 #include "chromeos/dbus/dbus_thread_manager.h" | 92 #include "chromeos/dbus/dbus_thread_manager.h" |
| 93 #include "chromeos/dbus/power_policy_controller.h" | 93 #include "chromeos/dbus/power_policy_controller.h" |
| 94 #include "chromeos/dbus/session_manager_client.h" | 94 #include "chromeos/dbus/session_manager_client.h" |
| 95 #include "chromeos/disks/disk_mount_manager.h" | 95 #include "chromeos/disks/disk_mount_manager.h" |
| 96 #include "chromeos/ime/ime_keyboard.h" | 96 #include "chromeos/ime/ime_keyboard.h" |
| 97 #include "chromeos/ime/input_method_manager.h" | 97 #include "chromeos/ime/input_method_manager.h" |
| 98 #include "chromeos/login/login_state.h" | 98 #include "chromeos/login/login_state.h" |
| 99 #include "chromeos/login/user_names.h" |
| 99 #include "chromeos/network/network_change_notifier_chromeos.h" | 100 #include "chromeos/network/network_change_notifier_chromeos.h" |
| 100 #include "chromeos/network/network_change_notifier_factory_chromeos.h" | 101 #include "chromeos/network/network_change_notifier_factory_chromeos.h" |
| 101 #include "chromeos/network/network_handler.h" | 102 #include "chromeos/network/network_handler.h" |
| 102 #include "chromeos/system/statistics_provider.h" | 103 #include "chromeos/system/statistics_provider.h" |
| 103 #include "chromeos/tpm_token_loader.h" | 104 #include "chromeos/tpm_token_loader.h" |
| 104 #include "components/metrics/metrics_service.h" | 105 #include "components/metrics/metrics_service.h" |
| 105 #include "content/public/browser/browser_thread.h" | 106 #include "content/public/browser/browser_thread.h" |
| 106 #include "content/public/browser/notification_service.h" | 107 #include "content/public/browser/notification_service.h" |
| 107 #include "content/public/browser/power_save_blocker.h" | 108 #include "content/public/browser/power_save_blocker.h" |
| 108 #include "content/public/common/main_function_params.h" | 109 #include "content/public/common/main_function_params.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 VLOG(1) << "Kiosk app auto launch >> login-prompt-visible"; | 147 VLOG(1) << "Kiosk app auto launch >> login-prompt-visible"; |
| 147 DBusThreadManager::Get()->GetSessionManagerClient()-> | 148 DBusThreadManager::Get()->GetSessionManagerClient()-> |
| 148 EmitLoginPromptVisible(); | 149 EmitLoginPromptVisible(); |
| 149 } | 150 } |
| 150 | 151 |
| 151 void OptionallyRunChromeOSLoginManager(const CommandLine& parsed_command_line, | 152 void OptionallyRunChromeOSLoginManager(const CommandLine& parsed_command_line, |
| 152 Profile* profile) { | 153 Profile* profile) { |
| 153 std::string login_user = parsed_command_line. | 154 std::string login_user = parsed_command_line. |
| 154 GetSwitchValueASCII(chromeos::switches::kLoginUser); | 155 GetSwitchValueASCII(chromeos::switches::kLoginUser); |
| 155 if (!base::SysInfo::IsRunningOnChromeOS() && | 156 if (!base::SysInfo::IsRunningOnChromeOS() && |
| 156 login_user == UserManager::kStubUser) { | 157 login_user == chromeos::login::kStubUser) { |
| 157 return; | 158 return; |
| 158 } | 159 } |
| 159 | 160 |
| 160 if (ShouldAutoLaunchKioskApp(parsed_command_line)) { | 161 if (ShouldAutoLaunchKioskApp(parsed_command_line)) { |
| 161 RunAutoLaunchKioskApp(); | 162 RunAutoLaunchKioskApp(); |
| 162 } else if (parsed_command_line.HasSwitch(switches::kLoginManager)) { | 163 } else if (parsed_command_line.HasSwitch(switches::kLoginManager)) { |
| 163 ShowLoginWizard(std::string()); | 164 ShowLoginWizard(std::string()); |
| 164 | 165 |
| 165 if (KioskModeSettings::Get()->IsKioskModeEnabled()) | 166 if (KioskModeSettings::Get()->IsKioskModeEnabled()) |
| 166 InitializeKioskModeScreensaver(); | 167 InitializeKioskModeScreensaver(); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 browser_defaults::bookmarks_enabled = false; | 305 browser_defaults::bookmarks_enabled = false; |
| 305 } | 306 } |
| 306 | 307 |
| 307 // If we're not running on real Chrome OS hardware (or under VM), and are not | 308 // If we're not running on real Chrome OS hardware (or under VM), and are not |
| 308 // showing the login manager or attempting a command line login, login with a | 309 // showing the login manager or attempting a command line login, login with a |
| 309 // stub user. | 310 // stub user. |
| 310 if (!base::SysInfo::IsRunningOnChromeOS() && | 311 if (!base::SysInfo::IsRunningOnChromeOS() && |
| 311 !parsed_command_line().HasSwitch(switches::kLoginManager) && | 312 !parsed_command_line().HasSwitch(switches::kLoginManager) && |
| 312 !parsed_command_line().HasSwitch(switches::kLoginUser) && | 313 !parsed_command_line().HasSwitch(switches::kLoginUser) && |
| 313 !parsed_command_line().HasSwitch(switches::kGuestSession)) { | 314 !parsed_command_line().HasSwitch(switches::kGuestSession)) { |
| 314 singleton_command_line->AppendSwitchASCII( | 315 singleton_command_line->AppendSwitchASCII(switches::kLoginUser, |
| 315 switches::kLoginUser, UserManager::kStubUser); | 316 chromeos::login::kStubUser); |
| 316 if (!parsed_command_line().HasSwitch(switches::kLoginProfile)) { | 317 if (!parsed_command_line().HasSwitch(switches::kLoginProfile)) { |
| 317 singleton_command_line->AppendSwitchASCII(switches::kLoginProfile, | 318 singleton_command_line->AppendSwitchASCII(switches::kLoginProfile, |
| 318 chrome::kTestUserProfileDir); | 319 chrome::kTestUserProfileDir); |
| 319 } | 320 } |
| 320 LOG(WARNING) << "Running as stub user with profile dir: " | 321 LOG(WARNING) << "Running as stub user with profile dir: " |
| 321 << singleton_command_line->GetSwitchValuePath( | 322 << singleton_command_line->GetSwitchValuePath( |
| 322 switches::kLoginProfile).value(); | 323 switches::kLoginProfile).value(); |
| 323 } | 324 } |
| 324 | 325 |
| 325 #if defined(GOOGLE_CHROME_BUILD) | 326 #if defined(GOOGLE_CHROME_BUILD) |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 void ChromeBrowserMainPartsChromeos::PostProfileInit() { | 554 void ChromeBrowserMainPartsChromeos::PostProfileInit() { |
| 554 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() | 555 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() |
| 555 // -- just after CreateProfile(). | 556 // -- just after CreateProfile(). |
| 556 | 557 |
| 557 BootTimesLoader::Get()->OnChromeProcessStart(); | 558 BootTimesLoader::Get()->OnChromeProcessStart(); |
| 558 | 559 |
| 559 // Restarting Chrome inside existing user session. Possible cases: | 560 // Restarting Chrome inside existing user session. Possible cases: |
| 560 // 1. Chrome is restarted after crash. | 561 // 1. Chrome is restarted after crash. |
| 561 // 2. Chrome is started in browser_tests skipping the login flow. | 562 // 2. Chrome is started in browser_tests skipping the login flow. |
| 562 // 3. Chrome is started on dev machine i.e. not on Chrome OS device w/o | 563 // 3. Chrome is started on dev machine i.e. not on Chrome OS device w/o |
| 563 // login flow. In that case --login-user=[UserManager::kStubUser] is added. | 564 // login flow. In that case --login-user=[chromeos::login::kStubUser] is |
| 565 // added. |
| 564 // See PreEarlyInitialization(). | 566 // See PreEarlyInitialization(). |
| 565 if (parsed_command_line().HasSwitch(switches::kLoginUser)) { | 567 if (parsed_command_line().HasSwitch(switches::kLoginUser)) { |
| 566 std::string login_user = login::CanonicalizeUserID( | 568 std::string login_user = login::CanonicalizeUserID( |
| 567 parsed_command_line().GetSwitchValueASCII( | 569 parsed_command_line().GetSwitchValueASCII( |
| 568 chromeos::switches::kLoginUser)); | 570 chromeos::switches::kLoginUser)); |
| 569 if (!base::SysInfo::IsRunningOnChromeOS() && | 571 if (!base::SysInfo::IsRunningOnChromeOS() && |
| 570 login_user == UserManager::kStubUser) { | 572 login_user == chromeos::login::kStubUser) { |
| 571 // For dev machines and stub user emulate as if sync has been initialized. | 573 // For dev machines and stub user emulate as if sync has been initialized. |
| 572 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, | 574 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, |
| 573 login_user); | 575 login_user); |
| 574 } | 576 } |
| 575 | 577 |
| 576 // This is done in SessionManager::OnProfileCreated during normal login. | 578 // This is done in SessionManager::OnProfileCreated during normal login. |
| 577 UserSessionManager::GetInstance()->InitRlz(profile()); | 579 UserSessionManager::GetInstance()->InitRlz(profile()); |
| 578 | 580 |
| 579 // Send the PROFILE_PREPARED notification and call SessionStarted() | 581 // Send the PROFILE_PREPARED notification and call SessionStarted() |
| 580 // so that the Launcher and other Profile dependent classes are created. | 582 // so that the Launcher and other Profile dependent classes are created. |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 // Destroy DBus services immediately after threads are stopped. | 816 // Destroy DBus services immediately after threads are stopped. |
| 815 dbus_services_.reset(); | 817 dbus_services_.reset(); |
| 816 | 818 |
| 817 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 819 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
| 818 | 820 |
| 819 // Destroy DeviceSettingsService after g_browser_process. | 821 // Destroy DeviceSettingsService after g_browser_process. |
| 820 DeviceSettingsService::Shutdown(); | 822 DeviceSettingsService::Shutdown(); |
| 821 } | 823 } |
| 822 | 824 |
| 823 } // namespace chromeos | 825 } // namespace chromeos |
| OLD | NEW |