OLD | NEW |
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 |
(...skipping 28 matching lines...) Expand all Loading... |
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 = document.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 = document.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.EventTypes.RequestStarted, this._onRequestStarted, this
); | 63 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web
Inspector.NetworkManager.EventTypes.RequestStarted, this._onRequestStarted, this
); |
64 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web
Inspector.NetworkManager.EventTypes.RequestFinished, this._onRequestFinished, th
is); | 64 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web
Inspector.NetworkManager.EventTypes.RequestFinished, this._onRequestFinished, th
is); |
65 WebInspector.profilingLock().addEventListener(WebInspector.Lock.Events.State
Changed, this._updateButton, this); | 65 WebInspector.profilingLock().addEventListener(WebInspector.Lock.Events.State
Changed, this._updateButton, this); |
66 | 66 |
67 var defaultSelectedAuditCategory = {}; | 67 var defaultSelectedAuditCategory = {}; |
68 defaultSelectedAuditCategory[WebInspector.AuditLauncherView.AllCategoriesKey
] = true; | 68 defaultSelectedAuditCategory[WebInspector.AuditLauncherView.AllCategoriesKey
] = true; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 this._selectAllCheckboxElement.checked = this._currentCategoriesCount ==
= this._sortedCategories.length; | 221 this._selectAllCheckboxElement.checked = this._currentCategoriesCount ==
= this._sortedCategories.length; |
222 this._selectedCategoriesUpdated(true); | 222 this._selectedCategoriesUpdated(true); |
223 }, | 223 }, |
224 | 224 |
225 /** | 225 /** |
226 * @param {string} title | 226 * @param {string} title |
227 * @param {string} id | 227 * @param {string} id |
228 */ | 228 */ |
229 _createCategoryElement: function(title, id) | 229 _createCategoryElement: function(title, id) |
230 { | 230 { |
231 var labelElement = document.createElement("label"); | 231 var labelElement = createElement("label"); |
232 labelElement.id = this._categoryIdPrefix + id; | 232 labelElement.id = this._categoryIdPrefix + id; |
233 | 233 |
234 var element = document.createElement("input"); | 234 var element = createElement("input"); |
235 element.type = "checkbox"; | 235 element.type = "checkbox"; |
236 if (id !== "") | 236 if (id !== "") |
237 element.addEventListener("click", this._boundCategoryClickListener,
false); | 237 element.addEventListener("click", this._boundCategoryClickListener,
false); |
238 labelElement.appendChild(element); | 238 labelElement.appendChild(element); |
239 labelElement.createTextChild(title); | 239 labelElement.createTextChild(title); |
240 labelElement.__displayName = title; | 240 labelElement.__displayName = title; |
241 | 241 |
242 return labelElement; | 242 return labelElement; |
243 }, | 243 }, |
244 | 244 |
245 _createLauncherUI: function() | 245 _createLauncherUI: function() |
246 { | 246 { |
247 this._headerElement = document.createElement("h1"); | 247 this._headerElement = createElement("h1"); |
248 this._headerElement.textContent = WebInspector.UIString("Select audits t
o run"); | 248 this._headerElement.textContent = WebInspector.UIString("Select audits t
o run"); |
249 | 249 |
250 for (var child = 0; child < this._contentElement.children.length; ++chil
d) | 250 for (var child = 0; child < this._contentElement.children.length; ++chil
d) |
251 this._contentElement.removeChild(this._contentElement.children[child
]); | 251 this._contentElement.removeChild(this._contentElement.children[child
]); |
252 | 252 |
253 this._contentElement.appendChild(this._headerElement); | 253 this._contentElement.appendChild(this._headerElement); |
254 | 254 |
255 /** | 255 /** |
256 * @param {!Event} event | 256 * @param {!Event} event |
257 * @this {WebInspector.AuditLauncherView} | 257 * @this {WebInspector.AuditLauncherView} |
(...skipping 14 matching lines...) Expand all Loading... |
272 | 272 |
273 this._contentElement.createChild("div", "flexible-space"); | 273 this._contentElement.createChild("div", "flexible-space"); |
274 | 274 |
275 this._buttonContainerElement = this._contentElement.createChild("div", "
button-container"); | 275 this._buttonContainerElement = this._contentElement.createChild("div", "
button-container"); |
276 | 276 |
277 var labelElement = this._buttonContainerElement.createChild("label"); | 277 var labelElement = this._buttonContainerElement.createChild("label"); |
278 this._auditPresentStateElement = labelElement.createChild("input"); | 278 this._auditPresentStateElement = labelElement.createChild("input"); |
279 this._auditPresentStateElement.name = "audit-mode"; | 279 this._auditPresentStateElement.name = "audit-mode"; |
280 this._auditPresentStateElement.type = "radio"; | 280 this._auditPresentStateElement.type = "radio"; |
281 this._auditPresentStateElement.checked = true; | 281 this._auditPresentStateElement.checked = true; |
282 this._auditPresentStateLabelElement = document.createTextNode(WebInspect
or.UIString("Audit Present State")); | 282 this._auditPresentStateLabelElement = createTextNode(WebInspector.UIStri
ng("Audit Present State")); |
283 labelElement.appendChild(this._auditPresentStateLabelElement); | 283 labelElement.appendChild(this._auditPresentStateLabelElement); |
284 | 284 |
285 labelElement = this._buttonContainerElement.createChild("label"); | 285 labelElement = this._buttonContainerElement.createChild("label"); |
286 this._auditReloadedStateElement = labelElement.createChild("input"); | 286 this._auditReloadedStateElement = labelElement.createChild("input"); |
287 this._auditReloadedStateElement.name = "audit-mode"; | 287 this._auditReloadedStateElement.name = "audit-mode"; |
288 this._auditReloadedStateElement.type = "radio"; | 288 this._auditReloadedStateElement.type = "radio"; |
289 labelElement.createTextChild("Reload Page and Audit on Load"); | 289 labelElement.createTextChild("Reload Page and Audit on Load"); |
290 | 290 |
291 this._launchButton = this._buttonContainerElement.createChild("button",
"text-button"); | 291 this._launchButton = this._buttonContainerElement.createChild("button",
"text-button"); |
292 this._launchButton.textContent = WebInspector.UIString("Run"); | 292 this._launchButton.textContent = WebInspector.UIString("Run"); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 _updateButton: function() | 325 _updateButton: function() |
326 { | 326 { |
327 var enable = this._auditRunning || (this._currentCategoriesCount && !Web
Inspector.profilingLock().isAcquired()); | 327 var enable = this._auditRunning || (this._currentCategoriesCount && !Web
Inspector.profilingLock().isAcquired()); |
328 this._launchButton.textContent = this._auditRunning ? WebInspector.UIStr
ing("Stop") : WebInspector.UIString("Run"); | 328 this._launchButton.textContent = this._auditRunning ? WebInspector.UIStr
ing("Stop") : WebInspector.UIString("Run"); |
329 this._launchButton.disabled = !enable; | 329 this._launchButton.disabled = !enable; |
330 this._launchButton.title = enable ? "" : WebInspector.anotherProfilerAct
iveLabel(); | 330 this._launchButton.title = enable ? "" : WebInspector.anotherProfilerAct
iveLabel(); |
331 }, | 331 }, |
332 | 332 |
333 __proto__: WebInspector.VBox.prototype | 333 __proto__: WebInspector.VBox.prototype |
334 } | 334 } |
OLD | NEW |