OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/chromeos/arc/arc_settings_service.h" | 5 #include "chrome/browser/chromeos/arc/arc_settings_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/browser_process.h" | |
13 #include "chrome/browser/chromeos/arc/arc_auth_service.h" | 14 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
15 #include "chrome/browser/chromeos/net/onc_utils.h" | |
16 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | |
14 #include "chrome/browser/chromeos/settings/cros_settings.h" | 17 #include "chrome/browser/chromeos/settings/cros_settings.h" |
15 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
16 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
20 #include "chromeos/network/network_handler.h" | |
21 #include "chromeos/network/network_state.h" | |
22 #include "chromeos/network/network_state_handler.h" | |
23 #include "chromeos/network/network_state_handler_observer.h" | |
17 #include "chromeos/settings/cros_settings_names.h" | 24 #include "chromeos/settings/cros_settings_names.h" |
18 #include "chromeos/settings/timezone_settings.h" | 25 #include "chromeos/settings/timezone_settings.h" |
19 #include "components/arc/intent_helper/font_size_util.h" | 26 #include "components/arc/intent_helper/font_size_util.h" |
20 #include "components/prefs/pref_change_registrar.h" | 27 #include "components/prefs/pref_change_registrar.h" |
21 #include "components/prefs/pref_service.h" | 28 #include "components/prefs/pref_service.h" |
29 #include "components/proxy_config/pref_proxy_config_tracker_impl.h" | |
22 #include "components/proxy_config/proxy_config_dictionary.h" | 30 #include "components/proxy_config/proxy_config_dictionary.h" |
23 #include "components/proxy_config/proxy_config_pref_names.h" | 31 #include "components/proxy_config/proxy_config_pref_names.h" |
24 #include "device/bluetooth/bluetooth_adapter.h" | 32 #include "device/bluetooth/bluetooth_adapter.h" |
25 #include "device/bluetooth/bluetooth_adapter_factory.h" | 33 #include "device/bluetooth/bluetooth_adapter_factory.h" |
26 #include "net/proxy/proxy_config.h" | 34 #include "net/proxy/proxy_config.h" |
27 | 35 |
28 using ::chromeos::CrosSettings; | 36 using ::chromeos::CrosSettings; |
29 using ::chromeos::system::TimezoneSettings; | 37 using ::chromeos::system::TimezoneSettings; |
30 | 38 |
31 namespace { | 39 namespace { |
32 | 40 |
33 bool GetHttpProxyServer(const ProxyConfigDictionary& proxy_config_dict, | 41 bool GetHttpProxyServer(const ProxyConfigDictionary* proxy_config_dict, |
34 std::string* host, | 42 std::string* host, |
35 int* port) { | 43 int* port) { |
36 std::string proxy_rules_string; | 44 std::string proxy_rules_string; |
37 if (!proxy_config_dict.GetProxyServer(&proxy_rules_string)) | 45 if (!proxy_config_dict->GetProxyServer(&proxy_rules_string)) |
38 return false; | 46 return false; |
39 | 47 |
40 net::ProxyConfig::ProxyRules proxy_rules; | 48 net::ProxyConfig::ProxyRules proxy_rules; |
41 proxy_rules.ParseFromString(proxy_rules_string); | 49 proxy_rules.ParseFromString(proxy_rules_string); |
42 | 50 |
43 const net::ProxyList* proxy_list = nullptr; | 51 const net::ProxyList* proxy_list = nullptr; |
44 if (proxy_rules.type == net::ProxyConfig::ProxyRules::TYPE_SINGLE_PROXY) { | 52 if (proxy_rules.type == net::ProxyConfig::ProxyRules::TYPE_SINGLE_PROXY) { |
45 proxy_list = &proxy_rules.single_proxies; | 53 proxy_list = &proxy_rules.single_proxies; |
46 } else if (proxy_rules.type == | 54 } else if (proxy_rules.type == |
47 net::ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME) { | 55 net::ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME) { |
(...skipping 10 matching lines...) Expand all Loading... | |
58 | 66 |
59 } // namespace | 67 } // namespace |
60 | 68 |
61 namespace arc { | 69 namespace arc { |
62 | 70 |
63 // Listens to changes for select Chrome settings (prefs) that Android cares | 71 // Listens to changes for select Chrome settings (prefs) that Android cares |
64 // about and sends the new values to Android to keep the state in sync. | 72 // about and sends the new values to Android to keep the state in sync. |
65 class ArcSettingsServiceImpl | 73 class ArcSettingsServiceImpl |
66 : public chromeos::system::TimezoneSettings::Observer, | 74 : public chromeos::system::TimezoneSettings::Observer, |
67 public device::BluetoothAdapter::Observer, | 75 public device::BluetoothAdapter::Observer, |
68 public ArcAuthService::Observer { | 76 public ArcAuthService::Observer, |
77 public chromeos::NetworkStateHandlerObserver { | |
69 public: | 78 public: |
70 explicit ArcSettingsServiceImpl(ArcBridgeService* arc_bridge_service); | 79 explicit ArcSettingsServiceImpl(ArcBridgeService* arc_bridge_service); |
71 ~ArcSettingsServiceImpl() override; | 80 ~ArcSettingsServiceImpl() override; |
72 | 81 |
73 // Called when a Chrome pref we have registered an observer for has changed. | 82 // Called when a Chrome pref we have registered an observer for has changed. |
74 // Obtains the new pref value and sends it to Android. | 83 // Obtains the new pref value and sends it to Android. |
75 void OnPrefChanged(const std::string& pref_name) const; | 84 void OnPrefChanged(const std::string& pref_name) const; |
76 | 85 |
77 // TimezoneSettings::Observer: | 86 // TimezoneSettings::Observer: |
78 void TimezoneChanged(const icu::TimeZone& timezone) override; | 87 void TimezoneChanged(const icu::TimeZone& timezone) override; |
79 | 88 |
80 // BluetoothAdapter::Observer: | 89 // BluetoothAdapter::Observer: |
81 void AdapterPoweredChanged(device::BluetoothAdapter* adapter, | 90 void AdapterPoweredChanged(device::BluetoothAdapter* adapter, |
82 bool powered) override; | 91 bool powered) override; |
83 | 92 |
84 // ArcAuthService::Observer: | 93 // ArcAuthService::Observer: |
85 void OnInitialStart() override; | 94 void OnInitialStart() override; |
86 | 95 |
96 // NetworkStateHandlerObserver: | |
97 void DefaultNetworkChanged(const chromeos::NetworkState* network) override; | |
98 | |
87 private: | 99 private: |
88 // Registers to observe changes for Chrome settings we care about. | 100 // Registers to observe changes for Chrome settings we care about. |
89 void StartObservingSettingsChanges(); | 101 void StartObservingSettingsChanges(); |
90 | 102 |
91 // Stops listening for Chrome settings changes. | 103 // Stops listening for Chrome settings changes. |
92 void StopObservingSettingsChanges(); | 104 void StopObservingSettingsChanges(); |
93 | 105 |
94 // Retrieves Chrome's state for the settings that need to be synced on each | 106 // Retrieves Chrome's state for the settings that need to be synced on each |
95 // Android boot and send it to Android. | 107 // Android boot and send it to Android. |
96 void SyncRuntimeSettings() const; | 108 void SyncRuntimeSettings() const; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
161 | 173 |
162 void ArcSettingsServiceImpl::StartObservingSettingsChanges() { | 174 void ArcSettingsServiceImpl::StartObservingSettingsChanges() { |
163 Profile* profile = ProfileManager::GetActiveUserProfile(); | 175 Profile* profile = ProfileManager::GetActiveUserProfile(); |
164 registrar_.Init(profile->GetPrefs()); | 176 registrar_.Init(profile->GetPrefs()); |
165 | 177 |
166 AddPrefToObserve(prefs::kWebKitDefaultFixedFontSize); | 178 AddPrefToObserve(prefs::kWebKitDefaultFixedFontSize); |
167 AddPrefToObserve(prefs::kWebKitDefaultFontSize); | 179 AddPrefToObserve(prefs::kWebKitDefaultFontSize); |
168 AddPrefToObserve(prefs::kWebKitMinimumFontSize); | 180 AddPrefToObserve(prefs::kWebKitMinimumFontSize); |
169 AddPrefToObserve(prefs::kAccessibilitySpokenFeedbackEnabled); | 181 AddPrefToObserve(prefs::kAccessibilitySpokenFeedbackEnabled); |
170 AddPrefToObserve(prefs::kUse24HourClock); | 182 AddPrefToObserve(prefs::kUse24HourClock); |
183 AddPrefToObserve(prefs::kArcBackupRestoreEnabled); | |
171 AddPrefToObserve(proxy_config::prefs::kProxy); | 184 AddPrefToObserve(proxy_config::prefs::kProxy); |
172 AddPrefToObserve(prefs::kArcBackupRestoreEnabled); | 185 AddPrefToObserve(prefs::kDeviceOpenNetworkConfiguration); |
186 AddPrefToObserve(prefs::kOpenNetworkConfiguration); | |
173 | 187 |
174 reporting_consent_subscription_ = CrosSettings::Get()->AddSettingsObserver( | 188 reporting_consent_subscription_ = CrosSettings::Get()->AddSettingsObserver( |
175 chromeos::kStatsReportingPref, | 189 chromeos::kStatsReportingPref, |
176 base::Bind(&ArcSettingsServiceImpl::SyncReportingConsent, | 190 base::Bind(&ArcSettingsServiceImpl::SyncReportingConsent, |
177 base::Unretained(this))); | 191 base::Unretained(this))); |
178 | 192 |
179 TimezoneSettings::GetInstance()->AddObserver(this); | 193 TimezoneSettings::GetInstance()->AddObserver(this); |
180 | 194 |
181 if (device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable()) { | 195 if (device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable()) { |
182 device::BluetoothAdapterFactory::GetAdapter( | 196 device::BluetoothAdapterFactory::GetAdapter( |
183 base::Bind(&ArcSettingsServiceImpl::OnBluetoothAdapterInitialized, | 197 base::Bind(&ArcSettingsServiceImpl::OnBluetoothAdapterInitialized, |
184 weak_factory_.GetWeakPtr())); | 198 weak_factory_.GetWeakPtr())); |
185 } | 199 } |
200 | |
201 chromeos::NetworkHandler::Get()->network_state_handler()->AddObserver( | |
202 this, FROM_HERE); | |
186 } | 203 } |
187 | 204 |
188 void ArcSettingsServiceImpl::OnBluetoothAdapterInitialized( | 205 void ArcSettingsServiceImpl::OnBluetoothAdapterInitialized( |
189 scoped_refptr<device::BluetoothAdapter> adapter) { | 206 scoped_refptr<device::BluetoothAdapter> adapter) { |
190 DCHECK(adapter); | 207 DCHECK(adapter); |
191 bluetooth_adapter_ = adapter; | 208 bluetooth_adapter_ = adapter; |
192 bluetooth_adapter_->AddObserver(this); | 209 bluetooth_adapter_->AddObserver(this); |
193 | 210 |
194 AdapterPoweredChanged(adapter.get(), adapter->IsPowered()); | 211 AdapterPoweredChanged(adapter.get(), adapter->IsPowered()); |
195 } | 212 } |
(...skipping 22 matching lines...) Expand all Loading... | |
218 void ArcSettingsServiceImpl::SyncInitialSettings() const { | 235 void ArcSettingsServiceImpl::SyncInitialSettings() const { |
219 SyncBackupEnabled(); | 236 SyncBackupEnabled(); |
220 SyncLocationServiceEnabled(); | 237 SyncLocationServiceEnabled(); |
221 } | 238 } |
222 | 239 |
223 void ArcSettingsServiceImpl::StopObservingSettingsChanges() { | 240 void ArcSettingsServiceImpl::StopObservingSettingsChanges() { |
224 registrar_.RemoveAll(); | 241 registrar_.RemoveAll(); |
225 reporting_consent_subscription_.reset(); | 242 reporting_consent_subscription_.reset(); |
226 | 243 |
227 TimezoneSettings::GetInstance()->RemoveObserver(this); | 244 TimezoneSettings::GetInstance()->RemoveObserver(this); |
245 chromeos::NetworkHandler::Get()->network_state_handler()->RemoveObserver( | |
246 this, FROM_HERE); | |
228 } | 247 } |
229 | 248 |
230 void ArcSettingsServiceImpl::AddPrefToObserve(const std::string& pref_name) { | 249 void ArcSettingsServiceImpl::AddPrefToObserve(const std::string& pref_name) { |
231 registrar_.Add(pref_name, base::Bind(&ArcSettingsServiceImpl::OnPrefChanged, | 250 registrar_.Add(pref_name, base::Bind(&ArcSettingsServiceImpl::OnPrefChanged, |
232 base::Unretained(this))); | 251 base::Unretained(this))); |
233 } | 252 } |
234 | 253 |
235 void ArcSettingsServiceImpl::AdapterPoweredChanged( | 254 void ArcSettingsServiceImpl::AdapterPoweredChanged( |
236 device::BluetoothAdapter* adapter, | 255 device::BluetoothAdapter* adapter, |
237 bool powered) { | 256 bool powered) { |
238 base::DictionaryValue extras; | 257 base::DictionaryValue extras; |
239 extras.SetBoolean("enable", powered); | 258 extras.SetBoolean("enable", powered); |
240 SendSettingsBroadcast("org.chromium.arc.intent_helper.SET_BLUETOOTH_STATE", | 259 SendSettingsBroadcast("org.chromium.arc.intent_helper.SET_BLUETOOTH_STATE", |
241 extras); | 260 extras); |
242 } | 261 } |
243 | 262 |
244 void ArcSettingsServiceImpl::OnPrefChanged(const std::string& pref_name) const { | 263 void ArcSettingsServiceImpl::OnPrefChanged(const std::string& pref_name) const { |
245 if (pref_name == prefs::kAccessibilitySpokenFeedbackEnabled) { | 264 if (pref_name == prefs::kAccessibilitySpokenFeedbackEnabled) { |
246 SyncSpokenFeedbackEnabled(); | 265 SyncSpokenFeedbackEnabled(); |
247 } else if (pref_name == prefs::kWebKitDefaultFixedFontSize || | 266 } else if (pref_name == prefs::kWebKitDefaultFixedFontSize || |
248 pref_name == prefs::kWebKitDefaultFontSize || | 267 pref_name == prefs::kWebKitDefaultFontSize || |
249 pref_name == prefs::kWebKitMinimumFontSize) { | 268 pref_name == prefs::kWebKitMinimumFontSize) { |
250 SyncFontSize(); | 269 SyncFontSize(); |
251 } else if (pref_name == prefs::kUse24HourClock) { | 270 } else if (pref_name == prefs::kUse24HourClock) { |
252 SyncUse24HourClock(); | 271 SyncUse24HourClock(); |
253 } else if (pref_name == proxy_config::prefs::kProxy) { | 272 } else if (pref_name == proxy_config::prefs::kProxy) { |
254 SyncProxySettings(); | 273 SyncProxySettings(); |
274 } else if (pref_name == prefs::kDeviceOpenNetworkConfiguration || | |
275 pref_name == prefs::kOpenNetworkConfiguration) { | |
276 // Do not update proxy settings if kProxy pref is applied. | |
stevenjb
2016/09/06 15:49:06
Rephrase this: // Only update proxy settings if kP
Polina Bondarenko
2016/09/06 19:38:46
Fixed to: "Only update proxy settings if kProxy pr
| |
277 net::ProxyConfig config; | |
278 Profile* profile = ProfileManager::GetActiveUserProfile(); | |
279 if (!PrefProxyConfigTrackerImpl::PrefPrecedes( | |
280 PrefProxyConfigTrackerImpl::ReadPrefConfig(profile->GetPrefs(), | |
281 &config))) { | |
282 SyncProxySettings(); | |
283 } | |
255 } else { | 284 } else { |
256 LOG(ERROR) << "Unknown pref changed."; | 285 LOG(ERROR) << "Unknown pref changed."; |
257 } | 286 } |
258 } | 287 } |
259 | 288 |
260 void ArcSettingsServiceImpl::TimezoneChanged(const icu::TimeZone& timezone) { | 289 void ArcSettingsServiceImpl::TimezoneChanged(const icu::TimeZone& timezone) { |
261 SyncTimeZone(); | 290 SyncTimeZone(); |
262 } | 291 } |
263 | 292 |
264 int ArcSettingsServiceImpl::GetIntegerPref(const std::string& pref_name) const { | 293 int ArcSettingsServiceImpl::GetIntegerPref(const std::string& pref_name) const { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 bool use24HourClock = false; | 371 bool use24HourClock = false; |
343 bool value_exists = pref->GetValue()->GetAsBoolean(&use24HourClock); | 372 bool value_exists = pref->GetValue()->GetAsBoolean(&use24HourClock); |
344 DCHECK(value_exists); | 373 DCHECK(value_exists); |
345 base::DictionaryValue extras; | 374 base::DictionaryValue extras; |
346 extras.SetBoolean("use24HourClock", use24HourClock); | 375 extras.SetBoolean("use24HourClock", use24HourClock); |
347 SendSettingsBroadcast("org.chromium.arc.intent_helper.SET_USE_24_HOUR_CLOCK", | 376 SendSettingsBroadcast("org.chromium.arc.intent_helper.SET_USE_24_HOUR_CLOCK", |
348 extras); | 377 extras); |
349 } | 378 } |
350 | 379 |
351 void ArcSettingsServiceImpl::SyncProxySettings() const { | 380 void ArcSettingsServiceImpl::SyncProxySettings() const { |
352 const PrefService::Preference* const pref = | 381 std::unique_ptr<ProxyConfigDictionary> proxy_config_dict = |
353 registrar_.prefs()->FindPreference(proxy_config::prefs::kProxy); | 382 chromeos::ProxyConfigServiceImpl::GetDefaultProxyConfigDictionary( |
354 const base::DictionaryValue* proxy_config_value; | 383 ProfileManager::GetActiveUserProfile()->GetPrefs()); |
355 bool value_exists = pref->GetValue()->GetAsDictionary(&proxy_config_value); | 384 if (!proxy_config_dict) |
356 DCHECK(value_exists); | 385 return; |
357 | |
358 ProxyConfigDictionary proxy_config_dict(proxy_config_value); | |
359 | 386 |
360 ProxyPrefs::ProxyMode mode; | 387 ProxyPrefs::ProxyMode mode; |
361 if (!proxy_config_dict.GetMode(&mode)) | 388 if (!proxy_config_dict || !proxy_config_dict->GetMode(&mode)) |
362 mode = ProxyPrefs::MODE_DIRECT; | 389 mode = ProxyPrefs::MODE_DIRECT; |
363 | 390 |
364 base::DictionaryValue extras; | 391 base::DictionaryValue extras; |
365 extras.SetString("mode", ProxyPrefs::ProxyModeToString(mode)); | 392 extras.SetString("mode", ProxyPrefs::ProxyModeToString(mode)); |
366 | 393 |
367 switch (mode) { | 394 switch (mode) { |
368 case ProxyPrefs::MODE_DIRECT: | 395 case ProxyPrefs::MODE_DIRECT: |
369 break; | 396 break; |
370 case ProxyPrefs::MODE_SYSTEM: | 397 case ProxyPrefs::MODE_SYSTEM: |
371 VLOG(1) << "The system mode is not translated."; | 398 VLOG(1) << "The system mode is not translated."; |
372 return; | 399 return; |
373 case ProxyPrefs::MODE_AUTO_DETECT: | 400 case ProxyPrefs::MODE_AUTO_DETECT: |
374 extras.SetString("pacUrl", "http://wpad/wpad.dat"); | 401 extras.SetString("pacUrl", "http://wpad/wpad.dat"); |
375 break; | 402 break; |
376 case ProxyPrefs::MODE_PAC_SCRIPT: { | 403 case ProxyPrefs::MODE_PAC_SCRIPT: { |
377 std::string pac_url; | 404 std::string pac_url; |
378 if (!proxy_config_dict.GetPacUrl(&pac_url)) { | 405 if (!proxy_config_dict->GetPacUrl(&pac_url)) { |
379 LOG(ERROR) << "No pac URL for pac_script proxy mode."; | 406 LOG(ERROR) << "No pac URL for pac_script proxy mode."; |
380 return; | 407 return; |
381 } | 408 } |
382 extras.SetString("pacUrl", pac_url); | 409 extras.SetString("pacUrl", pac_url); |
383 break; | 410 break; |
384 } | 411 } |
385 case ProxyPrefs::MODE_FIXED_SERVERS: { | 412 case ProxyPrefs::MODE_FIXED_SERVERS: { |
386 std::string host; | 413 std::string host; |
387 int port = 0; | 414 int port = 0; |
388 if (!GetHttpProxyServer(proxy_config_dict, &host, &port)) { | 415 if (!GetHttpProxyServer(proxy_config_dict.get(), &host, &port)) { |
389 LOG(ERROR) << "No Http proxy server is sent."; | 416 LOG(ERROR) << "No Http proxy server is sent."; |
390 return; | 417 return; |
391 } | 418 } |
392 extras.SetString("host", host); | 419 extras.SetString("host", host); |
393 extras.SetInteger("port", port); | 420 extras.SetInteger("port", port); |
394 | 421 |
395 std::string bypass_list; | 422 std::string bypass_list; |
396 if (proxy_config_dict.GetBypassList(&bypass_list) && | 423 if (proxy_config_dict->GetBypassList(&bypass_list) && |
397 !bypass_list.empty()) { | 424 !bypass_list.empty()) { |
398 extras.SetString("bypassList", bypass_list); | 425 extras.SetString("bypassList", bypass_list); |
399 } | 426 } |
400 break; | 427 break; |
401 } | 428 } |
402 default: | 429 default: |
403 LOG(ERROR) << "Incorrect proxy mode."; | 430 LOG(ERROR) << "Incorrect proxy mode."; |
404 return; | 431 return; |
405 } | 432 } |
406 | 433 |
(...skipping 24 matching lines...) Expand all Loading... | |
431 bool write_success = base::JSONWriter::Write(extras, &extras_json); | 458 bool write_success = base::JSONWriter::Write(extras, &extras_json); |
432 DCHECK(write_success); | 459 DCHECK(write_success); |
433 | 460 |
434 if (arc_bridge_service_->intent_helper()->version() >= 1) { | 461 if (arc_bridge_service_->intent_helper()->version() >= 1) { |
435 arc_bridge_service_->intent_helper()->instance()->SendBroadcast( | 462 arc_bridge_service_->intent_helper()->instance()->SendBroadcast( |
436 action, "org.chromium.arc.intent_helper", | 463 action, "org.chromium.arc.intent_helper", |
437 "org.chromium.arc.intent_helper.SettingsReceiver", extras_json); | 464 "org.chromium.arc.intent_helper.SettingsReceiver", extras_json); |
438 } | 465 } |
439 } | 466 } |
440 | 467 |
468 void ArcSettingsServiceImpl::DefaultNetworkChanged( | |
469 const chromeos::NetworkState* network) { | |
470 // kProxy pref and ONC policy have more priority than the default network | |
471 // update. | |
472 net::ProxyConfig config; | |
473 Profile* profile = ProfileManager::GetActiveUserProfile(); | |
474 if (!chromeos::onc::HasPolicyForNetwork( | |
475 profile->GetPrefs(), g_browser_process->local_state(), *network) && | |
476 !PrefProxyConfigTrackerImpl::PrefPrecedes( | |
477 PrefProxyConfigTrackerImpl::ReadPrefConfig(profile->GetPrefs(), | |
478 &config))) { | |
stevenjb
2016/09/06 15:49:06
Since we call PrefPrecedes twice, ignoring config,
Polina Bondarenko
2016/09/06 19:38:46
Wrapped into a local function.
| |
479 SyncProxySettings(); | |
480 } | |
481 } | |
482 | |
441 ArcSettingsService::ArcSettingsService(ArcBridgeService* bridge_service) | 483 ArcSettingsService::ArcSettingsService(ArcBridgeService* bridge_service) |
442 : ArcService(bridge_service) { | 484 : ArcService(bridge_service) { |
443 arc_bridge_service()->intent_helper()->AddObserver(this); | 485 arc_bridge_service()->intent_helper()->AddObserver(this); |
444 } | 486 } |
445 | 487 |
446 ArcSettingsService::~ArcSettingsService() { | 488 ArcSettingsService::~ArcSettingsService() { |
447 arc_bridge_service()->intent_helper()->RemoveObserver(this); | 489 arc_bridge_service()->intent_helper()->RemoveObserver(this); |
448 } | 490 } |
449 | 491 |
450 void ArcSettingsService::OnInstanceReady() { | 492 void ArcSettingsService::OnInstanceReady() { |
451 impl_.reset(new ArcSettingsServiceImpl(arc_bridge_service())); | 493 impl_.reset(new ArcSettingsServiceImpl(arc_bridge_service())); |
452 } | 494 } |
453 | 495 |
454 void ArcSettingsService::OnInstanceClosed() { | 496 void ArcSettingsService::OnInstanceClosed() { |
455 impl_.reset(); | 497 impl_.reset(); |
456 } | 498 } |
457 | 499 |
458 } // namespace arc | 500 } // namespace arc |
OLD | NEW |