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/policy/browser_policy_connector_chromeos.h" | 16 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
16 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 17 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
17 #include "chrome/browser/chromeos/settings/cros_settings.h" | 18 #include "chrome/browser/chromeos/settings/cros_settings.h" |
18 #include "chrome/browser/chromeos/system/automatic_reboot_manager.h" | 19 #include "chrome/browser/chromeos/system/automatic_reboot_manager.h" |
19 #include "chrome/browser/chromeos/system/device_disabling_manager.h" | 20 #include "chrome/browser/chromeos/system/device_disabling_manager.h" |
20 #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" |
21 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chromeos/geolocation/simple_geolocation_provider.h" |
| 25 #include "chromeos/timezone/timezone_resolver.h" |
22 #include "components/session_manager/core/session_manager.h" | 26 #include "components/session_manager/core/session_manager.h" |
23 #include "components/user_manager/user_manager.h" | 27 #include "components/user_manager/user_manager.h" |
24 | 28 |
25 BrowserProcessPlatformPart::BrowserProcessPlatformPart() | 29 BrowserProcessPlatformPart::BrowserProcessPlatformPart() |
26 : created_profile_helper_(false) { | 30 : created_profile_helper_(false) { |
27 } | 31 } |
28 | 32 |
29 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() { | 33 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() { |
30 } | 34 } |
31 | 35 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 CreateProfileHelper(); | 104 CreateProfileHelper(); |
101 return profile_helper_.get(); | 105 return profile_helper_.get(); |
102 } | 106 } |
103 | 107 |
104 policy::BrowserPolicyConnectorChromeOS* | 108 policy::BrowserPolicyConnectorChromeOS* |
105 BrowserProcessPlatformPart::browser_policy_connector_chromeos() { | 109 BrowserProcessPlatformPart::browser_policy_connector_chromeos() { |
106 return static_cast<policy::BrowserPolicyConnectorChromeOS*>( | 110 return static_cast<policy::BrowserPolicyConnectorChromeOS*>( |
107 g_browser_process->browser_policy_connector()); | 111 g_browser_process->browser_policy_connector()); |
108 } | 112 } |
109 | 113 |
| 114 chromeos::TimeZoneResolver* BrowserProcessPlatformPart::GetTimezoneResolver() { |
| 115 if (!timezone_resolver_.get()) { |
| 116 timezone_resolver_.reset(new chromeos::TimeZoneResolver( |
| 117 g_browser_process->system_request_context(), |
| 118 chromeos::SimpleGeolocationProvider::DefaultGeolocationProviderURL(), |
| 119 base::Bind(&chromeos::system::ApplyTimeZone), |
| 120 base::Bind(&chromeos::DelayNetworkCall, |
| 121 base::TimeDelta::FromMilliseconds( |
| 122 chromeos::kDefaultNetworkRetryDelayMS)), |
| 123 g_browser_process->local_state())); |
| 124 } |
| 125 return timezone_resolver_.get(); |
| 126 } |
| 127 |
110 void BrowserProcessPlatformPart::StartTearDown() { | 128 void BrowserProcessPlatformPart::StartTearDown() { |
111 profile_helper_.reset(); | 129 profile_helper_.reset(); |
112 } | 130 } |
113 | 131 |
114 scoped_ptr<policy::BrowserPolicyConnector> | 132 scoped_ptr<policy::BrowserPolicyConnector> |
115 BrowserProcessPlatformPart::CreateBrowserPolicyConnector() { | 133 BrowserProcessPlatformPart::CreateBrowserPolicyConnector() { |
116 return scoped_ptr<policy::BrowserPolicyConnector>( | 134 return scoped_ptr<policy::BrowserPolicyConnector>( |
117 new policy::BrowserPolicyConnectorChromeOS()); | 135 new policy::BrowserPolicyConnectorChromeOS()); |
118 } | 136 } |
119 | 137 |
120 void BrowserProcessPlatformPart::CreateProfileHelper() { | 138 void BrowserProcessPlatformPart::CreateProfileHelper() { |
121 DCHECK(!created_profile_helper_ && profile_helper_.get() == NULL); | 139 DCHECK(!created_profile_helper_ && profile_helper_.get() == NULL); |
122 created_profile_helper_ = true; | 140 created_profile_helper_ = true; |
123 profile_helper_.reset(new chromeos::ProfileHelper()); | 141 profile_helper_.reset(new chromeos::ProfileHelper()); |
124 } | 142 } |
OLD | NEW |