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

Side by Side Diff: chrome/browser/ui/webui/inspect_ui.cc

Issue 26568004: Introduced AndroidDeviceProvider to simplify testing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed unused constants, thus fixed compile errors. Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/devtools/refcounted_adb_thread.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 const Value* value = GetPrefValue(prefs::kDevToolsDiscoverUsbDevicesEnabled); 786 const Value* value = GetPrefValue(prefs::kDevToolsDiscoverUsbDevicesEnabled);
787 web_ui()->CallJavascriptFunction("updateDiscoverUsbDevicesEnabled", *value); 787 web_ui()->CallJavascriptFunction("updateDiscoverUsbDevicesEnabled", *value);
788 788
789 // Configure adb bridge. 789 // Configure adb bridge.
790 Profile* profile = Profile::FromWebUI(web_ui()); 790 Profile* profile = Profile::FromWebUI(web_ui());
791 DevToolsAdbBridge* adb_bridge = 791 DevToolsAdbBridge* adb_bridge =
792 DevToolsAdbBridge::Factory::GetForProfile(profile); 792 DevToolsAdbBridge::Factory::GetForProfile(profile);
793 if (adb_bridge) { 793 if (adb_bridge) {
794 bool enabled = false; 794 bool enabled = false;
795 value->GetAsBoolean(&enabled); 795 value->GetAsBoolean(&enabled);
796 adb_bridge->set_discover_usb_devices(enabled); 796
797 DevToolsAdbBridge::DeviceProviders device_providers;
798 device_providers.push_back(AndroidDeviceProvider::GetAdbDeviceProvider());
799
800 if (enabled) {
801 device_providers.push_back(
802 AndroidDeviceProvider::GetUsbDeviceProvider(profile));
803 }
804
805 adb_bridge->set_device_providers(device_providers);
797 } 806 }
798 } 807 }
799 808
800 void InspectUI::UpdatePortForwardingEnabled() { 809 void InspectUI::UpdatePortForwardingEnabled() {
801 web_ui()->CallJavascriptFunction("updatePortForwardingEnabled", 810 web_ui()->CallJavascriptFunction("updatePortForwardingEnabled",
802 *GetPrefValue(prefs::kDevToolsPortForwardingEnabled)); 811 *GetPrefValue(prefs::kDevToolsPortForwardingEnabled));
803 812
804 } 813 }
805 814
806 void InspectUI::UpdatePortForwardingConfig() { 815 void InspectUI::UpdatePortForwardingConfig() {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 base::DictionaryValue default_config; 847 base::DictionaryValue default_config;
839 default_config.SetString( 848 default_config.SetString(
840 kPortForwardingDefaultPort, kPortForwardingDefaultLocation); 849 kPortForwardingDefaultPort, kPortForwardingDefaultLocation);
841 prefs->Set(prefs::kDevToolsPortForwardingConfig, default_config); 850 prefs->Set(prefs::kDevToolsPortForwardingConfig, default_config);
842 } 851 }
843 852
844 const base::Value* InspectUI::GetPrefValue(const char* name) { 853 const base::Value* InspectUI::GetPrefValue(const char* name) {
845 Profile* profile = Profile::FromWebUI(web_ui()); 854 Profile* profile = Profile::FromWebUI(web_ui());
846 return profile->GetPrefs()->FindPreference(name)->GetValue(); 855 return profile->GetPrefs()->FindPreference(name)->GetValue();
847 } 856 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/refcounted_adb_thread.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698