OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/inspect_ui.h" | 5 #include "chrome/browser/ui/webui/inspect_ui.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 const Value* value = GetPrefValue(prefs::kDevToolsDiscoverUsbDevicesEnabled); | 775 const Value* value = GetPrefValue(prefs::kDevToolsDiscoverUsbDevicesEnabled); |
776 web_ui()->CallJavascriptFunction("updateDiscoverUsbDevicesEnabled", *value); | 776 web_ui()->CallJavascriptFunction("updateDiscoverUsbDevicesEnabled", *value); |
777 | 777 |
778 // Configure adb bridge. | 778 // Configure adb bridge. |
779 Profile* profile = Profile::FromWebUI(web_ui()); | 779 Profile* profile = Profile::FromWebUI(web_ui()); |
780 DevToolsAdbBridge* adb_bridge = | 780 DevToolsAdbBridge* adb_bridge = |
781 DevToolsAdbBridge::Factory::GetForProfile(profile); | 781 DevToolsAdbBridge::Factory::GetForProfile(profile); |
782 if (adb_bridge) { | 782 if (adb_bridge) { |
783 bool enabled = false; | 783 bool enabled = false; |
784 value->GetAsBoolean(&enabled); | 784 value->GetAsBoolean(&enabled); |
785 adb_bridge->set_discover_usb_devices(enabled); | 785 |
| 786 DevToolsAdbBridge::DeviceProviders device_providers; |
| 787 device_providers.push_back(AndroidDeviceProvider::GetAdbDeviceProvider()); |
| 788 |
| 789 if (enabled) { |
| 790 device_providers.push_back( |
| 791 AndroidDeviceProvider::GetUsbDeviceProvider(profile)); |
| 792 } |
| 793 |
| 794 adb_bridge->set_device_providers(device_providers); |
786 } | 795 } |
787 } | 796 } |
788 | 797 |
789 void InspectUI::UpdatePortForwardingEnabled() { | 798 void InspectUI::UpdatePortForwardingEnabled() { |
790 web_ui()->CallJavascriptFunction("updatePortForwardingEnabled", | 799 web_ui()->CallJavascriptFunction("updatePortForwardingEnabled", |
791 *GetPrefValue(prefs::kDevToolsPortForwardingEnabled)); | 800 *GetPrefValue(prefs::kDevToolsPortForwardingEnabled)); |
792 | 801 |
793 } | 802 } |
794 | 803 |
795 void InspectUI::UpdatePortForwardingConfig() { | 804 void InspectUI::UpdatePortForwardingConfig() { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 base::DictionaryValue default_config; | 836 base::DictionaryValue default_config; |
828 default_config.SetString( | 837 default_config.SetString( |
829 kPortForwardingDefaultPort, kPortForwardingDefaultLocation); | 838 kPortForwardingDefaultPort, kPortForwardingDefaultLocation); |
830 prefs->Set(prefs::kDevToolsPortForwardingConfig, default_config); | 839 prefs->Set(prefs::kDevToolsPortForwardingConfig, default_config); |
831 } | 840 } |
832 | 841 |
833 const base::Value* InspectUI::GetPrefValue(const char* name) { | 842 const base::Value* InspectUI::GetPrefValue(const char* name) { |
834 Profile* profile = Profile::FromWebUI(web_ui()); | 843 Profile* profile = Profile::FromWebUI(web_ui()); |
835 return profile->GetPrefs()->FindPreference(name)->GetValue(); | 844 return profile->GetPrefs()->FindPreference(name)->GetValue(); |
836 } | 845 } |
OLD | NEW |