OLD | NEW |
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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 /** | 31 /** |
32 * @unrestricted | 32 * @unrestricted |
33 */ | 33 */ |
34 Audits.AuditsPanel = class extends UI.PanelWithSidebar { | 34 Audits.AuditsPanel = class extends UI.PanelWithSidebar { |
35 constructor() { | 35 constructor() { |
36 super('audits'); | 36 super('audits'); |
37 this.registerRequiredCSS('ui/panelEnablerView.css'); | 37 this.registerRequiredCSS('ui/panelEnablerView.css'); |
38 this.registerRequiredCSS('audits/auditsPanel.css'); | 38 this.registerRequiredCSS('audits/auditsPanel.css'); |
39 | 39 |
40 this._sidebarTree = new TreeOutlineInShadow(); | 40 this._sidebarTree = new UI.TreeOutlineInShadow(); |
41 this._sidebarTree.registerRequiredCSS('audits/auditsSidebarTree.css'); | 41 this._sidebarTree.registerRequiredCSS('audits/auditsSidebarTree.css'); |
42 this.panelSidebarElement().appendChild(this._sidebarTree.element); | 42 this.panelSidebarElement().appendChild(this._sidebarTree.element); |
43 | 43 |
44 this._auditsItemTreeElement = new Audits.AuditsSidebarTreeElement(this); | 44 this._auditsItemTreeElement = new Audits.AuditsSidebarTreeElement(this); |
45 this._sidebarTree.appendChild(this._auditsItemTreeElement); | 45 this._sidebarTree.appendChild(this._auditsItemTreeElement); |
46 | 46 |
47 this._auditResultsTreeElement = new TreeElement(Common.UIString('RESULTS'),
true); | 47 this._auditResultsTreeElement = new UI.TreeElement(Common.UIString('RESULTS'
), true); |
48 this._auditResultsTreeElement.selectable = false; | 48 this._auditResultsTreeElement.selectable = false; |
49 this._auditResultsTreeElement.listItemElement.classList.add('audits-sidebar-
results'); | 49 this._auditResultsTreeElement.listItemElement.classList.add('audits-sidebar-
results'); |
50 this._auditResultsTreeElement.expand(); | 50 this._auditResultsTreeElement.expand(); |
51 this._sidebarTree.appendChild(this._auditResultsTreeElement); | 51 this._sidebarTree.appendChild(this._auditResultsTreeElement); |
52 | 52 |
53 this._constructCategories(); | 53 this._constructCategories(); |
54 | 54 |
55 this._auditController = new Audits.AuditController(this); | 55 this._auditController = new Audits.AuditController(this); |
56 this._launcherView = new Audits.AuditLauncherView(this._auditController); | 56 this._launcherView = new Audits.AuditLauncherView(this._auditController); |
57 for (var id in this.categoriesById) | 57 for (var id in this.categoriesById) |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 if (formattedResult instanceof Node) | 444 if (formattedResult instanceof Node) |
445 formattedResult.normalize(); | 445 formattedResult.normalize(); |
446 return this.addChild(formattedResult); | 446 return this.addChild(formattedResult); |
447 } | 447 } |
448 }; | 448 }; |
449 | 449 |
450 | 450 |
451 /** | 451 /** |
452 * @unrestricted | 452 * @unrestricted |
453 */ | 453 */ |
454 Audits.AuditsSidebarTreeElement = class extends TreeElement { | 454 Audits.AuditsSidebarTreeElement = class extends UI.TreeElement { |
455 /** | 455 /** |
456 * @param {!Audits.AuditsPanel} panel | 456 * @param {!Audits.AuditsPanel} panel |
457 */ | 457 */ |
458 constructor(panel) { | 458 constructor(panel) { |
459 super(Common.UIString('Audits'), false); | 459 super(Common.UIString('Audits'), false); |
460 this.selectable = true; | 460 this.selectable = true; |
461 this._panel = panel; | 461 this._panel = panel; |
462 this.listItemElement.classList.add('audits-sidebar-header'); | 462 this.listItemElement.classList.add('audits-sidebar-header'); |
463 this.listItemElement.insertBefore(createElementWithClass('div', 'icon'), thi
s.listItemElement.firstChild); | 463 this.listItemElement.insertBefore(createElementWithClass('div', 'icon'), thi
s.listItemElement.firstChild); |
464 } | 464 } |
465 | 465 |
466 /** | 466 /** |
467 * @override | 467 * @override |
468 * @return {boolean} | 468 * @return {boolean} |
469 */ | 469 */ |
470 onselect() { | 470 onselect() { |
471 this._panel.showLauncherView(); | 471 this._panel.showLauncherView(); |
472 return true; | 472 return true; |
473 } | 473 } |
474 }; | 474 }; |
475 | 475 |
476 /** | 476 /** |
477 * @unrestricted | 477 * @unrestricted |
478 */ | 478 */ |
479 Audits.AuditResultSidebarTreeElement = class extends TreeElement { | 479 Audits.AuditResultSidebarTreeElement = class extends UI.TreeElement { |
480 /** | 480 /** |
481 * @param {!Audits.AuditsPanel} panel | 481 * @param {!Audits.AuditsPanel} panel |
482 * @param {!Array.<!Audits.AuditCategoryResult>} results | 482 * @param {!Array.<!Audits.AuditCategoryResult>} results |
483 * @param {string} mainResourceURL | 483 * @param {string} mainResourceURL |
484 * @param {number} ordinal | 484 * @param {number} ordinal |
485 */ | 485 */ |
486 constructor(panel, results, mainResourceURL, ordinal) { | 486 constructor(panel, results, mainResourceURL, ordinal) { |
487 super(String.sprintf('%s (%d)', mainResourceURL, ordinal), false); | 487 super(String.sprintf('%s (%d)', mainResourceURL, ordinal), false); |
488 this.selectable = true; | 488 this.selectable = true; |
489 this._panel = panel; | 489 this._panel = panel; |
(...skipping 15 matching lines...) Expand all Loading... |
505 | 505 |
506 | 506 |
507 // Contributed audit rules should go into this namespace. | 507 // Contributed audit rules should go into this namespace. |
508 Audits.AuditRules = {}; | 508 Audits.AuditRules = {}; |
509 | 509 |
510 /** | 510 /** |
511 * Contributed audit categories should go into this namespace. | 511 * Contributed audit categories should go into this namespace. |
512 * @type {!Object.<string, function(new:Audits.AuditCategory)>} | 512 * @type {!Object.<string, function(new:Audits.AuditCategory)>} |
513 */ | 513 */ |
514 Audits.AuditCategories = {}; | 514 Audits.AuditCategories = {}; |
OLD | NEW |