Chromium Code Reviews| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 #include "chrome/browser/chromeos/power/power_data_collector.h" | 60 #include "chrome/browser/chromeos/power/power_data_collector.h" |
| 61 #include "chrome/browser/chromeos/power/power_prefs.h" | 61 #include "chrome/browser/chromeos/power/power_prefs.h" |
| 62 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 62 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 63 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h " | 63 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h " |
| 64 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 64 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 65 #include "chrome/browser/chromeos/settings/owner_key_util.h" | 65 #include "chrome/browser/chromeos/settings/owner_key_util.h" |
| 66 #include "chrome/browser/chromeos/status/data_promo_notification.h" | 66 #include "chrome/browser/chromeos/status/data_promo_notification.h" |
| 67 #include "chrome/browser/chromeos/system/input_device_settings.h" | 67 #include "chrome/browser/chromeos/system/input_device_settings.h" |
| 68 #include "chrome/browser/chromeos/upgrade_detector_chromeos.h" | 68 #include "chrome/browser/chromeos/upgrade_detector_chromeos.h" |
| 69 #include "chrome/browser/defaults.h" | 69 #include "chrome/browser/defaults.h" |
| 70 #include "chrome/browser/lifetime/application_lifetime.h" | |
| 70 #include "chrome/browser/metrics/metrics_service.h" | 71 #include "chrome/browser/metrics/metrics_service.h" |
| 71 #include "chrome/browser/net/chrome_network_delegate.h" | 72 #include "chrome/browser/net/chrome_network_delegate.h" |
| 72 #include "chrome/browser/profiles/profile.h" | 73 #include "chrome/browser/profiles/profile.h" |
| 73 #include "chrome/browser/profiles/profile_manager.h" | 74 #include "chrome/browser/profiles/profile_manager.h" |
| 74 #include "chrome/browser/rlz/rlz.h" | 75 #include "chrome/browser/rlz/rlz.h" |
| 75 #include "chrome/common/chrome_constants.h" | 76 #include "chrome/common/chrome_constants.h" |
| 76 #include "chrome/common/chrome_paths.h" | 77 #include "chrome/common/chrome_paths.h" |
| 77 #include "chrome/common/chrome_switches.h" | 78 #include "chrome/common/chrome_switches.h" |
| 78 #include "chrome/common/chrome_version_info.h" | 79 #include "chrome/common/chrome_version_info.h" |
| 79 #include "chrome/common/logging_chrome.h" | 80 #include "chrome/common/logging_chrome.h" |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 514 WizardController::SetZeroDelays(); | 515 WizardController::SetZeroDelays(); |
| 515 } | 516 } |
| 516 | 517 |
| 517 power_prefs_.reset(new PowerPrefs( | 518 power_prefs_.reset(new PowerPrefs( |
| 518 DBusThreadManager::Get()->GetPowerPolicyController())); | 519 DBusThreadManager::Get()->GetPowerPolicyController())); |
| 519 | 520 |
| 520 // In Aura builds this will initialize ash::Shell. | 521 // In Aura builds this will initialize ash::Shell. |
| 521 ChromeBrowserMainPartsLinux::PreProfileInit(); | 522 ChromeBrowserMainPartsLinux::PreProfileInit(); |
| 522 | 523 |
| 523 if (immediate_login) { | 524 if (immediate_login) { |
| 524 std::string username = | 525 const std::string user_id = |
| 525 parsed_command_line().GetSwitchValueASCII(switches::kLoginUser); | 526 parsed_command_line().GetSwitchValueASCII(switches::kLoginUser); |
| 526 UserManager* user_manager = UserManager::Get(); | 527 UserManager* user_manager = UserManager::Get(); |
| 527 // In case of multi-profiles --login-profile will contain user_id_hash. | 528 |
| 528 std::string username_hash = | 529 if (policy::IsDeviceLocalAccountUser(user_id, NULL) && |
| 529 parsed_command_line().GetSwitchValueASCII(switches::kLoginProfile); | 530 !user_manager->IsKnownUser(user_id)) { |
| 530 user_manager->UserLoggedIn(username, username_hash, true); | 531 // When a device-local account is removed, its policy is deleted from disk |
| 531 VLOG(1) << "Relaunching browser for user: " << username | 532 // immediately. If a session using this account happens to be in progress, |
| 532 << " with hash: " << username_hash; | 533 // the session is allowed to continue with policy served from an in-memory |
| 534 // cache. If Chrome crashes later in the session, the policy becomes | |
| 535 // completely unavailable. Exit the session in that case, rather than | |
| 536 // allowing it to continue without policy. | |
| 537 chrome::AttemptUserExit(); | |
|
Mattias Nissler (ping if slow)
2014/04/25 14:42:45
I'd rather put a return here and move the block be
bartfab (slow)
2014/04/25 14:52:52
Done.
| |
| 538 } else { | |
| 539 // In case of multi-profiles --login-profile will contain user_id_hash. | |
| 540 std::string user_id_hash = | |
| 541 parsed_command_line().GetSwitchValueASCII(switches::kLoginProfile); | |
| 542 user_manager->UserLoggedIn(user_id, user_id_hash, true); | |
| 543 VLOG(1) << "Relaunching browser for user: " << user_id | |
| 544 << " with hash: " << user_id_hash; | |
| 545 } | |
| 533 } | 546 } |
| 534 } | 547 } |
| 535 | 548 |
| 536 class GuestLanguageSetCallbackData { | 549 class GuestLanguageSetCallbackData { |
| 537 public: | 550 public: |
| 538 explicit GuestLanguageSetCallbackData(Profile* profile) : profile(profile) { | 551 explicit GuestLanguageSetCallbackData(Profile* profile) : profile(profile) { |
| 539 } | 552 } |
| 540 | 553 |
| 541 // Must match SwitchLanguageCallback type. | 554 // Must match SwitchLanguageCallback type. |
| 542 static void Callback(const scoped_ptr<GuestLanguageSetCallbackData>& self, | 555 static void Callback(const scoped_ptr<GuestLanguageSetCallbackData>& self, |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 837 // Destroy DBus services immediately after threads are stopped. | 850 // Destroy DBus services immediately after threads are stopped. |
| 838 dbus_services_.reset(); | 851 dbus_services_.reset(); |
| 839 | 852 |
| 840 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 853 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
| 841 | 854 |
| 842 // Destroy DeviceSettingsService after g_browser_process. | 855 // Destroy DeviceSettingsService after g_browser_process. |
| 843 DeviceSettingsService::Shutdown(); | 856 DeviceSettingsService::Shutdown(); |
| 844 } | 857 } |
| 845 | 858 |
| 846 } // namespace chromeos | 859 } // namespace chromeos |
| OLD | NEW |