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 26 matching lines...) Expand all Loading... |
37 #include "chrome/browser/chromeos/extensions/extension_system_event_observer.h" | 37 #include "chrome/browser/chromeos/extensions/extension_system_event_observer.h" |
38 #include "chrome/browser/chromeos/external_metrics.h" | 38 #include "chrome/browser/chromeos/external_metrics.h" |
39 #include "chrome/browser/chromeos/imageburner/burn_manager.h" | 39 #include "chrome/browser/chromeos/imageburner/burn_manager.h" |
40 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" | 40 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" |
41 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 41 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
42 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.h" | 42 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.h" |
43 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h" | 43 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h" |
44 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 44 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
45 #include "chrome/browser/chromeos/language_preferences.h" | 45 #include "chrome/browser/chromeos/language_preferences.h" |
46 #include "chrome/browser/chromeos/login/auth/authenticator.h" | 46 #include "chrome/browser/chromeos/login/auth/authenticator.h" |
| 47 #include "chrome/browser/chromeos/login/helper.h" |
47 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 48 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
48 #include "chrome/browser/chromeos/login/login_utils.h" | 49 #include "chrome/browser/chromeos/login/login_utils.h" |
49 #include "chrome/browser/chromeos/login/login_wizard.h" | 50 #include "chrome/browser/chromeos/login/login_wizard.h" |
50 #include "chrome/browser/chromeos/login/startup_utils.h" | 51 #include "chrome/browser/chromeos/login/startup_utils.h" |
51 #include "chrome/browser/chromeos/login/users/user.h" | 52 #include "chrome/browser/chromeos/login/users/user.h" |
52 #include "chrome/browser/chromeos/login/users/user_manager.h" | 53 #include "chrome/browser/chromeos/login/users/user_manager.h" |
53 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 54 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
54 #include "chrome/browser/chromeos/login/wizard_controller.h" | 55 #include "chrome/browser/chromeos/login/wizard_controller.h" |
55 #include "chrome/browser/chromeos/memory/oom_priority_manager.h" | 56 #include "chrome/browser/chromeos/memory/oom_priority_manager.h" |
56 #include "chrome/browser/chromeos/net/network_portal_detector.h" | 57 #include "chrome/browser/chromeos/net/network_portal_detector.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 false, // has_cookies | 162 false, // has_cookies |
162 true, // has_active_session | 163 true, // has_active_session |
163 this); | 164 this); |
164 } else { | 165 } else { |
165 delete this; | 166 delete this; |
166 } | 167 } |
167 } | 168 } |
168 | 169 |
169 // LoginUtils::Delegate implementation: | 170 // LoginUtils::Delegate implementation: |
170 virtual void OnProfilePrepared(Profile* profile) OVERRIDE { | 171 virtual void OnProfilePrepared(Profile* profile) OVERRIDE { |
171 const std::string login_user = | 172 const std::string login_user = login::CanonicalizeUserID( |
172 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 173 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
173 chromeos::switches::kLoginUser); | 174 switches::kLoginUser)); |
174 if (!policy::IsDeviceLocalAccountUser(login_user, NULL)) { | 175 if (!policy::IsDeviceLocalAccountUser(login_user, NULL)) { |
175 profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, | 176 profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, |
176 login_user); | 177 login_user); |
177 } | 178 } |
178 profile_prepared_ = true; | 179 profile_prepared_ = true; |
179 LoginUtils::Get()->DoBrowserLaunch(profile, NULL); | 180 LoginUtils::Get()->DoBrowserLaunch(profile, NULL); |
180 delete this; | 181 delete this; |
181 } | 182 } |
182 | 183 |
183 scoped_refptr<Authenticator> authenticator_; | 184 scoped_refptr<Authenticator> authenticator_; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 void ChromeBrowserMainPartsChromeos::PreEarlyInitialization() { | 350 void ChromeBrowserMainPartsChromeos::PreEarlyInitialization() { |
350 CommandLine* singleton_command_line = CommandLine::ForCurrentProcess(); | 351 CommandLine* singleton_command_line = CommandLine::ForCurrentProcess(); |
351 | 352 |
352 if (parsed_command_line().HasSwitch(switches::kGuestSession)) { | 353 if (parsed_command_line().HasSwitch(switches::kGuestSession)) { |
353 // Disable sync and extensions if we're in "browse without sign-in" mode. | 354 // Disable sync and extensions if we're in "browse without sign-in" mode. |
354 singleton_command_line->AppendSwitch(::switches::kDisableSync); | 355 singleton_command_line->AppendSwitch(::switches::kDisableSync); |
355 singleton_command_line->AppendSwitch(::switches::kDisableExtensions); | 356 singleton_command_line->AppendSwitch(::switches::kDisableExtensions); |
356 browser_defaults::bookmarks_enabled = false; | 357 browser_defaults::bookmarks_enabled = false; |
357 } | 358 } |
358 | 359 |
359 // If we're not running on real ChromeOS hardware (or under VM), and are not | 360 // If we're not running on real Chrome OS hardware (or under VM), and are not |
360 // showing the login manager or attempting a command line login, login with a | 361 // showing the login manager or attempting a command line login, login with a |
361 // stub user. | 362 // stub user. |
362 if (!base::SysInfo::IsRunningOnChromeOS() && | 363 if (!base::SysInfo::IsRunningOnChromeOS() && |
363 !parsed_command_line().HasSwitch(switches::kLoginManager) && | 364 !parsed_command_line().HasSwitch(switches::kLoginManager) && |
364 !parsed_command_line().HasSwitch(switches::kLoginUser) && | 365 !parsed_command_line().HasSwitch(switches::kLoginUser) && |
365 !parsed_command_line().HasSwitch(switches::kGuestSession)) { | 366 !parsed_command_line().HasSwitch(switches::kGuestSession)) { |
366 singleton_command_line->AppendSwitchASCII( | 367 singleton_command_line->AppendSwitchASCII( |
367 switches::kLoginUser, UserManager::kStubUser); | 368 switches::kLoginUser, UserManager::kStubUser); |
368 if (!parsed_command_line().HasSwitch(switches::kLoginProfile)) { | 369 if (!parsed_command_line().HasSwitch(switches::kLoginProfile)) { |
369 singleton_command_line->AppendSwitchASCII(switches::kLoginProfile, | 370 singleton_command_line->AppendSwitchASCII(switches::kLoginProfile, |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 WizardController::SetZeroDelays(); | 517 WizardController::SetZeroDelays(); |
517 } | 518 } |
518 | 519 |
519 power_prefs_.reset(new PowerPrefs( | 520 power_prefs_.reset(new PowerPrefs( |
520 DBusThreadManager::Get()->GetPowerPolicyController())); | 521 DBusThreadManager::Get()->GetPowerPolicyController())); |
521 | 522 |
522 // In Aura builds this will initialize ash::Shell. | 523 // In Aura builds this will initialize ash::Shell. |
523 ChromeBrowserMainPartsLinux::PreProfileInit(); | 524 ChromeBrowserMainPartsLinux::PreProfileInit(); |
524 | 525 |
525 if (immediate_login) { | 526 if (immediate_login) { |
526 const std::string user_id = | 527 const std::string user_id = login::CanonicalizeUserID( |
527 parsed_command_line().GetSwitchValueASCII(switches::kLoginUser); | 528 parsed_command_line().GetSwitchValueASCII(switches::kLoginUser)); |
528 UserManager* user_manager = UserManager::Get(); | 529 UserManager* user_manager = UserManager::Get(); |
529 | 530 |
530 if (policy::IsDeviceLocalAccountUser(user_id, NULL) && | 531 if (policy::IsDeviceLocalAccountUser(user_id, NULL) && |
531 !user_manager->IsKnownUser(user_id)) { | 532 !user_manager->IsKnownUser(user_id)) { |
532 // When a device-local account is removed, its policy is deleted from disk | 533 // When a device-local account is removed, its policy is deleted from disk |
533 // immediately. If a session using this account happens to be in progress, | 534 // immediately. If a session using this account happens to be in progress, |
534 // the session is allowed to continue with policy served from an in-memory | 535 // the session is allowed to continue with policy served from an in-memory |
535 // cache. If Chrome crashes later in the session, the policy becomes | 536 // cache. If Chrome crashes later in the session, the policy becomes |
536 // completely unavailable. Exit the session in that case, rather than | 537 // completely unavailable. Exit the session in that case, rather than |
537 // allowing it to continue without policy. | 538 // allowing it to continue without policy. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() | 610 // -- This used to be in ChromeBrowserMainParts::PreMainMessageLoopRun() |
610 // -- just after CreateProfile(). | 611 // -- just after CreateProfile(). |
611 | 612 |
612 // Restarting Chrome inside existing user session. Possible cases: | 613 // Restarting Chrome inside existing user session. Possible cases: |
613 // 1. Chrome is restarted after crash. | 614 // 1. Chrome is restarted after crash. |
614 // 2. Chrome is started in browser_tests skipping the login flow | 615 // 2. Chrome is started in browser_tests skipping the login flow |
615 // 3. Chrome is started on dev machine | 616 // 3. Chrome is started on dev machine |
616 // i.e. not on Chrome OS device w/o login flow. | 617 // i.e. not on Chrome OS device w/o login flow. |
617 if (parsed_command_line().HasSwitch(switches::kLoginUser) && | 618 if (parsed_command_line().HasSwitch(switches::kLoginUser) && |
618 !parsed_command_line().HasSwitch(switches::kLoginPassword)) { | 619 !parsed_command_line().HasSwitch(switches::kLoginPassword)) { |
619 std::string login_user = parsed_command_line().GetSwitchValueASCII( | 620 std::string login_user = login::CanonicalizeUserID( |
620 chromeos::switches::kLoginUser); | 621 parsed_command_line().GetSwitchValueASCII( |
| 622 chromeos::switches::kLoginUser)); |
621 if (!base::SysInfo::IsRunningOnChromeOS() && | 623 if (!base::SysInfo::IsRunningOnChromeOS() && |
622 login_user == UserManager::kStubUser) { | 624 login_user == UserManager::kStubUser) { |
623 // For dev machines and stub user emulate as if sync has been initialized. | 625 // For dev machines and stub user emulate as if sync has been initialized. |
624 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, | 626 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, |
625 login_user); | 627 login_user); |
626 } | 628 } |
627 | 629 |
628 // This is done in LoginUtils::OnProfileCreated during normal login. | 630 // This is done in LoginUtils::OnProfileCreated during normal login. |
629 LoginUtils::Get()->InitRlzDelayed(profile()); | 631 LoginUtils::Get()->InitRlzDelayed(profile()); |
630 | 632 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 // Destroy DBus services immediately after threads are stopped. | 857 // Destroy DBus services immediately after threads are stopped. |
856 dbus_services_.reset(); | 858 dbus_services_.reset(); |
857 | 859 |
858 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 860 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
859 | 861 |
860 // Destroy DeviceSettingsService after g_browser_process. | 862 // Destroy DeviceSettingsService after g_browser_process. |
861 DeviceSettingsService::Shutdown(); | 863 DeviceSettingsService::Shutdown(); |
862 } | 864 } |
863 | 865 |
864 } // namespace chromeos | 866 } // namespace chromeos |
OLD | NEW |