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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 this._sortedCategories = []; | 56 this._sortedCategories = []; |
57 | 57 |
58 this._headerElement = document.createElement("h1"); | 58 this._headerElement = document.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 var target = this._auditController.target(); | 63 var target = this._auditController.target(); |
64 target.networkManager.addEventListener(WebInspector.NetworkManager.EventType
s.RequestStarted, this._onRequestStarted, this); | 64 target.networkManager.addEventListener(WebInspector.NetworkManager.EventType
s.RequestStarted, this._onRequestStarted, this); |
65 target.networkManager.addEventListener(WebInspector.NetworkManager.EventType
s.RequestFinished, this._onRequestFinished, this); | 65 target.networkManager.addEventListener(WebInspector.NetworkManager.EventType
s.RequestFinished, this._onRequestFinished, this); |
66 target.profilingLock.addEventListener(WebInspector.Lock.Events.StateChanged,
this._updateButton, this); | 66 WebInspector.profilingLock.addEventListener(WebInspector.Lock.Events.StateCh
anged, this._updateButton, this); |
67 | 67 |
68 var defaultSelectedAuditCategory = {}; | 68 var defaultSelectedAuditCategory = {}; |
69 defaultSelectedAuditCategory[WebInspector.AuditLauncherView.AllCategoriesKey
] = true; | 69 defaultSelectedAuditCategory[WebInspector.AuditLauncherView.AllCategoriesKey
] = true; |
70 this._selectedCategoriesSetting = WebInspector.settings.createSetting("selec
tedAuditCategories", defaultSelectedAuditCategory); | 70 this._selectedCategoriesSetting = WebInspector.settings.createSetting("selec
tedAuditCategories", defaultSelectedAuditCategory); |
71 } | 71 } |
72 | 72 |
73 WebInspector.AuditLauncherView.AllCategoriesKey = "__AllCategories"; | 73 WebInspector.AuditLauncherView.AllCategoriesKey = "__AllCategories"; |
74 | 74 |
75 WebInspector.AuditLauncherView.prototype = { | 75 WebInspector.AuditLauncherView.prototype = { |
76 _resetResourceCount: function() | 76 _resetResourceCount: function() |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 */ | 137 */ |
138 _setAuditRunning: function(auditRunning) | 138 _setAuditRunning: function(auditRunning) |
139 { | 139 { |
140 if (this._auditRunning === auditRunning) | 140 if (this._auditRunning === auditRunning) |
141 return; | 141 return; |
142 this._auditRunning = auditRunning; | 142 this._auditRunning = auditRunning; |
143 this._updateButton(); | 143 this._updateButton(); |
144 this._toggleUIComponents(this._auditRunning); | 144 this._toggleUIComponents(this._auditRunning); |
145 var target = this._auditController.target(); | 145 var target = this._auditController.target(); |
146 if (this._auditRunning) { | 146 if (this._auditRunning) { |
147 target.profilingLock.acquire(); | 147 WebInspector.profilingLock.acquire(); |
148 this._startAudit(); | 148 this._startAudit(); |
149 } else { | 149 } else { |
150 this._stopAudit(); | 150 this._stopAudit(); |
151 target.profilingLock.release(); | 151 WebInspector.profilingLock.release(); |
152 } | 152 } |
153 }, | 153 }, |
154 | 154 |
155 _startAudit: function() | 155 _startAudit: function() |
156 { | 156 { |
157 var catIds = []; | 157 var catIds = []; |
158 for (var category = 0; category < this._sortedCategories.length; ++categ
ory) { | 158 for (var category = 0; category < this._sortedCategories.length; ++categ
ory) { |
159 if (this._sortedCategories[category]._checkboxElement.checked) | 159 if (this._sortedCategories[category]._checkboxElement.checked) |
160 catIds.push(this._sortedCategories[category].id); | 160 catIds.push(this._sortedCategories[category].id); |
161 } | 161 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 for (var i = 0, length = childNodes.length; i < length; ++i) | 320 for (var i = 0, length = childNodes.length; i < length; ++i) |
321 selectedCategories[childNodes[i].__displayName] = childNodes[i].firs
tChild.checked; | 321 selectedCategories[childNodes[i].__displayName] = childNodes[i].firs
tChild.checked; |
322 selectedCategories[WebInspector.AuditLauncherView.AllCategoriesKey] = th
is._selectAllCheckboxElement.checked; | 322 selectedCategories[WebInspector.AuditLauncherView.AllCategoriesKey] = th
is._selectAllCheckboxElement.checked; |
323 this._selectedCategoriesSetting.set(selectedCategories); | 323 this._selectedCategoriesSetting.set(selectedCategories); |
324 this._updateButton(); | 324 this._updateButton(); |
325 }, | 325 }, |
326 | 326 |
327 _updateButton: function() | 327 _updateButton: function() |
328 { | 328 { |
329 var target = this._auditController.target(); | 329 var target = this._auditController.target(); |
330 var enable = this._auditRunning || (this._currentCategoriesCount && !tar
get.profilingLock.isAcquired()); | 330 var enable = this._auditRunning || (this._currentCategoriesCount && !Web
Inspector.profilingLock.isAcquired()); |
331 this._launchButton.textContent = this._auditRunning ? WebInspector.UIStr
ing("Stop") : WebInspector.UIString("Run"); | 331 this._launchButton.textContent = this._auditRunning ? WebInspector.UIStr
ing("Stop") : WebInspector.UIString("Run"); |
332 this._launchButton.disabled = !enable; | 332 this._launchButton.disabled = !enable; |
333 this._launchButton.title = enable ? "" : WebInspector.anotherProfilerAct
iveLabel(); | 333 this._launchButton.title = enable ? "" : WebInspector.anotherProfilerAct
iveLabel(); |
334 }, | 334 }, |
335 | 335 |
336 __proto__: WebInspector.VBox.prototype | 336 __proto__: WebInspector.VBox.prototype |
337 } | 337 } |
OLD | NEW |