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 // This is a callable object to mimic chromeos::DelayNetworkCall | |
31 class DelayNetworkCallWithDelay { | |
Bernhard Bauer
2015/01/05 10:22:32
Could you do this with a static method DelayNetwor
Alexander Alekseev
2015/01/15 18:59:02
Done.
| |
32 public: | |
33 explicit DelayNetworkCallWithDelay(base::TimeDelta delay) : delay_(delay) {} | |
34 | |
35 void Run(const base::Closure& callback) { | |
36 chromeos::DelayNetworkCall(callback, delay_); | |
37 } | |
38 | |
39 private: | |
40 const base::TimeDelta delay_; | |
41 DISALLOW_COPY_AND_ASSIGN(DelayNetworkCallWithDelay); | |
42 }; | |
43 | |
44 } // anonymous namespace | |
45 | |
25 BrowserProcessPlatformPart::BrowserProcessPlatformPart() | 46 BrowserProcessPlatformPart::BrowserProcessPlatformPart() |
26 : created_profile_helper_(false) { | 47 : created_profile_helper_(false) { |
27 } | 48 } |
28 | 49 |
29 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() { | 50 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() { |
30 } | 51 } |
31 | 52 |
32 void BrowserProcessPlatformPart::InitializeAutomaticRebootManager() { | 53 void BrowserProcessPlatformPart::InitializeAutomaticRebootManager() { |
33 DCHECK(!automatic_reboot_manager_); | 54 DCHECK(!automatic_reboot_manager_); |
34 | 55 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 CreateProfileHelper(); | 121 CreateProfileHelper(); |
101 return profile_helper_.get(); | 122 return profile_helper_.get(); |
102 } | 123 } |
103 | 124 |
104 policy::BrowserPolicyConnectorChromeOS* | 125 policy::BrowserPolicyConnectorChromeOS* |
105 BrowserProcessPlatformPart::browser_policy_connector_chromeos() { | 126 BrowserProcessPlatformPart::browser_policy_connector_chromeos() { |
106 return static_cast<policy::BrowserPolicyConnectorChromeOS*>( | 127 return static_cast<policy::BrowserPolicyConnectorChromeOS*>( |
107 g_browser_process->browser_policy_connector()); | 128 g_browser_process->browser_policy_connector()); |
108 } | 129 } |
109 | 130 |
131 chromeos::TimeZoneResolver* BrowserProcessPlatformPart::timezone_resolver() { | |
132 if (!timezone_resolver_.get()) { | |
133 timezone_resolver_.reset(new chromeos::TimeZoneResolver( | |
134 g_browser_process->system_request_context(), | |
135 chromeos::SimpleGeolocationProvider::DefaultGeolocationProviderURL(), | |
136 base::Bind(&chromeos::system::ApplyTimeZone), | |
137 base::Bind(&DelayNetworkCallWithDelay::Run, | |
138 base::Owned(new DelayNetworkCallWithDelay( | |
139 base::TimeDelta::FromMilliseconds( | |
140 chromeos::kDefaultNetworkRetryDelayMS)))))); | |
141 } | |
142 return timezone_resolver_.get(); | |
143 } | |
144 | |
110 void BrowserProcessPlatformPart::StartTearDown() { | 145 void BrowserProcessPlatformPart::StartTearDown() { |
111 profile_helper_.reset(); | 146 profile_helper_.reset(); |
112 } | 147 } |
113 | 148 |
114 scoped_ptr<policy::BrowserPolicyConnector> | 149 scoped_ptr<policy::BrowserPolicyConnector> |
115 BrowserProcessPlatformPart::CreateBrowserPolicyConnector() { | 150 BrowserProcessPlatformPart::CreateBrowserPolicyConnector() { |
116 return scoped_ptr<policy::BrowserPolicyConnector>( | 151 return scoped_ptr<policy::BrowserPolicyConnector>( |
117 new policy::BrowserPolicyConnectorChromeOS()); | 152 new policy::BrowserPolicyConnectorChromeOS()); |
118 } | 153 } |
119 | 154 |
120 void BrowserProcessPlatformPart::CreateProfileHelper() { | 155 void BrowserProcessPlatformPart::CreateProfileHelper() { |
121 DCHECK(!created_profile_helper_ && profile_helper_.get() == NULL); | 156 DCHECK(!created_profile_helper_ && profile_helper_.get() == NULL); |
122 created_profile_helper_ = true; | 157 created_profile_helper_ = true; |
123 profile_helper_.reset(new chromeos::ProfileHelper()); | 158 profile_helper_.reset(new chromeos::ProfileHelper()); |
124 } | 159 } |
OLD | NEW |