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

Side by Side Diff: Source/devtools/front_end/elements/ElementsPanel.js

Issue 400633003: DevTools: introduce multitarget model listeners (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this._get PopoverAnchor.bind(this), this._showPopover.bind(this)); 109 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this._get PopoverAnchor.bind(this), this._showPopover.bind(this));
110 this._popoverHelper.setTimeout(0); 110 this._popoverHelper.setTimeout(0);
111 111
112 /** @type {!Array.<!WebInspector.ElementsTreeOutline>} */ 112 /** @type {!Array.<!WebInspector.ElementsTreeOutline>} */
113 this._treeOutlines = []; 113 this._treeOutlines = [];
114 /** @type {!Map.<!WebInspector.Target, !WebInspector.ElementsTreeOutline>} * / 114 /** @type {!Map.<!WebInspector.Target, !WebInspector.ElementsTreeOutline>} * /
115 this._targetToTreeOutline = new Map(); 115 this._targetToTreeOutline = new Map();
116 WebInspector.targetManager.observeTargets(this); 116 WebInspector.targetManager.observeTargets(this);
117 WebInspector.settings.showUAShadowDOM.addChangeListener(this._showUAShadowDO MChanged.bind(this)); 117 WebInspector.settings.showUAShadowDOM.addChangeListener(this._showUAShadowDO MChanged.bind(this));
118 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspec tor.DOMModel.Events.DocumentUpdated, this._documentUpdatedEvent, this);
119 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspec tor.CSSStyleModel.Events.ModelWasEnabled, this._updateSidebars, this);
118 } 120 }
119 121
120 WebInspector.ElementsPanel.prototype = { 122 WebInspector.ElementsPanel.prototype = {
121 /** 123 /**
122 * @param {!WebInspector.Target} target 124 * @param {!WebInspector.Target} target
123 */ 125 */
124 targetAdded: function(target) 126 targetAdded: function(target)
125 { 127 {
126 var treeOutline = new WebInspector.ElementsTreeOutline(target, true, tru e, this._populateContextMenu.bind(this), this._setPseudoClassForNode.bind(this)) ; 128 var treeOutline = new WebInspector.ElementsTreeOutline(target, true, tru e, this._populateContextMenu.bind(this), this._setPseudoClassForNode.bind(this)) ;
127 treeOutline.wireToDOMModel(); 129 treeOutline.wireToDOMModel();
128 treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.Sel ectedNodeChanged, this._selectedNodeChanged, this); 130 treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.Sel ectedNodeChanged, this._selectedNodeChanged, this);
129 treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.Ele mentsTreeUpdated, this._updateBreadcrumbIfNeeded, this); 131 treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.Ele mentsTreeUpdated, this._updateBreadcrumbIfNeeded, this);
130 this._treeOutlines.push(treeOutline); 132 this._treeOutlines.push(treeOutline);
131 this._targetToTreeOutline.put(target, treeOutline); 133 this._targetToTreeOutline.put(target, treeOutline);
132 134
133 target.domModel.addEventListener(WebInspector.DOMModel.Events.DocumentUp dated, this._documentUpdatedEvent, this);
134 target.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Model WasEnabled, this._updateSidebars, this);
135
136 // Perform attach if necessary. 135 // Perform attach if necessary.
137 if (this.isShowing()) 136 if (this.isShowing())
138 this.wasShown(); 137 this.wasShown();
139 }, 138 },
140 139
141 /** 140 /**
142 * @param {!WebInspector.Target} target 141 * @param {!WebInspector.Target} target
143 */ 142 */
144 targetRemoved: function(target) 143 targetRemoved: function(target)
145 { 144 {
146 var treeOutline = this._targetToTreeOutline.remove(target); 145 var treeOutline = this._targetToTreeOutline.remove(target);
147 treeOutline.unwireFromDOMModel(); 146 treeOutline.unwireFromDOMModel();
148 this._treeOutlines.remove(treeOutline); 147 this._treeOutlines.remove(treeOutline);
149 treeOutline.element.remove(); 148 treeOutline.element.remove();
150
151 target.domModel.removeEventListener(WebInspector.DOMModel.Events.Documen tUpdated, this._documentUpdatedEvent, this);
152 target.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.Mo delWasEnabled, this._updateSidebars, this);
153 }, 149 },
154 150
155 /** 151 /**
156 * @return {?WebInspector.ElementsTreeOutline} 152 * @return {?WebInspector.ElementsTreeOutline}
157 */ 153 */
158 _firstTreeOutlineDeprecated: function() 154 _firstTreeOutlineDeprecated: function()
159 { 155 {
160 return this._treeOutlines[0] || null; 156 return this._treeOutlines[0] || null;
161 }, 157 },
162 158
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 /** 1497 /**
1502 * @suppressReceiverCheck 1498 * @suppressReceiverCheck
1503 * @this {Element} 1499 * @this {Element}
1504 */ 1500 */
1505 function parentElement() 1501 function parentElement()
1506 { 1502 {
1507 return this.parentElement; 1503 return this.parentElement;
1508 } 1504 }
1509 } 1505 }
1510 } 1506 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/console/ConsoleView.js ('k') | Source/devtools/front_end/extensions/ExtensionServer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698