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

Side by Side Diff: Source/devtools/front_end/elements/ElementsPanel.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) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 20 matching lines...) Expand all
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @implements {WebInspector.Searchable} 33 * @implements {WebInspector.Searchable}
34 * @implements {WebInspector.TargetManager.Observer} 34 * @implements {WebInspector.TargetManager.Observer}
35 * @extends {WebInspector.Panel} 35 * @extends {WebInspector.Panel}
36 */ 36 */
37 WebInspector.ElementsPanel = function() 37 WebInspector.ElementsPanel = function()
38 { 38 {
39 WebInspector.Panel.call(this, "elements"); 39 WebInspector.Panel.call(this, "elements");
40 this.registerRequiredCSS("elementsPanel.css"); 40 this.registerRequiredCSS("elementsPanel.css");
41 this.setHideOnDetach();
42 41
43 this._splitView = new WebInspector.SplitView(true, true, "elementsPanelSplit ViewState", 325, 325); 42 this._splitView = new WebInspector.SplitView(true, true, "elementsPanelSplit ViewState", 325, 325);
44 this._splitView.addEventListener(WebInspector.SplitView.Events.SidebarSizeCh anged, this._updateTreeOutlineVisibleWidth.bind(this)); 43 this._splitView.addEventListener(WebInspector.SplitView.Events.SidebarSizeCh anged, this._updateTreeOutlineVisibleWidth.bind(this));
45 this._splitView.show(this.element); 44 this._splitView.show(this.element);
46 45
47 this._searchableView = new WebInspector.SearchableView(this); 46 this._searchableView = new WebInspector.SearchableView(this);
48 this._searchableView.setMinimumSize(25, 19); 47 this._searchableView.setMinimumSize(25, 19);
49 this._searchableView.show(this._splitView.mainElement()); 48 this._searchableView.show(this._splitView.mainElement());
50 var stackElement = this._searchableView.element; 49 var stackElement = this._searchableView.element;
51 50
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 this.sidebarPanes.styles.addEventListener(WebInspector.SidebarPane.EventType s.wasShown, this.updateStyles.bind(this, false)); 84 this.sidebarPanes.styles.addEventListener(WebInspector.SidebarPane.EventType s.wasShown, this.updateStyles.bind(this, false));
86 this.sidebarPanes.metrics.addEventListener(WebInspector.SidebarPane.EventTyp es.wasShown, this.updateMetrics.bind(this)); 85 this.sidebarPanes.metrics.addEventListener(WebInspector.SidebarPane.EventTyp es.wasShown, this.updateMetrics.bind(this));
87 this.sidebarPanes.platformFonts.addEventListener(WebInspector.SidebarPane.Ev entTypes.wasShown, this.updatePlatformFonts.bind(this)); 86 this.sidebarPanes.platformFonts.addEventListener(WebInspector.SidebarPane.Ev entTypes.wasShown, this.updatePlatformFonts.bind(this));
88 this.sidebarPanes.properties.addEventListener(WebInspector.SidebarPane.Event Types.wasShown, this.updateProperties.bind(this)); 87 this.sidebarPanes.properties.addEventListener(WebInspector.SidebarPane.Event Types.wasShown, this.updateProperties.bind(this));
89 this.sidebarPanes.eventListeners.addEventListener(WebInspector.SidebarPane.E ventTypes.wasShown, this.updateEventListeners.bind(this)); 88 this.sidebarPanes.eventListeners.addEventListener(WebInspector.SidebarPane.E ventTypes.wasShown, this.updateEventListeners.bind(this));
90 this.sidebarPanes.animations.addEventListener(WebInspector.SidebarPane.Event Types.wasShown, this.updateAnimations.bind(this)); 89 this.sidebarPanes.animations.addEventListener(WebInspector.SidebarPane.Event Types.wasShown, this.updateAnimations.bind(this));
91 90
92 this.sidebarPanes.styles.addEventListener("style edited", this._stylesPaneEd ited, this); 91 this.sidebarPanes.styles.addEventListener("style edited", this._stylesPaneEd ited, this);
93 this.sidebarPanes.styles.addEventListener("style property toggled", this._st ylesPaneEdited, this); 92 this.sidebarPanes.styles.addEventListener("style property toggled", this._st ylesPaneEdited, this);
94 this.sidebarPanes.metrics.addEventListener("metrics edited", this._metricsPa neEdited, this); 93 this.sidebarPanes.metrics.addEventListener("metrics edited", this._metricsPa neEdited, this);
95 this._extensionSidebarPanes = [];
96 94
97 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve nts.DockSideChanged, this._dockSideChanged.bind(this)); 95 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve nts.DockSideChanged, this._dockSideChanged.bind(this));
98 WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(thi s._dockSideChanged.bind(this)); 96 WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(thi s._dockSideChanged.bind(this));
99 this._dockSideChanged(); 97 this._dockSideChanged();
100 98
101 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this._get PopoverAnchor.bind(this), this._showPopover.bind(this)); 99 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this._get PopoverAnchor.bind(this), this._showPopover.bind(this));
102 this._popoverHelper.setTimeout(0); 100 this._popoverHelper.setTimeout(0);
103 101
104 /** @type {!Array.<!WebInspector.ElementsTreeOutline>} */ 102 /** @type {!Array.<!WebInspector.ElementsTreeOutline>} */
105 this._treeOutlines = []; 103 this._treeOutlines = [];
106 /** @type {!Map.<!WebInspector.Target, !WebInspector.ElementsTreeOutline>} * / 104 /** @type {!Map.<!WebInspector.Target, !WebInspector.ElementsTreeOutline>} * /
107 this._targetToTreeOutline = new Map(); 105 this._targetToTreeOutline = new Map();
108 WebInspector.targetManager.observeTargets(this); 106 WebInspector.targetManager.observeTargets(this);
109 WebInspector.settings.showUAShadowDOM.addChangeListener(this._showUAShadowDO MChanged.bind(this)); 107 WebInspector.settings.showUAShadowDOM.addChangeListener(this._showUAShadowDO MChanged.bind(this));
110 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspec tor.DOMModel.Events.DocumentUpdated, this._documentUpdatedEvent, this); 108 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspec tor.DOMModel.Events.DocumentUpdated, this._documentUpdatedEvent, this);
111 WebInspector.targetManager.addModelListener(WebInspector.CSSStyleModel, WebI nspector.CSSStyleModel.Events.ModelWasEnabled, this._updateSidebars, this); 109 WebInspector.targetManager.addModelListener(WebInspector.CSSStyleModel, WebI nspector.CSSStyleModel.Events.ModelWasEnabled, this._updateSidebars, this);
110 WebInspector.extensionServer.addEventListener(WebInspector.ExtensionServer.E vents.SidebarPaneAdded, this._extensionSidebarPaneAdded, this);
112 } 111 }
113 112
114 WebInspector.ElementsPanel.prototype = { 113 WebInspector.ElementsPanel.prototype = {
115 _onEditingSelectorStarted: function() 114 _onEditingSelectorStarted: function()
116 { 115 {
117 for (var i = 0; i < this._treeOutlines.length; ++i) 116 for (var i = 0; i < this._treeOutlines.length; ++i)
118 this._treeOutlines[i].setPickNodeMode(true); 117 this._treeOutlines[i].setPickNodeMode(true);
119 }, 118 },
120 119
121 _onEditingSelectorEnded: function() 120 _onEditingSelectorEnded: function()
(...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 showMetrics.call(this, vertically); 1423 showMetrics.call(this, vertically);
1425 this.sidebarPanes.platformFonts.show(computedStylePanesWrapper); 1424 this.sidebarPanes.platformFonts.show(computedStylePanesWrapper);
1426 1425
1427 this.sidebarPaneView.addPane(this.sidebarPanes.eventListeners); 1426 this.sidebarPaneView.addPane(this.sidebarPanes.eventListeners);
1428 this.sidebarPaneView.addPane(this.sidebarPanes.domBreakpoints); 1427 this.sidebarPaneView.addPane(this.sidebarPanes.domBreakpoints);
1429 this.sidebarPaneView.addPane(this.sidebarPanes.properties); 1428 this.sidebarPaneView.addPane(this.sidebarPanes.properties);
1430 if (Runtime.experiments.isEnabled("animationInspection")) 1429 if (Runtime.experiments.isEnabled("animationInspection"))
1431 this.sidebarPaneView.addPane(this.sidebarPanes.animations); 1430 this.sidebarPaneView.addPane(this.sidebarPanes.animations);
1432 this._extensionSidebarPanesContainer = this.sidebarPaneView; 1431 this._extensionSidebarPanesContainer = this.sidebarPaneView;
1433 1432
1434 for (var i = 0; i < this._extensionSidebarPanes.length; ++i) 1433 var extensionSidebarPanes = WebInspector.extensionServer.sidebarPanes();
1435 this._extensionSidebarPanesContainer.addPane(this._extensionSidebarP anes[i]); 1434 for (var i = 0; i < extensionSidebarPanes.length; ++i)
1435 this._addExtensionSidebarPane(extensionSidebarPanes[i]);
1436 1436
1437 this.sidebarPaneView.show(this._splitView.sidebarElement()); 1437 this.sidebarPaneView.show(this._splitView.sidebarElement());
1438 this.sidebarPanes.styles.expand(); 1438 this.sidebarPanes.styles.expand();
1439 }, 1439 },
1440 1440
1441 /** 1441 /**
1442 * @param {string} id 1442 * @param {!WebInspector.Event} event
1443 * @param {!WebInspector.SidebarPane} pane
1444 */ 1443 */
1445 addExtensionSidebarPane: function(id, pane) 1444 _extensionSidebarPaneAdded: function(event)
1446 { 1445 {
1447 this._extensionSidebarPanes.push(pane); 1446 var pane = /** @type {!WebInspector.ExtensionSidebarPane} */ (event.data );
1448 this._extensionSidebarPanesContainer.addPane(pane); 1447 this._addExtensionSidebarPane(pane);
1448 },
1449
1450 /**
1451 * @param {!WebInspector.ExtensionSidebarPane} pane
1452 */
1453 _addExtensionSidebarPane: function(pane)
1454 {
1455 if (pane.panelName() === this.name) {
1456 this.setHideOnDetach();
1457 this._extensionSidebarPanesContainer.addPane(pane);
1458 }
1449 }, 1459 },
1450 1460
1451 __proto__: WebInspector.Panel.prototype 1461 __proto__: WebInspector.Panel.prototype
1452 } 1462 }
1453 1463
1454 /** 1464 /**
1455 * @constructor 1465 * @constructor
1456 * @implements {WebInspector.ContextMenu.Provider} 1466 * @implements {WebInspector.ContextMenu.Provider}
1457 */ 1467 */
1458 WebInspector.ElementsPanel.ContextMenuProvider = function() 1468 WebInspector.ElementsPanel.ContextMenuProvider = function()
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 1555
1546 WebInspector.ElementsPanelFactory.prototype = { 1556 WebInspector.ElementsPanelFactory.prototype = {
1547 /** 1557 /**
1548 * @return {!WebInspector.Panel} 1558 * @return {!WebInspector.Panel}
1549 */ 1559 */
1550 createPanel: function() 1560 createPanel: function()
1551 { 1561 {
1552 return WebInspector.ElementsPanel.instance(); 1562 return WebInspector.ElementsPanel.instance();
1553 } 1563 }
1554 } 1564 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698