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

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

Issue 22685003: Visualize status of port forwarding sockets in chrome:inspect Devices tab (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 4 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/resources/inspect/inspect.js ('k') | no next file » | 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 static const char kUrlField[] = "url"; 89 static const char kUrlField[] = "url";
90 static const char kNameField[] = "name"; 90 static const char kNameField[] = "name";
91 static const char kFaviconUrlField[] = "faviconUrl"; 91 static const char kFaviconUrlField[] = "faviconUrl";
92 static const char kPidField[] = "pid"; 92 static const char kPidField[] = "pid";
93 static const char kAdbSerialField[] = "adbSerial"; 93 static const char kAdbSerialField[] = "adbSerial";
94 static const char kAdbModelField[] = "adbModel"; 94 static const char kAdbModelField[] = "adbModel";
95 static const char kAdbBrowserNameField[] = "adbBrowserName"; 95 static const char kAdbBrowserNameField[] = "adbBrowserName";
96 static const char kAdbGlobalIdField[] = "adbGlobalId"; 96 static const char kAdbGlobalIdField[] = "adbGlobalId";
97 static const char kAdbBrowsersField[] = "browsers"; 97 static const char kAdbBrowsersField[] = "browsers";
98 static const char kAdbPagesField[] = "pages"; 98 static const char kAdbPagesField[] = "pages";
99 static const char kAdbPortStatus[] = "adbPortStatus";
99 100
100 DictionaryValue* BuildTargetDescriptor( 101 DictionaryValue* BuildTargetDescriptor(
101 const std::string& target_type, 102 const std::string& target_type,
102 bool attached, 103 bool attached,
103 const GURL& url, 104 const GURL& url,
104 const std::string& name, 105 const std::string& name,
105 const GURL& favicon_url, 106 const GURL& favicon_url,
106 int process_id, 107 int process_id,
107 int route_id, 108 int route_id,
108 base::ProcessHandle handle = base::kNullProcessHandle) { 109 base::ProcessHandle handle = base::kNullProcessHandle) {
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 std::string page_id = base::StringPrintf("page:%s:%s:%s", 618 std::string page_id = base::StringPrintf("page:%s:%s:%s",
618 device->serial().c_str(), 619 device->serial().c_str(),
619 browser->socket().c_str(), 620 browser->socket().c_str(),
620 page->id().c_str()); 621 page->id().c_str());
621 page_data->SetString(kAdbGlobalIdField, page_id); 622 page_data->SetString(kAdbGlobalIdField, page_id);
622 remote_pages_[page_id] = page; 623 remote_pages_[page_id] = page;
623 page_list->Append(page_data); 624 page_list->Append(page_data);
624 } 625 }
625 browser_list->Append(browser_data); 626 browser_list->Append(browser_data);
626 } 627 }
628
629 DictionaryValue* port_status_dict = new DictionaryValue();
630 typedef DevToolsAdbBridge::RemoteDevice::PortStatusMap StatusMap;
631 const StatusMap& port_status = device->port_status();
632 for (StatusMap::const_iterator it = port_status.begin();
633 it != port_status.end(); ++it) {
634 port_status_dict->SetInteger(
635 base::StringPrintf("%d", it->first), it->second);
636 }
637 device_data->Set(kAdbPortStatus, port_status_dict);
638
627 device_list.Append(device_data); 639 device_list.Append(device_data);
628 } 640 }
629 web_ui()->CallJavascriptFunction("populateDeviceLists", device_list); 641 web_ui()->CallJavascriptFunction("populateDeviceLists", device_list);
630 } 642 }
631 643
632 void InspectUI::UpdatePortForwardingEnabled() { 644 void InspectUI::UpdatePortForwardingEnabled() {
633 Profile* profile = Profile::FromWebUI(web_ui()); 645 Profile* profile = Profile::FromWebUI(web_ui());
634 const base::Value* value = profile->GetPrefs()->FindPreference( 646 const base::Value* value = profile->GetPrefs()->FindPreference(
635 prefs::kDevToolsPortForwardingEnabled)->GetValue(); 647 prefs::kDevToolsPortForwardingEnabled)->GetValue();
636 web_ui()->CallJavascriptFunction("updatePortForwardingEnabled", *value); 648 web_ui()->CallJavascriptFunction("updatePortForwardingEnabled", *value);
637 649
638 } 650 }
639 651
640 void InspectUI::UpdatePortForwardingConfig() { 652 void InspectUI::UpdatePortForwardingConfig() {
641 Profile* profile = Profile::FromWebUI(web_ui()); 653 Profile* profile = Profile::FromWebUI(web_ui());
642 const base::Value* value = profile->GetPrefs()->FindPreference( 654 const base::Value* value = profile->GetPrefs()->FindPreference(
643 prefs::kDevToolsPortForwardingConfig)->GetValue(); 655 prefs::kDevToolsPortForwardingConfig)->GetValue();
644 web_ui()->CallJavascriptFunction("updatePortForwardingConfig", *value); 656 web_ui()->CallJavascriptFunction("updatePortForwardingConfig", *value);
645 } 657 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/inspect/inspect.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698