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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/audits/AuditLauncherView.js

Issue 2466123002: DevTools: reformat front-end code to match chromium style. (Closed)
Patch Set: all done Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer 11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the 12 * in the documentation and/or other materials provided with the
13 * distribution. 13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its 14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from 15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission. 16 * this software without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30
31 /** 30 /**
32 * @constructor 31 * @unrestricted
33 * @param {!WebInspector.AuditController} auditController
34 * @extends {WebInspector.VBox}
35 */ 32 */
36 WebInspector.AuditLauncherView = function(auditController) 33 WebInspector.AuditLauncherView = class extends WebInspector.VBox {
37 { 34 /**
38 WebInspector.VBox.call(this); 35 * @param {!WebInspector.AuditController} auditController
36 */
37 constructor(auditController) {
38 super();
39 this.setMinimumSize(100, 25); 39 this.setMinimumSize(100, 25);
40 40
41 this._auditController = auditController; 41 this._auditController = auditController;
42 42
43 this._categoryIdPrefix = "audit-category-item-"; 43 this._categoryIdPrefix = 'audit-category-item-';
44 this._auditRunning = false; 44 this._auditRunning = false;
45 45
46 this.element.classList.add("audit-launcher-view"); 46 this.element.classList.add('audit-launcher-view');
47 this.element.classList.add("panel-enabler-view"); 47 this.element.classList.add('panel-enabler-view');
48 48
49 this._contentElement = createElement("div"); 49 this._contentElement = createElement('div');
50 this._contentElement.className = "audit-launcher-view-content"; 50 this._contentElement.className = 'audit-launcher-view-content';
51 this.element.appendChild(this._contentElement); 51 this.element.appendChild(this._contentElement);
52 this._boundCategoryClickListener = this._categoryClicked.bind(this); 52 this._boundCategoryClickListener = this._categoryClicked.bind(this);
53 53
54 this._resetResourceCount(); 54 this._resetResourceCount();
55 55
56 this._sortedCategories = []; 56 this._sortedCategories = [];
57 57
58 this._headerElement = createElement("h1"); 58 this._headerElement = createElement('h1');
59 this._headerElement.className = "no-audits"; 59 this._headerElement.className = 'no-audits';
60 this._headerElement.textContent = WebInspector.UIString("No audits to run"); 60 this._headerElement.textContent = WebInspector.UIString('No audits to run');
61 this._contentElement.appendChild(this._headerElement); 61 this._contentElement.appendChild(this._headerElement);
62 62
63 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.Events.RequestStarted, this._onRequestStarted, this); 63 WebInspector.targetManager.addModelListener(
64 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web Inspector.NetworkManager.Events.RequestFinished, this._onRequestFinished, this); 64 WebInspector.NetworkManager, WebInspector.NetworkManager.Events.RequestS tarted, this._onRequestStarted, this);
65 WebInspector.targetManager.addModelListener(
66 WebInspector.NetworkManager, WebInspector.NetworkManager.Events.RequestF inished, this._onRequestFinished, this);
65 67
66 var defaultSelectedAuditCategory = {}; 68 var defaultSelectedAuditCategory = {};
67 defaultSelectedAuditCategory[WebInspector.AuditLauncherView.AllCategoriesKey ] = true; 69 defaultSelectedAuditCategory[WebInspector.AuditLauncherView.AllCategoriesKey ] = true;
68 this._selectedCategoriesSetting = WebInspector.settings.createSetting("selec tedAuditCategories", defaultSelectedAuditCategory); 70 this._selectedCategoriesSetting =
71 WebInspector.settings.createSetting('selectedAuditCategories', defaultSe lectedAuditCategory);
72 }
73
74 _resetResourceCount() {
75 this._loadedResources = 0;
76 this._totalResources = 0;
77 }
78
79 _onRequestStarted(event) {
80 var request = /** @type {!WebInspector.NetworkRequest} */ (event.data);
81 // Ignore long-living WebSockets for the sake of progress indicator, as we w on't be waiting them anyway.
82 if (request.resourceType() === WebInspector.resourceTypes.WebSocket)
83 return;
84 ++this._totalResources;
85 this._updateResourceProgress();
86 }
87
88 _onRequestFinished(event) {
89 var request = /** @type {!WebInspector.NetworkRequest} */ (event.data);
90 // See resorceStarted for details.
91 if (request.resourceType() === WebInspector.resourceTypes.WebSocket)
92 return;
93 ++this._loadedResources;
94 this._updateResourceProgress();
95 }
96
97 /**
98 * @param {!WebInspector.AuditCategory} category
99 */
100 addCategory(category) {
101 if (!this._sortedCategories.length)
102 this._createLauncherUI();
103
104 var selectedCategories = this._selectedCategoriesSetting.get();
105 var categoryElement = this._createCategoryElement(category.displayName, cate gory.id);
106 category._checkboxElement = categoryElement.checkboxElement;
107 if (this._selectAllCheckboxElement.checked || selectedCategories[category.di splayName]) {
108 category._checkboxElement.checked = true;
109 ++this._currentCategoriesCount;
110 }
111
112 /**
113 * @param {!WebInspector.AuditCategory} a
114 * @param {!WebInspector.AuditCategory} b
115 * @return {number}
116 */
117 function compareCategories(a, b) {
118 var aTitle = a.displayName || '';
119 var bTitle = b.displayName || '';
120 return aTitle.localeCompare(bTitle);
121 }
122 var insertBefore = this._sortedCategories.lowerBound(category, compareCatego ries);
123 this._categoriesElement.insertBefore(categoryElement, this._categoriesElemen t.children[insertBefore]);
124 this._sortedCategories.splice(insertBefore, 0, category);
125 this._selectedCategoriesUpdated();
126 }
127
128 _startAudit() {
129 this._auditRunning = true;
130 this._updateButton();
131 this._toggleUIComponents(this._auditRunning);
132
133 var catIds = [];
134 for (var category = 0; category < this._sortedCategories.length; ++category) {
135 if (this._sortedCategories[category]._checkboxElement.checked)
136 catIds.push(this._sortedCategories[category].id);
137 }
138
139 this._resetResourceCount();
140 this._progressIndicator = new WebInspector.ProgressIndicator();
141 this._buttonContainerElement.appendChild(this._progressIndicator.element);
142 this._displayResourceLoadingProgress = true;
143
144 /**
145 * @this {WebInspector.AuditLauncherView}
146 */
147 function onAuditStarted() {
148 this._displayResourceLoadingProgress = false;
149 }
150 this._auditController.initiateAudit(
151 catIds, new WebInspector.ProgressProxy(this._progressIndicator, this._au ditsDone.bind(this)),
152 this._auditPresentStateElement.checked, onAuditStarted.bind(this));
153 }
154
155 _auditsDone() {
156 this._displayResourceLoadingProgress = false;
157 delete this._progressIndicator;
158 this._launchButton.disabled = false;
159 this._auditRunning = false;
160 this._updateButton();
161 this._toggleUIComponents(this._auditRunning);
162 }
163
164 /**
165 * @param {boolean} disable
166 */
167 _toggleUIComponents(disable) {
168 this._selectAllCheckboxElement.disabled = disable;
169 for (var child = this._categoriesElement.firstChild; child; child = child.ne xtSibling)
170 child.checkboxElement.disabled = disable;
171 this._auditPresentStateElement.disabled = disable;
172 this._auditReloadedStateElement.disabled = disable;
173 }
174
175 _launchButtonClicked(event) {
176 if (this._auditRunning) {
177 this._launchButton.disabled = true;
178 this._progressIndicator.cancel();
179 return;
180 }
181 this._startAudit();
182 }
183
184 _clearButtonClicked() {
185 this._auditController.clearResults();
186 }
187
188 /**
189 * @param {boolean} checkCategories
190 * @param {boolean=} userGesture
191 */
192 _selectAllClicked(checkCategories, userGesture) {
193 var childNodes = this._categoriesElement.childNodes;
194 for (var i = 0, length = childNodes.length; i < length; ++i)
195 childNodes[i].checkboxElement.checked = checkCategories;
196 this._currentCategoriesCount = checkCategories ? this._sortedCategories.leng th : 0;
197 this._selectedCategoriesUpdated(userGesture);
198 }
199
200 _categoryClicked(event) {
201 this._currentCategoriesCount += event.target.checked ? 1 : -1;
202 this._selectAllCheckboxElement.checked = this._currentCategoriesCount === th is._sortedCategories.length;
203 this._selectedCategoriesUpdated(true);
204 }
205
206 /**
207 * @param {string} title
208 * @param {string=} id
209 */
210 _createCategoryElement(title, id) {
211 var labelElement = createCheckboxLabel(title);
212 if (id) {
213 labelElement.id = this._categoryIdPrefix + id;
214 labelElement.checkboxElement.addEventListener('click', this._boundCategory ClickListener, false);
215 }
216 labelElement.__displayName = title;
217
218 return labelElement;
219 }
220
221 _createLauncherUI() {
222 this._headerElement = createElement('h1');
223 this._headerElement.textContent = WebInspector.UIString('Select audits to ru n');
224
225 this._contentElement.removeChildren();
226 this._contentElement.appendChild(this._headerElement);
227
228 /**
229 * @param {!Event} event
230 * @this {WebInspector.AuditLauncherView}
231 */
232 function handleSelectAllClick(event) {
233 this._selectAllClicked(event.target.checked, true);
234 }
235 var categoryElement = this._createCategoryElement(WebInspector.UIString('Sel ect All'), '');
236 categoryElement.id = 'audit-launcher-selectall';
237 this._selectAllCheckboxElement = categoryElement.checkboxElement;
238 this._selectAllCheckboxElement.checked =
239 this._selectedCategoriesSetting.get()[WebInspector.AuditLauncherView.All CategoriesKey];
240 this._selectAllCheckboxElement.addEventListener('click', handleSelectAllClic k.bind(this), false);
241 this._contentElement.appendChild(categoryElement);
242
243 this._categoriesElement = this._contentElement.createChild('fieldset', 'audi t-categories-container');
244 this._currentCategoriesCount = 0;
245
246 this._contentElement.createChild('div', 'flexible-space');
247
248 this._buttonContainerElement = this._contentElement.createChild('div', 'butt on-container');
249
250 var radio = createRadioLabel('audit-mode', WebInspector.UIString('Audit Pres ent State'), true);
251 this._buttonContainerElement.appendChild(radio);
252 this._auditPresentStateElement = radio.radioElement;
253
254 radio = createRadioLabel('audit-mode', WebInspector.UIString('Reload Page an d Audit on Load'));
255 this._buttonContainerElement.appendChild(radio);
256 this._auditReloadedStateElement = radio.radioElement;
257
258 this._launchButton = createTextButton(WebInspector.UIString('Run'), this._la unchButtonClicked.bind(this));
259 this._buttonContainerElement.appendChild(this._launchButton);
260
261 this._clearButton = createTextButton(WebInspector.UIString('Clear'), this._c learButtonClicked.bind(this));
262 this._buttonContainerElement.appendChild(this._clearButton);
263
264 this._selectAllClicked(this._selectAllCheckboxElement.checked);
265 }
266
267 _updateResourceProgress() {
268 if (this._displayResourceLoadingProgress)
269 this._progressIndicator.setTitle(
270 WebInspector.UIString('Loading (%d of %d)', this._loadedResources, thi s._totalResources));
271 }
272
273 /**
274 * @param {boolean=} userGesture
275 */
276 _selectedCategoriesUpdated(userGesture) {
277 // Save present categories only upon user gesture to clean up junk from past versions and removed extensions.
278 // Do not remove old categories if not handling a user gesture, as there's c hance categories will be added
279 // later during start-up.
280 var selectedCategories = userGesture ? {} : this._selectedCategoriesSetting. get();
281 var childNodes = this._categoriesElement.childNodes;
282 for (var i = 0, length = childNodes.length; i < length; ++i)
283 selectedCategories[childNodes[i].__displayName] = childNodes[i].checkboxEl ement.checked;
284 selectedCategories[WebInspector.AuditLauncherView.AllCategoriesKey] = this._ selectAllCheckboxElement.checked;
285 this._selectedCategoriesSetting.set(selectedCategories);
286 this._updateButton();
287 }
288
289 _updateButton() {
290 this._launchButton.textContent = this._auditRunning ? WebInspector.UIString( 'Stop') : WebInspector.UIString('Run');
291 this._launchButton.disabled = !this._currentCategoriesCount;
292 }
69 }; 293 };
70 294
71 WebInspector.AuditLauncherView.AllCategoriesKey = "__AllCategories"; 295 WebInspector.AuditLauncherView.AllCategoriesKey = '__AllCategories';
72
73 WebInspector.AuditLauncherView.prototype = {
74 _resetResourceCount: function()
75 {
76 this._loadedResources = 0;
77 this._totalResources = 0;
78 },
79
80 _onRequestStarted: function(event)
81 {
82 var request = /** @type {!WebInspector.NetworkRequest} */ (event.data);
83 // Ignore long-living WebSockets for the sake of progress indicator, as we won't be waiting them anyway.
84 if (request.resourceType() === WebInspector.resourceTypes.WebSocket)
85 return;
86 ++this._totalResources;
87 this._updateResourceProgress();
88 },
89
90 _onRequestFinished: function(event)
91 {
92 var request = /** @type {!WebInspector.NetworkRequest} */ (event.data);
93 // See resorceStarted for details.
94 if (request.resourceType() === WebInspector.resourceTypes.WebSocket)
95 return;
96 ++this._loadedResources;
97 this._updateResourceProgress();
98 },
99
100 /**
101 * @param {!WebInspector.AuditCategory} category
102 */
103 addCategory: function(category)
104 {
105 if (!this._sortedCategories.length)
106 this._createLauncherUI();
107
108 var selectedCategories = this._selectedCategoriesSetting.get();
109 var categoryElement = this._createCategoryElement(category.displayName, category.id);
110 category._checkboxElement = categoryElement.checkboxElement;
111 if (this._selectAllCheckboxElement.checked || selectedCategories[categor y.displayName]) {
112 category._checkboxElement.checked = true;
113 ++this._currentCategoriesCount;
114 }
115
116 /**
117 * @param {!WebInspector.AuditCategory} a
118 * @param {!WebInspector.AuditCategory} b
119 * @return {number}
120 */
121 function compareCategories(a, b)
122 {
123 var aTitle = a.displayName || "";
124 var bTitle = b.displayName || "";
125 return aTitle.localeCompare(bTitle);
126 }
127 var insertBefore = this._sortedCategories.lowerBound(category, compareCa tegories);
128 this._categoriesElement.insertBefore(categoryElement, this._categoriesEl ement.children[insertBefore]);
129 this._sortedCategories.splice(insertBefore, 0, category);
130 this._selectedCategoriesUpdated();
131 },
132
133 _startAudit: function()
134 {
135 this._auditRunning = true;
136 this._updateButton();
137 this._toggleUIComponents(this._auditRunning);
138
139 var catIds = [];
140 for (var category = 0; category < this._sortedCategories.length; ++categ ory) {
141 if (this._sortedCategories[category]._checkboxElement.checked)
142 catIds.push(this._sortedCategories[category].id);
143 }
144
145 this._resetResourceCount();
146 this._progressIndicator = new WebInspector.ProgressIndicator();
147 this._buttonContainerElement.appendChild(this._progressIndicator.element );
148 this._displayResourceLoadingProgress = true;
149
150 /**
151 * @this {WebInspector.AuditLauncherView}
152 */
153 function onAuditStarted()
154 {
155 this._displayResourceLoadingProgress = false;
156 }
157 this._auditController.initiateAudit(catIds, new WebInspector.ProgressPro xy(this._progressIndicator, this._auditsDone.bind(this)), this._auditPresentStat eElement.checked, onAuditStarted.bind(this));
158 },
159
160 _auditsDone: function()
161 {
162 this._displayResourceLoadingProgress = false;
163 delete this._progressIndicator;
164 this._launchButton.disabled = false;
165 this._auditRunning = false;
166 this._updateButton();
167 this._toggleUIComponents(this._auditRunning);
168 },
169
170 /**
171 * @param {boolean} disable
172 */
173 _toggleUIComponents: function(disable)
174 {
175 this._selectAllCheckboxElement.disabled = disable;
176 for (var child = this._categoriesElement.firstChild; child; child = chil d.nextSibling)
177 child.checkboxElement.disabled = disable;
178 this._auditPresentStateElement.disabled = disable;
179 this._auditReloadedStateElement.disabled = disable;
180 },
181
182 _launchButtonClicked: function(event)
183 {
184 if (this._auditRunning) {
185 this._launchButton.disabled = true;
186 this._progressIndicator.cancel();
187 return;
188 }
189 this._startAudit();
190 },
191
192 _clearButtonClicked: function()
193 {
194 this._auditController.clearResults();
195 },
196
197 /**
198 * @param {boolean} checkCategories
199 * @param {boolean=} userGesture
200 */
201 _selectAllClicked: function(checkCategories, userGesture)
202 {
203 var childNodes = this._categoriesElement.childNodes;
204 for (var i = 0, length = childNodes.length; i < length; ++i)
205 childNodes[i].checkboxElement.checked = checkCategories;
206 this._currentCategoriesCount = checkCategories ? this._sortedCategories. length : 0;
207 this._selectedCategoriesUpdated(userGesture);
208 },
209
210 _categoryClicked: function(event)
211 {
212 this._currentCategoriesCount += event.target.checked ? 1 : -1;
213 this._selectAllCheckboxElement.checked = this._currentCategoriesCount == = this._sortedCategories.length;
214 this._selectedCategoriesUpdated(true);
215 },
216
217 /**
218 * @param {string} title
219 * @param {string=} id
220 */
221 _createCategoryElement: function(title, id)
222 {
223 var labelElement = createCheckboxLabel(title);
224 if (id) {
225 labelElement.id = this._categoryIdPrefix + id;
226 labelElement.checkboxElement.addEventListener("click", this._boundCa tegoryClickListener, false);
227 }
228 labelElement.__displayName = title;
229
230 return labelElement;
231 },
232
233 _createLauncherUI: function()
234 {
235 this._headerElement = createElement("h1");
236 this._headerElement.textContent = WebInspector.UIString("Select audits t o run");
237
238 this._contentElement.removeChildren();
239 this._contentElement.appendChild(this._headerElement);
240
241 /**
242 * @param {!Event} event
243 * @this {WebInspector.AuditLauncherView}
244 */
245 function handleSelectAllClick(event)
246 {
247 this._selectAllClicked(event.target.checked, true);
248 }
249 var categoryElement = this._createCategoryElement(WebInspector.UIString( "Select All"), "");
250 categoryElement.id = "audit-launcher-selectall";
251 this._selectAllCheckboxElement = categoryElement.checkboxElement;
252 this._selectAllCheckboxElement.checked = this._selectedCategoriesSetting .get()[WebInspector.AuditLauncherView.AllCategoriesKey];
253 this._selectAllCheckboxElement.addEventListener("click", handleSelectAll Click.bind(this), false);
254 this._contentElement.appendChild(categoryElement);
255
256 this._categoriesElement = this._contentElement.createChild("fieldset", " audit-categories-container");
257 this._currentCategoriesCount = 0;
258
259 this._contentElement.createChild("div", "flexible-space");
260
261 this._buttonContainerElement = this._contentElement.createChild("div", " button-container");
262
263 var radio = createRadioLabel("audit-mode", WebInspector.UIString("Audit Present State"), true);
264 this._buttonContainerElement.appendChild(radio);
265 this._auditPresentStateElement = radio.radioElement;
266
267 radio = createRadioLabel("audit-mode", WebInspector.UIString("Reload Pag e and Audit on Load"));
268 this._buttonContainerElement.appendChild(radio);
269 this._auditReloadedStateElement = radio.radioElement;
270
271 this._launchButton = createTextButton(WebInspector.UIString("Run"), this ._launchButtonClicked.bind(this));
272 this._buttonContainerElement.appendChild(this._launchButton);
273
274 this._clearButton = createTextButton(WebInspector.UIString("Clear"), thi s._clearButtonClicked.bind(this));
275 this._buttonContainerElement.appendChild(this._clearButton);
276
277 this._selectAllClicked(this._selectAllCheckboxElement.checked);
278 },
279
280 _updateResourceProgress: function()
281 {
282 if (this._displayResourceLoadingProgress)
283 this._progressIndicator.setTitle(WebInspector.UIString("Loading (%d of %d)", this._loadedResources, this._totalResources));
284 },
285
286 /**
287 * @param {boolean=} userGesture
288 */
289 _selectedCategoriesUpdated: function(userGesture)
290 {
291 // Save present categories only upon user gesture to clean up junk from past versions and removed extensions.
292 // Do not remove old categories if not handling a user gesture, as there 's chance categories will be added
293 // later during start-up.
294 var selectedCategories = userGesture ? {} : this._selectedCategoriesSett ing.get();
295 var childNodes = this._categoriesElement.childNodes;
296 for (var i = 0, length = childNodes.length; i < length; ++i)
297 selectedCategories[childNodes[i].__displayName] = childNodes[i].chec kboxElement.checked;
298 selectedCategories[WebInspector.AuditLauncherView.AllCategoriesKey] = th is._selectAllCheckboxElement.checked;
299 this._selectedCategoriesSetting.set(selectedCategories);
300 this._updateButton();
301 },
302
303 _updateButton: function()
304 {
305 this._launchButton.textContent = this._auditRunning ? WebInspector.UIStr ing("Stop") : WebInspector.UIString("Run");
306 this._launchButton.disabled = !this._currentCategoriesCount;
307 },
308
309 __proto__: WebInspector.VBox.prototype
310 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698