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" | |
22 #include "components/session_manager/core/session_manager.h" | 25 #include "components/session_manager/core/session_manager.h" |
23 #include "components/user_manager/user_manager.h" | 26 #include "components/user_manager/user_manager.h" |
24 | 27 |
28 namespace { | |
29 | |
30 // We need DelayNetworkCall() with different order of arguments to be able to | |
sky
2015/01/20 16:47:30
Is there a reason you can't change the signature i
Alexander Alekseev
2015/01/22 18:55:22
Probably no.
Done.
| |
31 // bind the first argument. | |
32 void DelayNetworkCallWithDelay(base::TimeDelta delay, | |
33 const base::Closure& callback) { | |
34 chromeos::DelayNetworkCall(callback, delay); | |
35 } | |
36 | |
37 } // anonymous namespace | |
38 | |
25 BrowserProcessPlatformPart::BrowserProcessPlatformPart() | 39 BrowserProcessPlatformPart::BrowserProcessPlatformPart() |
26 : created_profile_helper_(false) { | 40 : created_profile_helper_(false) { |
27 } | 41 } |
28 | 42 |
29 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() { | 43 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() { |
30 } | 44 } |
31 | 45 |
32 void BrowserProcessPlatformPart::InitializeAutomaticRebootManager() { | 46 void BrowserProcessPlatformPart::InitializeAutomaticRebootManager() { |
33 DCHECK(!automatic_reboot_manager_); | 47 DCHECK(!automatic_reboot_manager_); |
34 | 48 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 CreateProfileHelper(); | 114 CreateProfileHelper(); |
101 return profile_helper_.get(); | 115 return profile_helper_.get(); |
102 } | 116 } |
103 | 117 |
104 policy::BrowserPolicyConnectorChromeOS* | 118 policy::BrowserPolicyConnectorChromeOS* |
105 BrowserProcessPlatformPart::browser_policy_connector_chromeos() { | 119 BrowserProcessPlatformPart::browser_policy_connector_chromeos() { |
106 return static_cast<policy::BrowserPolicyConnectorChromeOS*>( | 120 return static_cast<policy::BrowserPolicyConnectorChromeOS*>( |
107 g_browser_process->browser_policy_connector()); | 121 g_browser_process->browser_policy_connector()); |
108 } | 122 } |
109 | 123 |
124 chromeos::TimeZoneResolver* BrowserProcessPlatformPart::timezone_resolver() { | |
125 if (!timezone_resolver_.get()) { | |
126 timezone_resolver_.reset(new chromeos::TimeZoneResolver( | |
127 g_browser_process->system_request_context(), | |
128 chromeos::SimpleGeolocationProvider::DefaultGeolocationProviderURL(), | |
129 base::Bind(&chromeos::system::ApplyTimeZone), | |
130 base::Bind(&DelayNetworkCallWithDelay, | |
131 base::TimeDelta::FromMilliseconds( | |
132 chromeos::kDefaultNetworkRetryDelayMS)))); | |
133 } | |
134 return timezone_resolver_.get(); | |
135 } | |
136 | |
110 void BrowserProcessPlatformPart::StartTearDown() { | 137 void BrowserProcessPlatformPart::StartTearDown() { |
111 profile_helper_.reset(); | 138 profile_helper_.reset(); |
112 } | 139 } |
113 | 140 |
114 scoped_ptr<policy::BrowserPolicyConnector> | 141 scoped_ptr<policy::BrowserPolicyConnector> |
115 BrowserProcessPlatformPart::CreateBrowserPolicyConnector() { | 142 BrowserProcessPlatformPart::CreateBrowserPolicyConnector() { |
116 return scoped_ptr<policy::BrowserPolicyConnector>( | 143 return scoped_ptr<policy::BrowserPolicyConnector>( |
117 new policy::BrowserPolicyConnectorChromeOS()); | 144 new policy::BrowserPolicyConnectorChromeOS()); |
118 } | 145 } |
119 | 146 |
120 void BrowserProcessPlatformPart::CreateProfileHelper() { | 147 void BrowserProcessPlatformPart::CreateProfileHelper() { |
121 DCHECK(!created_profile_helper_ && profile_helper_.get() == NULL); | 148 DCHECK(!created_profile_helper_ && profile_helper_.get() == NULL); |
122 created_profile_helper_ = true; | 149 created_profile_helper_ = true; |
123 profile_helper_.reset(new chromeos::ProfileHelper()); | 150 profile_helper_.reset(new chromeos::ProfileHelper()); |
124 } | 151 } |
OLD | NEW |