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

Side by Side Diff: Source/devtools/front_end/emulation/DevicesSettingsTab.js

Issue 1160883011: [DevTools] Remove external device list update. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | « no previous file | Source/devtools/front_end/emulation/EmulatedDevices.js » ('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 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 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.VBox} 7 * @extends {WebInspector.VBox}
8 */ 8 */
9 WebInspector.DevicesSettingsTab = function() 9 WebInspector.DevicesSettingsTab = function()
10 { 10 {
11 WebInspector.VBox.call(this); 11 WebInspector.VBox.call(this);
12 this.element.classList.add("settings-tab-container"); 12 this.element.classList.add("settings-tab-container");
13 this.element.classList.add("devices-settings-tab"); 13 this.element.classList.add("devices-settings-tab");
14 this.registerRequiredCSS("emulation/devicesSettingsTab.css"); 14 this.registerRequiredCSS("emulation/devicesSettingsTab.css");
15 15
16 var header = this.element.createChild("header"); 16 var header = this.element.createChild("header");
17 header.createChild("h3").createTextChild(WebInspector.UIString("Devices")); 17 header.createChild("h3").createTextChild(WebInspector.UIString("Devices"));
18 this.containerElement = this.element.createChild("div", "help-container-wrap per").createChild("div", "settings-tab help-content help-container"); 18 this.containerElement = this.element.createChild("div", "help-container-wrap per").createChild("div", "settings-tab help-content help-container");
19 19
20 this.containerElement.createChild("div", "devices-title").textContent = WebI nspector.UIString("Emulated devices"); 20 this.containerElement.createChild("div", "devices-title").textContent = WebI nspector.UIString("Emulated devices");
21 this._devicesList = this.containerElement.createChild("div", "devices-list") ; 21 this._devicesList = this.containerElement.createChild("div", "devices-list") ;
22 this._customListSearator = createElementWithClass("div", "devices-custom-sep arator"); 22 this._customListSearator = createElementWithClass("div", "devices-custom-sep arator");
23 23
24 var buttonsRow = this.containerElement.createChild("div", "devices-button-ro w"); 24 var buttonsRow = this.containerElement.createChild("div", "devices-button-ro w");
25 this._addCustomButton = createTextButton(WebInspector.UIString("Add custom d evice..."), this._addCustomDevice.bind(this)); 25 this._addCustomButton = createTextButton(WebInspector.UIString("Add custom d evice..."), this._addCustomDevice.bind(this));
26 buttonsRow.appendChild(this._addCustomButton); 26 buttonsRow.appendChild(this._addCustomButton);
27 this._updateStandardButton = createTextButton("", this._updateStandardDevice s.bind(this));
28 if (Runtime.experiments.isEnabled("externalDeviceList"))
29 buttonsRow.appendChild(this._updateStandardButton);
30 27
31 this._editDevice = null; 28 this._editDevice = null;
32 this._editDeviceListItem = null; 29 this._editDeviceListItem = null;
33 this._createEditDeviceElement(); 30 this._createEditDeviceElement();
34 31
35 this._muteUpdate = false; 32 this._muteUpdate = false;
36 WebInspector.emulatedDevicesList.addEventListener(WebInspector.EmulatedDevic esList.Events.CustomDevicesUpdated, this._devicesUpdated, this); 33 WebInspector.emulatedDevicesList.addEventListener(WebInspector.EmulatedDevic esList.Events.CustomDevicesUpdated, this._devicesUpdated, this);
37 WebInspector.emulatedDevicesList.addEventListener(WebInspector.EmulatedDevic esList.Events.StandardDevicesUpdated, this._devicesUpdated, this); 34 WebInspector.emulatedDevicesList.addEventListener(WebInspector.EmulatedDevic esList.Events.StandardDevicesUpdated, this._devicesUpdated, this);
38 WebInspector.emulatedDevicesList.addEventListener(WebInspector.EmulatedDevic esList.Events.IsUpdatingChanged, this._isUpdatingChanged, this);
39 } 35 }
40 36
41 WebInspector.DevicesSettingsTab.prototype = { 37 WebInspector.DevicesSettingsTab.prototype = {
42 wasShown: function() 38 wasShown: function()
43 { 39 {
44 WebInspector.VBox.prototype.wasShown.call(this); 40 WebInspector.VBox.prototype.wasShown.call(this);
45 this._devicesUpdated(); 41 this._devicesUpdated();
46 this._isUpdatingChanged();
47 this._stopEditing(); 42 this._stopEditing();
48 }, 43 },
49 44
50 _devicesUpdated: function() 45 _devicesUpdated: function()
51 { 46 {
52 if (this._muteUpdate) 47 if (this._muteUpdate)
53 return; 48 return;
54 49
55 this._devicesList.removeChildren(); 50 this._devicesList.removeChildren();
56 51
57 var devices = WebInspector.emulatedDevicesList.custom().slice(); 52 var devices = WebInspector.emulatedDevicesList.custom().slice();
58 devices.sort(WebInspector.EmulatedDevice.compareByTitle); 53 devices.sort(WebInspector.EmulatedDevice.compareByTitle);
59 for (var i = 0; i < devices.length; ++i) 54 for (var i = 0; i < devices.length; ++i)
60 this._devicesList.appendChild(this._createDeviceListItem(devices[i], true)); 55 this._devicesList.appendChild(this._createDeviceListItem(devices[i], true));
61 56
62 this._devicesList.appendChild(this._customListSearator); 57 this._devicesList.appendChild(this._customListSearator);
63 this._updateSeparatorVisibility(); 58 this._updateSeparatorVisibility();
64 59
65 devices = WebInspector.emulatedDevicesList.standard().slice(); 60 devices = WebInspector.emulatedDevicesList.standard().slice();
66 devices.sort(WebInspector.EmulatedDevice.compareByTitle); 61 devices.sort(WebInspector.EmulatedDevice.compareByTitle);
67 for (var i = 0; i < devices.length; ++i) 62 for (var i = 0; i < devices.length; ++i)
68 this._devicesList.appendChild(this._createDeviceListItem(devices[i], false)); 63 this._devicesList.appendChild(this._createDeviceListItem(devices[i], false));
69 }, 64 },
70 65
71 _isUpdatingChanged: function()
72 {
73 if (WebInspector.emulatedDevicesList.isUpdating()) {
74 this._updateStandardButton.textContent = WebInspector.UIString("Upda ting...");
75 this._updateStandardButton.disabled = true;
76 } else {
77 this._updateStandardButton.textContent = WebInspector.UIString("Upda te devices");
78 this._updateStandardButton.disabled = false;
79 }
80 },
81
82 _updateSeparatorVisibility: function() 66 _updateSeparatorVisibility: function()
83 { 67 {
84 this._customListSearator.classList.toggle("hidden", this._devicesList.fi rstChild === this._customListSearator); 68 this._customListSearator.classList.toggle("hidden", this._devicesList.fi rstChild === this._customListSearator);
85 }, 69 },
86 70
87 /** 71 /**
88 * @param {boolean} custom 72 * @param {boolean} custom
89 */ 73 */
90 _muteAndSaveDeviceList: function(custom) 74 _muteAndSaveDeviceList: function(custom)
91 { 75 {
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 { 294 {
311 this._devicesList.classList.remove("devices-list-editing"); 295 this._devicesList.classList.remove("devices-list-editing");
312 if (this._editDeviceListItem) 296 if (this._editDeviceListItem)
313 this._editDeviceListItem.classList.remove("hidden"); 297 this._editDeviceListItem.classList.remove("hidden");
314 if (this._editDeviceElement.parentElement) 298 if (this._editDeviceElement.parentElement)
315 this._devicesList.removeChild(this._editDeviceElement); 299 this._devicesList.removeChild(this._editDeviceElement);
316 this._addCustomButton.disabled = false; 300 this._addCustomButton.disabled = false;
317 this._addCustomButton.focus(); 301 this._addCustomButton.focus();
318 }, 302 },
319 303
320 _updateStandardDevices: function()
321 {
322 WebInspector.emulatedDevicesList.update();
323 },
324
325 __proto__: WebInspector.VBox.prototype 304 __proto__: WebInspector.VBox.prototype
326 } 305 }
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/emulation/EmulatedDevices.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698