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(); |
| 528 |
| 529 if (policy::IsDeviceLocalAccountUser(user_id, NULL) && |
| 530 !user_manager->IsKnownUser(user_id)) { |
| 531 // When a device-local account is removed, its policy is deleted from disk |
| 532 // immediately. If a session using this account happens to be in progress, |
| 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(); |
| 538 return; |
| 539 } |
| 540 |
527 // In case of multi-profiles --login-profile will contain user_id_hash. | 541 // In case of multi-profiles --login-profile will contain user_id_hash. |
528 std::string username_hash = | 542 std::string user_id_hash = |
529 parsed_command_line().GetSwitchValueASCII(switches::kLoginProfile); | 543 parsed_command_line().GetSwitchValueASCII(switches::kLoginProfile); |
530 user_manager->UserLoggedIn(username, username_hash, true); | 544 user_manager->UserLoggedIn(user_id, user_id_hash, true); |
531 VLOG(1) << "Relaunching browser for user: " << username | 545 VLOG(1) << "Relaunching browser for user: " << user_id |
532 << " with hash: " << username_hash; | 546 << " with hash: " << user_id_hash; |
533 } | 547 } |
534 } | 548 } |
535 | 549 |
536 class GuestLanguageSetCallbackData { | 550 class GuestLanguageSetCallbackData { |
537 public: | 551 public: |
538 explicit GuestLanguageSetCallbackData(Profile* profile) : profile(profile) { | 552 explicit GuestLanguageSetCallbackData(Profile* profile) : profile(profile) { |
539 } | 553 } |
540 | 554 |
541 // Must match SwitchLanguageCallback type. | 555 // Must match SwitchLanguageCallback type. |
542 static void Callback(const scoped_ptr<GuestLanguageSetCallbackData>& self, | 556 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. | 851 // Destroy DBus services immediately after threads are stopped. |
838 dbus_services_.reset(); | 852 dbus_services_.reset(); |
839 | 853 |
840 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 854 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
841 | 855 |
842 // Destroy DeviceSettingsService after g_browser_process. | 856 // Destroy DeviceSettingsService after g_browser_process. |
843 DeviceSettingsService::Shutdown(); | 857 DeviceSettingsService::Shutdown(); |
844 } | 858 } |
845 | 859 |
846 } // namespace chromeos | 860 } // namespace chromeos |
OLD | NEW |