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/intent_helper/arc_settings_service.h" | 5 #include "chrome/browser/chromeos/arc/intent_helper/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" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "components/proxy_config/proxy_config_pref_names.h" | 32 #include "components/proxy_config/proxy_config_pref_names.h" |
33 #include "device/bluetooth/bluetooth_adapter.h" | 33 #include "device/bluetooth/bluetooth_adapter.h" |
34 #include "device/bluetooth/bluetooth_adapter_factory.h" | 34 #include "device/bluetooth/bluetooth_adapter_factory.h" |
35 #include "net/proxy/proxy_config.h" | 35 #include "net/proxy/proxy_config.h" |
36 | 36 |
37 using ::chromeos::CrosSettings; | 37 using ::chromeos::CrosSettings; |
38 using ::chromeos::system::TimezoneSettings; | 38 using ::chromeos::system::TimezoneSettings; |
39 | 39 |
40 namespace { | 40 namespace { |
41 | 41 |
42 constexpr uint32_t kMinVersionForSendBroadcast = 1; | |
43 | |
44 bool GetHttpProxyServer(const ProxyConfigDictionary* proxy_config_dict, | 42 bool GetHttpProxyServer(const ProxyConfigDictionary* proxy_config_dict, |
45 std::string* host, | 43 std::string* host, |
46 int* port) { | 44 int* port) { |
47 std::string proxy_rules_string; | 45 std::string proxy_rules_string; |
48 if (!proxy_config_dict->GetProxyServer(&proxy_rules_string)) | 46 if (!proxy_config_dict->GetProxyServer(&proxy_rules_string)) |
49 return false; | 47 return false; |
50 | 48 |
51 net::ProxyConfig::ProxyRules proxy_rules; | 49 net::ProxyConfig::ProxyRules proxy_rules; |
52 proxy_rules.ParseFromString(proxy_rules_string); | 50 proxy_rules.ParseFromString(proxy_rules_string); |
53 | 51 |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 | 462 |
465 void ArcSettingsServiceImpl::SyncAccessibilityVirtualKeyboardEnabled() const { | 463 void ArcSettingsServiceImpl::SyncAccessibilityVirtualKeyboardEnabled() const { |
466 SendBoolPrefSettingsBroadcast( | 464 SendBoolPrefSettingsBroadcast( |
467 prefs::kAccessibilityVirtualKeyboardEnabled, | 465 prefs::kAccessibilityVirtualKeyboardEnabled, |
468 "org.chromium.arc.intent_helper.SET_SHOW_IME_WITH_HARD_KEYBOARD"); | 466 "org.chromium.arc.intent_helper.SET_SHOW_IME_WITH_HARD_KEYBOARD"); |
469 } | 467 } |
470 | 468 |
471 void ArcSettingsServiceImpl::SendSettingsBroadcast( | 469 void ArcSettingsServiceImpl::SendSettingsBroadcast( |
472 const std::string& action, | 470 const std::string& action, |
473 const base::DictionaryValue& extras) const { | 471 const base::DictionaryValue& extras) const { |
474 auto* instance = arc_bridge_service_->intent_helper()->GetInstanceForMethod( | 472 auto* instance = ARC_GET_INSTANCE_FOR_METHOD( |
475 "SendBroadcast", kMinVersionForSendBroadcast); | 473 arc_bridge_service_->intent_helper(), SendBroadcast); |
476 if (!instance) | 474 if (!instance) |
477 return; | 475 return; |
478 std::string extras_json; | 476 std::string extras_json; |
479 bool write_success = base::JSONWriter::Write(extras, &extras_json); | 477 bool write_success = base::JSONWriter::Write(extras, &extras_json); |
480 DCHECK(write_success); | 478 DCHECK(write_success); |
481 | 479 |
482 instance->SendBroadcast(action, "org.chromium.arc.intent_helper", | 480 instance->SendBroadcast(action, "org.chromium.arc.intent_helper", |
483 "org.chromium.arc.intent_helper.SettingsReceiver", | 481 "org.chromium.arc.intent_helper.SettingsReceiver", |
484 extras_json); | 482 extras_json); |
485 } | 483 } |
(...skipping 18 matching lines...) Expand all Loading... |
504 | 502 |
505 void ArcSettingsService::OnInstanceReady() { | 503 void ArcSettingsService::OnInstanceReady() { |
506 impl_.reset(new ArcSettingsServiceImpl(arc_bridge_service())); | 504 impl_.reset(new ArcSettingsServiceImpl(arc_bridge_service())); |
507 } | 505 } |
508 | 506 |
509 void ArcSettingsService::OnInstanceClosed() { | 507 void ArcSettingsService::OnInstanceClosed() { |
510 impl_.reset(); | 508 impl_.reset(); |
511 } | 509 } |
512 | 510 |
513 } // namespace arc | 511 } // namespace arc |
OLD | NEW |