| 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/browser_process_platform_part_chromeos.h" | 5 #include "chrome/browser/browser_process_platform_part_chromeos.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/time/default_tick_clock.h" | 9 #include "base/time/default_tick_clock.h" |
| 10 #include "base/time/tick_clock.h" | 10 #include "base/time/tick_clock.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/chromeos/login/session/chrome_session_manager.h" | 12 #include "chrome/browser/chromeos/login/session/chrome_session_manager.h" |
| 13 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h" | 13 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h" |
| 14 #include "chrome/browser/chromeos/memory/oom_priority_manager.h" | 14 #include "chrome/browser/chromeos/memory/oom_priority_manager.h" |
| 15 #include "chrome/browser/chromeos/net/delay_network_call.h" | 15 #include "chrome/browser/chromeos/net/delay_network_call.h" |
| 16 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 16 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 17 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 17 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 18 #include "chrome/browser/chromeos/settings/cros_settings.h" | 18 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 19 #include "chrome/browser/chromeos/system/automatic_reboot_manager.h" | 19 #include "chrome/browser/chromeos/system/automatic_reboot_manager.h" |
| 20 #include "chrome/browser/chromeos/system/device_disabling_manager.h" | 20 #include "chrome/browser/chromeos/system/device_disabling_manager.h" |
| 21 #include "chrome/browser/chromeos/system/device_disabling_manager_default_delega
te.h" | 21 #include "chrome/browser/chromeos/system/device_disabling_manager_default_delega
te.h" |
| 22 #include "chrome/browser/chromeos/system/timezone_util.h" | 22 #include "chrome/browser/chromeos/system/timezone_util.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/common/chrome_switches.h" |
| 24 #include "chromeos/geolocation/simple_geolocation_provider.h" | 25 #include "chromeos/geolocation/simple_geolocation_provider.h" |
| 25 #include "chromeos/timezone/timezone_resolver.h" | 26 #include "chromeos/timezone/timezone_resolver.h" |
| 26 #include "components/session_manager/core/session_manager.h" | 27 #include "components/session_manager/core/session_manager.h" |
| 27 #include "components/user_manager/user_manager.h" | 28 #include "components/user_manager/user_manager.h" |
| 28 | 29 |
| 29 BrowserProcessPlatformPart::BrowserProcessPlatformPart() | 30 BrowserProcessPlatformPart::BrowserProcessPlatformPart() |
| 30 : created_profile_helper_(false) { | 31 : created_profile_helper_(false) { |
| 31 } | 32 } |
| 32 | 33 |
| 33 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() { | 34 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() { |
| 34 } | 35 } |
| 35 | 36 |
| 36 void BrowserProcessPlatformPart::InitializeAutomaticRebootManager() { | 37 void BrowserProcessPlatformPart::InitializeAutomaticRebootManager() { |
| 37 DCHECK(!automatic_reboot_manager_); | 38 DCHECK(!automatic_reboot_manager_); |
| 38 | 39 |
| 39 automatic_reboot_manager_.reset(new chromeos::system::AutomaticRebootManager( | 40 automatic_reboot_manager_.reset(new chromeos::system::AutomaticRebootManager( |
| 40 scoped_ptr<base::TickClock>(new base::DefaultTickClock))); | 41 scoped_ptr<base::TickClock>(new base::DefaultTickClock))); |
| 41 } | 42 } |
| 42 | 43 |
| 43 void BrowserProcessPlatformPart::ShutdownAutomaticRebootManager() { | 44 void BrowserProcessPlatformPart::ShutdownAutomaticRebootManager() { |
| 44 automatic_reboot_manager_.reset(); | 45 automatic_reboot_manager_.reset(); |
| 45 } | 46 } |
| 46 | 47 |
| 47 void BrowserProcessPlatformPart::InitializeChromeUserManager() { | 48 void BrowserProcessPlatformPart::InitializeChromeUserManager() { |
| 49 DisableDinoEasterEggIfEnrolled(); |
| 48 DCHECK(!chrome_user_manager_); | 50 DCHECK(!chrome_user_manager_); |
| 49 chrome_user_manager_ = | 51 chrome_user_manager_ = |
| 50 chromeos::ChromeUserManagerImpl::CreateChromeUserManager(); | 52 chromeos::ChromeUserManagerImpl::CreateChromeUserManager(); |
| 51 chrome_user_manager_->Initialize(); | 53 chrome_user_manager_->Initialize(); |
| 52 } | 54 } |
| 53 | 55 |
| 54 void BrowserProcessPlatformPart::DestroyChromeUserManager() { | 56 void BrowserProcessPlatformPart::DestroyChromeUserManager() { |
| 55 chrome_user_manager_->Destroy(); | 57 chrome_user_manager_->Destroy(); |
| 56 chrome_user_manager_.reset(); | 58 chrome_user_manager_.reset(); |
| 57 } | 59 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 CreateProfileHelper(); | 106 CreateProfileHelper(); |
| 105 return profile_helper_.get(); | 107 return profile_helper_.get(); |
| 106 } | 108 } |
| 107 | 109 |
| 108 policy::BrowserPolicyConnectorChromeOS* | 110 policy::BrowserPolicyConnectorChromeOS* |
| 109 BrowserProcessPlatformPart::browser_policy_connector_chromeos() { | 111 BrowserProcessPlatformPart::browser_policy_connector_chromeos() { |
| 110 return static_cast<policy::BrowserPolicyConnectorChromeOS*>( | 112 return static_cast<policy::BrowserPolicyConnectorChromeOS*>( |
| 111 g_browser_process->browser_policy_connector()); | 113 g_browser_process->browser_policy_connector()); |
| 112 } | 114 } |
| 113 | 115 |
| 116 void BrowserProcessPlatformPart::DisableDinoEasterEggIfEnrolled() { |
| 117 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 118 const bool is_enterprise_managed = g_browser_process->platform_part()-> |
| 119 browser_policy_connector_chromeos()->IsEnterpriseManaged(); |
| 120 if (is_enterprise_managed) |
| 121 command_line->AppendSwitch(switches::kDisableDinosaurEasterEgg); |
| 122 } |
| 123 |
| 114 chromeos::TimeZoneResolver* BrowserProcessPlatformPart::GetTimezoneResolver() { | 124 chromeos::TimeZoneResolver* BrowserProcessPlatformPart::GetTimezoneResolver() { |
| 115 if (!timezone_resolver_.get()) { | 125 if (!timezone_resolver_.get()) { |
| 116 timezone_resolver_.reset(new chromeos::TimeZoneResolver( | 126 timezone_resolver_.reset(new chromeos::TimeZoneResolver( |
| 117 g_browser_process->system_request_context(), | 127 g_browser_process->system_request_context(), |
| 118 chromeos::SimpleGeolocationProvider::DefaultGeolocationProviderURL(), | 128 chromeos::SimpleGeolocationProvider::DefaultGeolocationProviderURL(), |
| 119 base::Bind(&chromeos::system::ApplyTimeZone), | 129 base::Bind(&chromeos::system::ApplyTimeZone), |
| 120 base::Bind(&chromeos::DelayNetworkCall, | 130 base::Bind(&chromeos::DelayNetworkCall, |
| 121 base::TimeDelta::FromMilliseconds( | 131 base::TimeDelta::FromMilliseconds( |
| 122 chromeos::kDefaultNetworkRetryDelayMS)), | 132 chromeos::kDefaultNetworkRetryDelayMS)), |
| 123 g_browser_process->local_state())); | 133 g_browser_process->local_state())); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 136 BrowserProcessPlatformPart::CreateBrowserPolicyConnector() { | 146 BrowserProcessPlatformPart::CreateBrowserPolicyConnector() { |
| 137 return scoped_ptr<policy::BrowserPolicyConnector>( | 147 return scoped_ptr<policy::BrowserPolicyConnector>( |
| 138 new policy::BrowserPolicyConnectorChromeOS()); | 148 new policy::BrowserPolicyConnectorChromeOS()); |
| 139 } | 149 } |
| 140 | 150 |
| 141 void BrowserProcessPlatformPart::CreateProfileHelper() { | 151 void BrowserProcessPlatformPart::CreateProfileHelper() { |
| 142 DCHECK(!created_profile_helper_ && profile_helper_.get() == NULL); | 152 DCHECK(!created_profile_helper_ && profile_helper_.get() == NULL); |
| 143 created_profile_helper_ = true; | 153 created_profile_helper_ = true; |
| 144 profile_helper_.reset(new chromeos::ProfileHelper()); | 154 profile_helper_.reset(new chromeos::ProfileHelper()); |
| 145 } | 155 } |
| OLD | NEW |