Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Side by Side Diff: chrome/browser/chromeos/arc/arc_settings_service.cc

Issue 2306673002: arc: update proxy settings from UI and ONC policy. (Closed)
Patch Set: Rebased Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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) {
48 proxy_list = proxy_rules.MapUrlSchemeToProxyList(url::kHttpScheme); 56 proxy_list = proxy_rules.MapUrlSchemeToProxyList(url::kHttpScheme);
49 } 57 }
50 if (!proxy_list || proxy_list->IsEmpty()) 58 if (!proxy_list || proxy_list->IsEmpty())
51 return false; 59 return false;
52 60
53 const net::ProxyServer& server = proxy_list->Get(); 61 const net::ProxyServer& server = proxy_list->Get();
54 *host = server.host_port_pair().host(); 62 *host = server.host_port_pair().host();
55 *port = server.host_port_pair().port(); 63 *port = server.host_port_pair().port();
56 return !host->empty() && *port; 64 return !host->empty() && *port;
57 } 65 }
58 66
67 // Returns whether kProxy pref proxy config is applied.
68 bool IsPrefProxyConfigApplied() {
69 net::ProxyConfig config;
70 Profile* profile = ProfileManager::GetActiveUserProfile();
71 return PrefProxyConfigTrackerImpl::PrefPrecedes(
72 PrefProxyConfigTrackerImpl::ReadPrefConfig(profile->GetPrefs(), &config));
73 }
74
59 } // namespace 75 } // namespace
60 76
61 namespace arc { 77 namespace arc {
62 78
63 // Listens to changes for select Chrome settings (prefs) that Android cares 79 // 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. 80 // about and sends the new values to Android to keep the state in sync.
65 class ArcSettingsServiceImpl 81 class ArcSettingsServiceImpl
66 : public chromeos::system::TimezoneSettings::Observer, 82 : public chromeos::system::TimezoneSettings::Observer,
67 public device::BluetoothAdapter::Observer, 83 public device::BluetoothAdapter::Observer,
68 public ArcAuthService::Observer { 84 public ArcAuthService::Observer,
85 public chromeos::NetworkStateHandlerObserver {
69 public: 86 public:
70 explicit ArcSettingsServiceImpl(ArcBridgeService* arc_bridge_service); 87 explicit ArcSettingsServiceImpl(ArcBridgeService* arc_bridge_service);
71 ~ArcSettingsServiceImpl() override; 88 ~ArcSettingsServiceImpl() override;
72 89
73 // Called when a Chrome pref we have registered an observer for has changed. 90 // Called when a Chrome pref we have registered an observer for has changed.
74 // Obtains the new pref value and sends it to Android. 91 // Obtains the new pref value and sends it to Android.
75 void OnPrefChanged(const std::string& pref_name) const; 92 void OnPrefChanged(const std::string& pref_name) const;
76 93
77 // TimezoneSettings::Observer: 94 // TimezoneSettings::Observer:
78 void TimezoneChanged(const icu::TimeZone& timezone) override; 95 void TimezoneChanged(const icu::TimeZone& timezone) override;
79 96
80 // BluetoothAdapter::Observer: 97 // BluetoothAdapter::Observer:
81 void AdapterPoweredChanged(device::BluetoothAdapter* adapter, 98 void AdapterPoweredChanged(device::BluetoothAdapter* adapter,
82 bool powered) override; 99 bool powered) override;
83 100
84 // ArcAuthService::Observer: 101 // ArcAuthService::Observer:
85 void OnInitialStart() override; 102 void OnInitialStart() override;
86 103
104 // NetworkStateHandlerObserver:
105 void DefaultNetworkChanged(const chromeos::NetworkState* network) override;
106
87 private: 107 private:
88 // Registers to observe changes for Chrome settings we care about. 108 // Registers to observe changes for Chrome settings we care about.
89 void StartObservingSettingsChanges(); 109 void StartObservingSettingsChanges();
90 110
91 // Stops listening for Chrome settings changes. 111 // Stops listening for Chrome settings changes.
92 void StopObservingSettingsChanges(); 112 void StopObservingSettingsChanges();
93 113
94 // Retrieves Chrome's state for the settings that need to be synced on each 114 // Retrieves Chrome's state for the settings that need to be synced on each
95 // Android boot and send it to Android. 115 // Android boot and send it to Android.
96 void SyncRuntimeSettings() const; 116 void SyncRuntimeSettings() const;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 181
162 void ArcSettingsServiceImpl::StartObservingSettingsChanges() { 182 void ArcSettingsServiceImpl::StartObservingSettingsChanges() {
163 Profile* profile = ProfileManager::GetActiveUserProfile(); 183 Profile* profile = ProfileManager::GetActiveUserProfile();
164 registrar_.Init(profile->GetPrefs()); 184 registrar_.Init(profile->GetPrefs());
165 185
166 AddPrefToObserve(prefs::kWebKitDefaultFixedFontSize); 186 AddPrefToObserve(prefs::kWebKitDefaultFixedFontSize);
167 AddPrefToObserve(prefs::kWebKitDefaultFontSize); 187 AddPrefToObserve(prefs::kWebKitDefaultFontSize);
168 AddPrefToObserve(prefs::kWebKitMinimumFontSize); 188 AddPrefToObserve(prefs::kWebKitMinimumFontSize);
169 AddPrefToObserve(prefs::kAccessibilitySpokenFeedbackEnabled); 189 AddPrefToObserve(prefs::kAccessibilitySpokenFeedbackEnabled);
170 AddPrefToObserve(prefs::kUse24HourClock); 190 AddPrefToObserve(prefs::kUse24HourClock);
191 AddPrefToObserve(prefs::kArcBackupRestoreEnabled);
171 AddPrefToObserve(proxy_config::prefs::kProxy); 192 AddPrefToObserve(proxy_config::prefs::kProxy);
172 AddPrefToObserve(prefs::kArcBackupRestoreEnabled); 193 AddPrefToObserve(prefs::kDeviceOpenNetworkConfiguration);
194 AddPrefToObserve(prefs::kOpenNetworkConfiguration);
173 195
174 reporting_consent_subscription_ = CrosSettings::Get()->AddSettingsObserver( 196 reporting_consent_subscription_ = CrosSettings::Get()->AddSettingsObserver(
175 chromeos::kStatsReportingPref, 197 chromeos::kStatsReportingPref,
176 base::Bind(&ArcSettingsServiceImpl::SyncReportingConsent, 198 base::Bind(&ArcSettingsServiceImpl::SyncReportingConsent,
177 base::Unretained(this))); 199 base::Unretained(this)));
178 200
179 TimezoneSettings::GetInstance()->AddObserver(this); 201 TimezoneSettings::GetInstance()->AddObserver(this);
180 202
181 if (device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable()) { 203 if (device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable()) {
182 device::BluetoothAdapterFactory::GetAdapter( 204 device::BluetoothAdapterFactory::GetAdapter(
183 base::Bind(&ArcSettingsServiceImpl::OnBluetoothAdapterInitialized, 205 base::Bind(&ArcSettingsServiceImpl::OnBluetoothAdapterInitialized,
184 weak_factory_.GetWeakPtr())); 206 weak_factory_.GetWeakPtr()));
185 } 207 }
208
209 chromeos::NetworkHandler::Get()->network_state_handler()->AddObserver(
210 this, FROM_HERE);
186 } 211 }
187 212
188 void ArcSettingsServiceImpl::OnBluetoothAdapterInitialized( 213 void ArcSettingsServiceImpl::OnBluetoothAdapterInitialized(
189 scoped_refptr<device::BluetoothAdapter> adapter) { 214 scoped_refptr<device::BluetoothAdapter> adapter) {
190 DCHECK(adapter); 215 DCHECK(adapter);
191 bluetooth_adapter_ = adapter; 216 bluetooth_adapter_ = adapter;
192 bluetooth_adapter_->AddObserver(this); 217 bluetooth_adapter_->AddObserver(this);
193 218
194 AdapterPoweredChanged(adapter.get(), adapter->IsPowered()); 219 AdapterPoweredChanged(adapter.get(), adapter->IsPowered());
195 } 220 }
(...skipping 22 matching lines...) Expand all
218 void ArcSettingsServiceImpl::SyncInitialSettings() const { 243 void ArcSettingsServiceImpl::SyncInitialSettings() const {
219 SyncBackupEnabled(); 244 SyncBackupEnabled();
220 SyncLocationServiceEnabled(); 245 SyncLocationServiceEnabled();
221 } 246 }
222 247
223 void ArcSettingsServiceImpl::StopObservingSettingsChanges() { 248 void ArcSettingsServiceImpl::StopObservingSettingsChanges() {
224 registrar_.RemoveAll(); 249 registrar_.RemoveAll();
225 reporting_consent_subscription_.reset(); 250 reporting_consent_subscription_.reset();
226 251
227 TimezoneSettings::GetInstance()->RemoveObserver(this); 252 TimezoneSettings::GetInstance()->RemoveObserver(this);
253 chromeos::NetworkHandler::Get()->network_state_handler()->RemoveObserver(
254 this, FROM_HERE);
228 } 255 }
229 256
230 void ArcSettingsServiceImpl::AddPrefToObserve(const std::string& pref_name) { 257 void ArcSettingsServiceImpl::AddPrefToObserve(const std::string& pref_name) {
231 registrar_.Add(pref_name, base::Bind(&ArcSettingsServiceImpl::OnPrefChanged, 258 registrar_.Add(pref_name, base::Bind(&ArcSettingsServiceImpl::OnPrefChanged,
232 base::Unretained(this))); 259 base::Unretained(this)));
233 } 260 }
234 261
235 void ArcSettingsServiceImpl::AdapterPoweredChanged( 262 void ArcSettingsServiceImpl::AdapterPoweredChanged(
236 device::BluetoothAdapter* adapter, 263 device::BluetoothAdapter* adapter,
237 bool powered) { 264 bool powered) {
238 base::DictionaryValue extras; 265 base::DictionaryValue extras;
239 extras.SetBoolean("enable", powered); 266 extras.SetBoolean("enable", powered);
240 SendSettingsBroadcast("org.chromium.arc.intent_helper.SET_BLUETOOTH_STATE", 267 SendSettingsBroadcast("org.chromium.arc.intent_helper.SET_BLUETOOTH_STATE",
241 extras); 268 extras);
242 } 269 }
243 270
244 void ArcSettingsServiceImpl::OnPrefChanged(const std::string& pref_name) const { 271 void ArcSettingsServiceImpl::OnPrefChanged(const std::string& pref_name) const {
245 if (pref_name == prefs::kAccessibilitySpokenFeedbackEnabled) { 272 if (pref_name == prefs::kAccessibilitySpokenFeedbackEnabled) {
246 SyncSpokenFeedbackEnabled(); 273 SyncSpokenFeedbackEnabled();
247 } else if (pref_name == prefs::kWebKitDefaultFixedFontSize || 274 } else if (pref_name == prefs::kWebKitDefaultFixedFontSize ||
248 pref_name == prefs::kWebKitDefaultFontSize || 275 pref_name == prefs::kWebKitDefaultFontSize ||
249 pref_name == prefs::kWebKitMinimumFontSize) { 276 pref_name == prefs::kWebKitMinimumFontSize) {
250 SyncFontSize(); 277 SyncFontSize();
251 } else if (pref_name == prefs::kUse24HourClock) { 278 } else if (pref_name == prefs::kUse24HourClock) {
252 SyncUse24HourClock(); 279 SyncUse24HourClock();
253 } else if (pref_name == proxy_config::prefs::kProxy) { 280 } else if (pref_name == proxy_config::prefs::kProxy) {
254 SyncProxySettings(); 281 SyncProxySettings();
282 } else if (pref_name == prefs::kDeviceOpenNetworkConfiguration ||
283 pref_name == prefs::kOpenNetworkConfiguration) {
284 // Only update proxy settings if kProxy pref is not applied.
285 if (!IsPrefProxyConfigApplied())
stevenjb 2016/09/12 19:59:25 This looks like it is missing a { ??? But it shou
Polina Bondarenko 2016/09/12 20:49:05 Fixed, but one line "if" doesn't require curly bra
stevenjb 2016/09/12 21:21:44 It does if followed by } else { ... } (but better
286 SyncProxySettings();
255 } else { 287 } else {
256 LOG(ERROR) << "Unknown pref changed."; 288 LOG(ERROR) << "Unknown pref changed.";
257 } 289 }
258 } 290 }
259 291
260 void ArcSettingsServiceImpl::TimezoneChanged(const icu::TimeZone& timezone) { 292 void ArcSettingsServiceImpl::TimezoneChanged(const icu::TimeZone& timezone) {
261 SyncTimeZone(); 293 SyncTimeZone();
262 } 294 }
263 295
264 int ArcSettingsServiceImpl::GetIntegerPref(const std::string& pref_name) const { 296 int ArcSettingsServiceImpl::GetIntegerPref(const std::string& pref_name) const {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 bool use24HourClock = false; 374 bool use24HourClock = false;
343 bool value_exists = pref->GetValue()->GetAsBoolean(&use24HourClock); 375 bool value_exists = pref->GetValue()->GetAsBoolean(&use24HourClock);
344 DCHECK(value_exists); 376 DCHECK(value_exists);
345 base::DictionaryValue extras; 377 base::DictionaryValue extras;
346 extras.SetBoolean("use24HourClock", use24HourClock); 378 extras.SetBoolean("use24HourClock", use24HourClock);
347 SendSettingsBroadcast("org.chromium.arc.intent_helper.SET_USE_24_HOUR_CLOCK", 379 SendSettingsBroadcast("org.chromium.arc.intent_helper.SET_USE_24_HOUR_CLOCK",
348 extras); 380 extras);
349 } 381 }
350 382
351 void ArcSettingsServiceImpl::SyncProxySettings() const { 383 void ArcSettingsServiceImpl::SyncProxySettings() const {
352 const PrefService::Preference* const pref = 384 std::unique_ptr<ProxyConfigDictionary> proxy_config_dict =
353 registrar_.prefs()->FindPreference(proxy_config::prefs::kProxy); 385 chromeos::ProxyConfigServiceImpl::GetDefaultProxyConfigDictionary(
354 const base::DictionaryValue* proxy_config_value; 386 ProfileManager::GetActiveUserProfile()->GetPrefs());
355 bool value_exists = pref->GetValue()->GetAsDictionary(&proxy_config_value); 387 if (!proxy_config_dict)
356 DCHECK(value_exists); 388 return;
357
358 ProxyConfigDictionary proxy_config_dict(proxy_config_value);
359 389
360 ProxyPrefs::ProxyMode mode; 390 ProxyPrefs::ProxyMode mode;
361 if (!proxy_config_dict.GetMode(&mode)) 391 if (!proxy_config_dict || !proxy_config_dict->GetMode(&mode))
362 mode = ProxyPrefs::MODE_DIRECT; 392 mode = ProxyPrefs::MODE_DIRECT;
363 393
364 base::DictionaryValue extras; 394 base::DictionaryValue extras;
365 extras.SetString("mode", ProxyPrefs::ProxyModeToString(mode)); 395 extras.SetString("mode", ProxyPrefs::ProxyModeToString(mode));
366 396
367 switch (mode) { 397 switch (mode) {
368 case ProxyPrefs::MODE_DIRECT: 398 case ProxyPrefs::MODE_DIRECT:
369 break; 399 break;
370 case ProxyPrefs::MODE_SYSTEM: 400 case ProxyPrefs::MODE_SYSTEM:
371 VLOG(1) << "The system mode is not translated."; 401 VLOG(1) << "The system mode is not translated.";
372 return; 402 return;
373 case ProxyPrefs::MODE_AUTO_DETECT: 403 case ProxyPrefs::MODE_AUTO_DETECT:
374 extras.SetString("pacUrl", "http://wpad/wpad.dat"); 404 extras.SetString("pacUrl", "http://wpad/wpad.dat");
375 break; 405 break;
376 case ProxyPrefs::MODE_PAC_SCRIPT: { 406 case ProxyPrefs::MODE_PAC_SCRIPT: {
377 std::string pac_url; 407 std::string pac_url;
378 if (!proxy_config_dict.GetPacUrl(&pac_url)) { 408 if (!proxy_config_dict->GetPacUrl(&pac_url)) {
379 LOG(ERROR) << "No pac URL for pac_script proxy mode."; 409 LOG(ERROR) << "No pac URL for pac_script proxy mode.";
380 return; 410 return;
381 } 411 }
382 extras.SetString("pacUrl", pac_url); 412 extras.SetString("pacUrl", pac_url);
383 break; 413 break;
384 } 414 }
385 case ProxyPrefs::MODE_FIXED_SERVERS: { 415 case ProxyPrefs::MODE_FIXED_SERVERS: {
386 std::string host; 416 std::string host;
387 int port = 0; 417 int port = 0;
388 if (!GetHttpProxyServer(proxy_config_dict, &host, &port)) { 418 if (!GetHttpProxyServer(proxy_config_dict.get(), &host, &port)) {
389 LOG(ERROR) << "No Http proxy server is sent."; 419 LOG(ERROR) << "No Http proxy server is sent.";
390 return; 420 return;
391 } 421 }
392 extras.SetString("host", host); 422 extras.SetString("host", host);
393 extras.SetInteger("port", port); 423 extras.SetInteger("port", port);
394 424
395 std::string bypass_list; 425 std::string bypass_list;
396 if (proxy_config_dict.GetBypassList(&bypass_list) && 426 if (proxy_config_dict->GetBypassList(&bypass_list) &&
397 !bypass_list.empty()) { 427 !bypass_list.empty()) {
398 extras.SetString("bypassList", bypass_list); 428 extras.SetString("bypassList", bypass_list);
399 } 429 }
400 break; 430 break;
401 } 431 }
402 default: 432 default:
403 LOG(ERROR) << "Incorrect proxy mode."; 433 LOG(ERROR) << "Incorrect proxy mode.";
404 return; 434 return;
405 } 435 }
406 436
(...skipping 24 matching lines...) Expand all
431 bool write_success = base::JSONWriter::Write(extras, &extras_json); 461 bool write_success = base::JSONWriter::Write(extras, &extras_json);
432 DCHECK(write_success); 462 DCHECK(write_success);
433 463
434 if (arc_bridge_service_->intent_helper()->version() >= 1) { 464 if (arc_bridge_service_->intent_helper()->version() >= 1) {
435 arc_bridge_service_->intent_helper()->instance()->SendBroadcast( 465 arc_bridge_service_->intent_helper()->instance()->SendBroadcast(
436 action, "org.chromium.arc.intent_helper", 466 action, "org.chromium.arc.intent_helper",
437 "org.chromium.arc.intent_helper.SettingsReceiver", extras_json); 467 "org.chromium.arc.intent_helper.SettingsReceiver", extras_json);
438 } 468 }
439 } 469 }
440 470
471 void ArcSettingsServiceImpl::DefaultNetworkChanged(
472 const chromeos::NetworkState* network) {
473 // kProxy pref and ONC policy have more priority than the default network
474 // update.
475 Profile* profile = ProfileManager::GetActiveUserProfile();
476 if (!chromeos::onc::HasPolicyForNetwork(
477 profile->GetPrefs(), g_browser_process->local_state(), *network) &&
478 !IsPrefProxyConfigApplied()) {
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698