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

Side by Side Diff: Source/devtools/front_end/audits/AuditsPanel.js

Issue 667623002: DevTools: make extension server a part of core, panels' code should depend on it. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: for review Created 6 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 this.auditResultsTreeElement = new WebInspector.SidebarSectionTreeElement(We bInspector.UIString("RESULTS"), {}, true); 48 this.auditResultsTreeElement = new WebInspector.SidebarSectionTreeElement(We bInspector.UIString("RESULTS"), {}, true);
49 this.sidebarTree.appendChild(this.auditResultsTreeElement); 49 this.sidebarTree.appendChild(this.auditResultsTreeElement);
50 this.auditResultsTreeElement.expand(); 50 this.auditResultsTreeElement.expand();
51 51
52 this._constructCategories(); 52 this._constructCategories();
53 53
54 this._auditController = new WebInspector.AuditController(this); 54 this._auditController = new WebInspector.AuditController(this);
55 this._launcherView = new WebInspector.AuditLauncherView(this._auditControlle r); 55 this._launcherView = new WebInspector.AuditLauncherView(this._auditControlle r);
56 for (var id in this.categoriesById) 56 for (var id in this.categoriesById)
57 this._launcherView.addCategory(this.categoriesById[id]); 57 this._launcherView.addCategory(this.categoriesById[id]);
58
59 var extensionCategories = WebInspector.extensionServer.auditCategories();
60 for (var i = 0; i < extensionCategories.length; ++i) {
61 var category = extensionCategories[i];
62 this.addCategory(new WebInspector.AuditExtensionCategory(category.extens ionOrigin, category.id, category.displayName, category.ruleCount));
63 }
64 WebInspector.extensionServer.addEventListener(WebInspector.ExtensionServer.E vents.AuditCategoryAdded, this._extensionAuditCategoryAdded, this);
58 } 65 }
59 66
60 WebInspector.AuditsPanel.prototype = { 67 WebInspector.AuditsPanel.prototype = {
61 /** 68 /**
62 * @return {boolean} 69 * @return {boolean}
63 */ 70 */
64 canSearch: function() 71 canSearch: function()
65 { 72 {
66 return false; 73 return false;
67 }, 74 },
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 if (!this._visibleView) 168 if (!this._visibleView)
162 this.auditsItemTreeElement.select(); 169 this.auditsItemTreeElement.select();
163 }, 170 },
164 171
165 clearResults: function() 172 clearResults: function()
166 { 173 {
167 this.auditsItemTreeElement.revealAndSelect(); 174 this.auditsItemTreeElement.revealAndSelect();
168 this.auditResultsTreeElement.removeChildren(); 175 this.auditResultsTreeElement.removeChildren();
169 }, 176 },
170 177
178 /**
179 * @param {!WebInspector.Event} event
180 */
181 _extensionAuditCategoryAdded: function(event)
182 {
183 var category = /** @type {!WebInspector.ExtensionAuditCategory} */ (even t.data);
184 this.addCategory(new WebInspector.AuditExtensionCategory(category.extens ionOrigin, category.id, category.displayName, category.ruleCount));
185 },
186
171 __proto__: WebInspector.PanelWithSidebarTree.prototype 187 __proto__: WebInspector.PanelWithSidebarTree.prototype
172 } 188 }
173 189
174 /** 190 /**
175 * @constructor 191 * @constructor
176 * @implements {WebInspector.AuditCategory} 192 * @implements {WebInspector.AuditCategory}
177 * @param {string} displayName 193 * @param {string} displayName
178 */ 194 */
179 WebInspector.AuditCategoryImpl = function(displayName) 195 WebInspector.AuditCategoryImpl = function(displayName)
180 { 196 {
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 } 568 }
553 569
554 // Contributed audit rules should go into this namespace. 570 // Contributed audit rules should go into this namespace.
555 WebInspector.AuditRules = {}; 571 WebInspector.AuditRules = {};
556 572
557 /** 573 /**
558 * Contributed audit categories should go into this namespace. 574 * Contributed audit categories should go into this namespace.
559 * @type {!Object.<string, function(new:WebInspector.AuditCategory)>} 575 * @type {!Object.<string, function(new:WebInspector.AuditCategory)>}
560 */ 576 */
561 WebInspector.AuditCategories = {}; 577 WebInspector.AuditCategories = {};
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698