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 <stddef.h> | 7 #include <stddef.h> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 #include "chrome/common/chrome_paths.h" | 86 #include "chrome/common/chrome_paths.h" |
87 #include "chrome/common/chrome_switches.h" | 87 #include "chrome/common/chrome_switches.h" |
88 #include "chrome/common/logging_chrome.h" | 88 #include "chrome/common/logging_chrome.h" |
89 #include "chrome/common/pref_names.h" | 89 #include "chrome/common/pref_names.h" |
90 #include "chromeos/audio/audio_devices_pref_handler_impl.h" | 90 #include "chromeos/audio/audio_devices_pref_handler_impl.h" |
91 #include "chromeos/audio/cras_audio_handler.h" | 91 #include "chromeos/audio/cras_audio_handler.h" |
92 #include "chromeos/cert_loader.h" | 92 #include "chromeos/cert_loader.h" |
93 #include "chromeos/chromeos_paths.h" | 93 #include "chromeos/chromeos_paths.h" |
94 #include "chromeos/chromeos_switches.h" | 94 #include "chromeos/chromeos_switches.h" |
95 #include "chromeos/cryptohome/async_method_caller.h" | 95 #include "chromeos/cryptohome/async_method_caller.h" |
| 96 #include "chromeos/cryptohome/cryptohome_parameters.h" |
96 #include "chromeos/cryptohome/homedir_methods.h" | 97 #include "chromeos/cryptohome/homedir_methods.h" |
97 #include "chromeos/cryptohome/system_salt_getter.h" | 98 #include "chromeos/cryptohome/system_salt_getter.h" |
98 #include "chromeos/dbus/dbus_thread_manager.h" | 99 #include "chromeos/dbus/dbus_thread_manager.h" |
99 #include "chromeos/dbus/power_policy_controller.h" | 100 #include "chromeos/dbus/power_policy_controller.h" |
100 #include "chromeos/dbus/services/console_service_provider.h" | 101 #include "chromeos/dbus/services/console_service_provider.h" |
101 #include "chromeos/dbus/services/cros_dbus_service.h" | 102 #include "chromeos/dbus/services/cros_dbus_service.h" |
102 #include "chromeos/dbus/services/display_power_service_provider.h" | 103 #include "chromeos/dbus/services/display_power_service_provider.h" |
103 #include "chromeos/dbus/services/liveness_service_provider.h" | 104 #include "chromeos/dbus/services/liveness_service_provider.h" |
104 #include "chromeos/dbus/services/proxy_resolution_service_provider.h" | 105 #include "chromeos/dbus/services/proxy_resolution_service_provider.h" |
105 #include "chromeos/dbus/session_manager_client.h" | 106 #include "chromeos/dbus/session_manager_client.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 } | 322 } |
322 | 323 |
323 // If we're not running on real Chrome OS hardware (or under VM), and are not | 324 // If we're not running on real Chrome OS hardware (or under VM), and are not |
324 // showing the login manager or attempting a command line login, login with a | 325 // showing the login manager or attempting a command line login, login with a |
325 // stub user. | 326 // stub user. |
326 if (!base::SysInfo::IsRunningOnChromeOS() && | 327 if (!base::SysInfo::IsRunningOnChromeOS() && |
327 !parsed_command_line().HasSwitch(switches::kLoginManager) && | 328 !parsed_command_line().HasSwitch(switches::kLoginManager) && |
328 !parsed_command_line().HasSwitch(switches::kLoginUser) && | 329 !parsed_command_line().HasSwitch(switches::kLoginUser) && |
329 !parsed_command_line().HasSwitch(switches::kGuestSession)) { | 330 !parsed_command_line().HasSwitch(switches::kGuestSession)) { |
330 singleton_command_line->AppendSwitchASCII( | 331 singleton_command_line->AppendSwitchASCII( |
331 switches::kLoginUser, login::StubAccountId().GetUserEmail()); | 332 switches::kLoginUser, |
| 333 cryptohome::Identification(login::StubAccountId()).id()); |
332 if (!parsed_command_line().HasSwitch(switches::kLoginProfile)) { | 334 if (!parsed_command_line().HasSwitch(switches::kLoginProfile)) { |
333 singleton_command_line->AppendSwitchASCII(switches::kLoginProfile, | 335 singleton_command_line->AppendSwitchASCII(switches::kLoginProfile, |
334 chrome::kTestUserProfileDir); | 336 chrome::kTestUserProfileDir); |
335 } | 337 } |
336 LOG(WARNING) << "Running as stub user with profile dir: " | 338 LOG(WARNING) << "Running as stub user with profile dir: " |
337 << singleton_command_line->GetSwitchValuePath( | 339 << singleton_command_line->GetSwitchValuePath( |
338 switches::kLoginProfile).value(); | 340 switches::kLoginProfile).value(); |
339 } | 341 } |
340 | 342 |
341 #if defined(GOOGLE_CHROME_BUILD) | 343 #if defined(GOOGLE_CHROME_BUILD) |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 ShouldAutoLaunchKioskApp(parsed_command_line())) { | 510 ShouldAutoLaunchKioskApp(parsed_command_line())) { |
509 WizardController::SetZeroDelays(); | 511 WizardController::SetZeroDelays(); |
510 } | 512 } |
511 | 513 |
512 power_prefs_.reset(new PowerPrefs(PowerPolicyController::Get())); | 514 power_prefs_.reset(new PowerPrefs(PowerPolicyController::Get())); |
513 | 515 |
514 // In Aura builds this will initialize ash::Shell. | 516 // In Aura builds this will initialize ash::Shell. |
515 ChromeBrowserMainPartsLinux::PreProfileInit(); | 517 ChromeBrowserMainPartsLinux::PreProfileInit(); |
516 | 518 |
517 if (immediate_login) { | 519 if (immediate_login) { |
518 const std::string user_email = login::CanonicalizeUserID( | 520 const std::string cryptohome_id = |
519 parsed_command_line().GetSwitchValueASCII(switches::kLoginUser)); | 521 parsed_command_line().GetSwitchValueASCII(switches::kLoginUser); |
| 522 const AccountId account_id( |
| 523 cryptohome::Identification::FromString(cryptohome_id).GetAccountId()); |
| 524 |
520 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 525 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
521 | 526 |
522 const AccountId account_id(AccountId::FromUserEmail(user_email)); | |
523 if (policy::IsDeviceLocalAccountUser(account_id.GetUserEmail(), NULL) && | 527 if (policy::IsDeviceLocalAccountUser(account_id.GetUserEmail(), NULL) && |
524 !user_manager->IsKnownUser(account_id)) { | 528 !user_manager->IsKnownUser(account_id)) { |
525 // When a device-local account is removed, its policy is deleted from disk | 529 // When a device-local account is removed, its policy is deleted from disk |
526 // immediately. If a session using this account happens to be in progress, | 530 // immediately. If a session using this account happens to be in progress, |
527 // the session is allowed to continue with policy served from an in-memory | 531 // the session is allowed to continue with policy served from an in-memory |
528 // cache. If Chrome crashes later in the session, the policy becomes | 532 // cache. If Chrome crashes later in the session, the policy becomes |
529 // completely unavailable. Exit the session in that case, rather than | 533 // completely unavailable. Exit the session in that case, rather than |
530 // allowing it to continue without policy. | 534 // allowing it to continue without policy. |
531 chrome::AttemptUserExit(); | 535 chrome::AttemptUserExit(); |
532 return; | 536 return; |
533 } | 537 } |
534 | 538 |
535 // In case of multi-profiles --login-profile will contain user_id_hash. | 539 // In case of multi-profiles --login-profile will contain user_id_hash. |
536 std::string user_id_hash = | 540 std::string user_id_hash = |
537 parsed_command_line().GetSwitchValueASCII(switches::kLoginProfile); | 541 parsed_command_line().GetSwitchValueASCII(switches::kLoginProfile); |
538 user_manager->UserLoggedIn(account_id, user_id_hash, true); | 542 user_manager->UserLoggedIn(account_id, user_id_hash, true); |
539 VLOG(1) << "Relaunching browser for user: " << user_email | 543 VLOG(1) << "Relaunching browser for user: " << account_id.Serialize() |
540 << " with hash: " << user_id_hash; | 544 << " with hash: " << user_id_hash; |
541 } | 545 } |
542 } | 546 } |
543 | 547 |
544 class GuestLanguageSetCallbackData { | 548 class GuestLanguageSetCallbackData { |
545 public: | 549 public: |
546 explicit GuestLanguageSetCallbackData(Profile* profile) : profile(profile) { | 550 explicit GuestLanguageSetCallbackData(Profile* profile) : profile(profile) { |
547 } | 551 } |
548 | 552 |
549 // Must match SwitchLanguageCallback type. | 553 // Must match SwitchLanguageCallback type. |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 // Destroy DBus services immediately after threads are stopped. | 857 // Destroy DBus services immediately after threads are stopped. |
854 dbus_services_.reset(); | 858 dbus_services_.reset(); |
855 | 859 |
856 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 860 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
857 | 861 |
858 // Destroy DeviceSettingsService after g_browser_process. | 862 // Destroy DeviceSettingsService after g_browser_process. |
859 DeviceSettingsService::Shutdown(); | 863 DeviceSettingsService::Shutdown(); |
860 } | 864 } |
861 | 865 |
862 } // namespace chromeos | 866 } // namespace chromeos |
OLD | NEW |