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

Side by Side Diff: chrome/browser/resources/inspect/inspect.js

Issue 562513003: [DevTools] Unify workers and web contents handling in inspect_ui. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased, fixed comment Created 6 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
« no previous file with comments | « chrome/browser/devtools/devtools_targets_ui.cc ('k') | chrome/browser/ui/webui/inspect_ui.cc » ('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 var MIN_VERSION_TAB_CLOSE = 25; 5 var MIN_VERSION_TAB_CLOSE = 25;
6 var MIN_VERSION_TARGET_ID = 26; 6 var MIN_VERSION_TARGET_ID = 26;
7 var MIN_VERSION_NEW_TAB = 29; 7 var MIN_VERSION_NEW_TAB = 29;
8 var MIN_VERSION_TAB_ACTIVATE = 30; 8 var MIN_VERSION_TAB_ACTIVATE = 30;
9 9
10 var queryParamsObject = {}; 10 var queryParamsObject = {};
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 false); 130 false);
131 addActionLink( 131 addActionLink(
132 row, 132 row,
133 'terminate', 133 'terminate',
134 sendServiceWorkerCommand.bind(null, 'stop', worker), 134 sendServiceWorkerCommand.bind(null, 'stop', worker),
135 false); 135 false);
136 } 136 }
137 } 137 }
138 138
139 function populateTargets(source, data) { 139 function populateTargets(source, data) {
140 if (source == 'renderers') 140 if (source == 'local')
141 populateWebContentsTargets(data); 141 populateLocalTargets(data);
142 else if (source == 'workers') 142 else if (source == 'remote')
143 populateWorkerTargets(data);
144 else if (source == 'adb')
145 populateRemoteTargets(data); 143 populateRemoteTargets(data);
146 else 144 else
147 console.error('Unknown source type: ' + source); 145 console.error('Unknown source type: ' + source);
148 } 146 }
149 147
150 function populateWebContentsTargets(data) { 148 function populateLocalTargets(data) {
151 removeChildren('pages-list'); 149 removeChildren('pages-list');
152 removeChildren('extensions-list'); 150 removeChildren('extensions-list');
153 removeChildren('apps-list'); 151 removeChildren('apps-list');
154 removeChildren('others-list'); 152 removeChildren('others-list');
153 removeChildren('workers-list');
155 154
156 for (var i = 0; i < data.length; i++) { 155 for (var i = 0; i < data.length; i++) {
157 if (data[i].type === 'page') 156 if (data[i].type === 'page')
158 addToPagesList(data[i]); 157 addToPagesList(data[i]);
159 else if (data[i].type === 'background_page') 158 else if (data[i].type === 'background_page')
160 addToExtensionsList(data[i]); 159 addToExtensionsList(data[i]);
161 else if (data[i].type === 'app') 160 else if (data[i].type === 'app')
162 addToAppsList(data[i]); 161 addToAppsList(data[i]);
162 else if (data[i].type === 'worker')
163 addToWorkersList(data[i]);
163 else 164 else
164 addToOthersList(data[i]); 165 addToOthersList(data[i]);
165 } 166 }
166 } 167 }
167 168
168 function populateWorkerTargets(data) {
169 removeChildren('workers-list');
170
171 for (var i = 0; i < data.length; i++)
172 addToWorkersList(data[i]);
173 }
174
175 function showIncognitoWarning() { 169 function showIncognitoWarning() {
176 $('devices-incognito').hidden = false; 170 $('devices-incognito').hidden = false;
177 } 171 }
178 172
179 function populateRemoteTargets(devices) { 173 function populateRemoteTargets(devices) {
180 if (!devices) 174 if (!devices)
181 return; 175 return;
182 176
183 if (window.modal) { 177 if (window.modal) {
184 window.holdDevices = devices; 178 window.holdDevices = devices;
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 deviceSection.querySelector('.device-ports').textContent = ''; 933 deviceSection.querySelector('.device-ports').textContent = '';
940 } 934 }
941 935
942 Array.prototype.forEach.call( 936 Array.prototype.forEach.call(
943 document.querySelectorAll('.device'), clearPorts); 937 document.querySelectorAll('.device'), clearPorts);
944 } 938 }
945 939
946 document.addEventListener('DOMContentLoaded', onload); 940 document.addEventListener('DOMContentLoaded', onload);
947 941
948 window.addEventListener('hashchange', onHashChange); 942 window.addEventListener('hashchange', onHashChange);
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_targets_ui.cc ('k') | chrome/browser/ui/webui/inspect_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698