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 DisableDinoEasterEgg(); | |
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 11 matching lines...) Expand all Loading... | |
69 | 71 |
70 void BrowserProcessPlatformPart::ShutdownDeviceDisablingManager() { | 72 void BrowserProcessPlatformPart::ShutdownDeviceDisablingManager() { |
71 device_disabling_manager_.reset(); | 73 device_disabling_manager_.reset(); |
72 device_disabling_manager_delegate_.reset(); | 74 device_disabling_manager_delegate_.reset(); |
73 } | 75 } |
74 | 76 |
75 void BrowserProcessPlatformPart::InitializeSessionManager( | 77 void BrowserProcessPlatformPart::InitializeSessionManager( |
76 const base::CommandLine& parsed_command_line, | 78 const base::CommandLine& parsed_command_line, |
77 Profile* profile, | 79 Profile* profile, |
78 bool is_running_test) { | 80 bool is_running_test) { |
81 | |
sky
2015/03/23 15:59:20
remove this line.
edwardjung
2015/03/24 16:07:35
Done.
| |
79 DCHECK(!session_manager_); | 82 DCHECK(!session_manager_); |
80 session_manager_ = chromeos::ChromeSessionManager::CreateSessionManager( | 83 session_manager_ = chromeos::ChromeSessionManager::CreateSessionManager( |
81 parsed_command_line, profile, is_running_test); | 84 parsed_command_line, profile, is_running_test); |
82 } | 85 } |
83 | 86 |
84 void BrowserProcessPlatformPart::ShutdownSessionManager() { | 87 void BrowserProcessPlatformPart::ShutdownSessionManager() { |
85 session_manager_.reset(); | 88 session_manager_.reset(); |
86 } | 89 } |
87 | 90 |
88 session_manager::SessionManager* BrowserProcessPlatformPart::SessionManager() { | 91 session_manager::SessionManager* BrowserProcessPlatformPart::SessionManager() { |
(...skipping 15 matching lines...) Expand all Loading... | |
104 CreateProfileHelper(); | 107 CreateProfileHelper(); |
105 return profile_helper_.get(); | 108 return profile_helper_.get(); |
106 } | 109 } |
107 | 110 |
108 policy::BrowserPolicyConnectorChromeOS* | 111 policy::BrowserPolicyConnectorChromeOS* |
109 BrowserProcessPlatformPart::browser_policy_connector_chromeos() { | 112 BrowserProcessPlatformPart::browser_policy_connector_chromeos() { |
110 return static_cast<policy::BrowserPolicyConnectorChromeOS*>( | 113 return static_cast<policy::BrowserPolicyConnectorChromeOS*>( |
111 g_browser_process->browser_policy_connector()); | 114 g_browser_process->browser_policy_connector()); |
112 } | 115 } |
113 | 116 |
117 void BrowserProcessPlatformPart::DisableDinoEasterEgg() { | |
118 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
119 const bool is_enterprise_managed = g_browser_process->platform_part()-> | |
120 browser_policy_connector_chromeos()->IsEnterpriseManaged(); | |
121 if (is_enterprise_managed) { | |
sky
2015/03/23 15:59:20
nit: no {}
edwardjung
2015/03/24 16:07:35
Done.
| |
122 command_line->AppendSwitch(switches::kDisableDinosaurEasterEgg); | |
123 } | |
124 } | |
125 | |
114 chromeos::TimeZoneResolver* BrowserProcessPlatformPart::GetTimezoneResolver() { | 126 chromeos::TimeZoneResolver* BrowserProcessPlatformPart::GetTimezoneResolver() { |
115 if (!timezone_resolver_.get()) { | 127 if (!timezone_resolver_.get()) { |
116 timezone_resolver_.reset(new chromeos::TimeZoneResolver( | 128 timezone_resolver_.reset(new chromeos::TimeZoneResolver( |
117 g_browser_process->system_request_context(), | 129 g_browser_process->system_request_context(), |
118 chromeos::SimpleGeolocationProvider::DefaultGeolocationProviderURL(), | 130 chromeos::SimpleGeolocationProvider::DefaultGeolocationProviderURL(), |
119 base::Bind(&chromeos::system::ApplyTimeZone), | 131 base::Bind(&chromeos::system::ApplyTimeZone), |
120 base::Bind(&chromeos::DelayNetworkCall, | 132 base::Bind(&chromeos::DelayNetworkCall, |
121 base::TimeDelta::FromMilliseconds( | 133 base::TimeDelta::FromMilliseconds( |
122 chromeos::kDefaultNetworkRetryDelayMS)), | 134 chromeos::kDefaultNetworkRetryDelayMS)), |
123 g_browser_process->local_state())); | 135 g_browser_process->local_state())); |
(...skipping 12 matching lines...) Expand all Loading... | |
136 BrowserProcessPlatformPart::CreateBrowserPolicyConnector() { | 148 BrowserProcessPlatformPart::CreateBrowserPolicyConnector() { |
137 return scoped_ptr<policy::BrowserPolicyConnector>( | 149 return scoped_ptr<policy::BrowserPolicyConnector>( |
138 new policy::BrowserPolicyConnectorChromeOS()); | 150 new policy::BrowserPolicyConnectorChromeOS()); |
139 } | 151 } |
140 | 152 |
141 void BrowserProcessPlatformPart::CreateProfileHelper() { | 153 void BrowserProcessPlatformPart::CreateProfileHelper() { |
142 DCHECK(!created_profile_helper_ && profile_helper_.get() == NULL); | 154 DCHECK(!created_profile_helper_ && profile_helper_.get() == NULL); |
143 created_profile_helper_ = true; | 155 created_profile_helper_ = true; |
144 profile_helper_.reset(new chromeos::ProfileHelper()); | 156 profile_helper_.reset(new chromeos::ProfileHelper()); |
145 } | 157 } |
OLD | NEW |