Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.ElementsPanel.BaseToolbarPaneWidget} | 7 * @extends {WebInspector.ElementsPanel.BaseToolbarPaneWidget} |
| 8 * @param {!WebInspector.ToolbarItem} toolbarItem | 8 * @param {!WebInspector.ToolbarItem} toolbarItem |
| 9 */ | 9 */ |
| 10 WebInspector.ElementStatePaneWidget = function(toolbarItem) | 10 WebInspector.ElementStatePaneWidget = function(toolbarItem) |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 | 117 |
| 118 __proto__: WebInspector.ElementsPanel.BaseToolbarPaneWidget.prototype | 118 __proto__: WebInspector.ElementsPanel.BaseToolbarPaneWidget.prototype |
| 119 } | 119 } |
| 120 | 120 |
| 121 /** | 121 /** |
| 122 * @constructor | 122 * @constructor |
| 123 * @implements {WebInspector.ToolbarItem.Provider} | 123 * @implements {WebInspector.ToolbarItem.Provider} |
| 124 */ | 124 */ |
| 125 WebInspector.ElementStatePaneWidget.ButtonProvider = function() | 125 WebInspector.ElementStatePaneWidget.ButtonProvider = function() |
| 126 { | 126 { |
| 127 this._button = new WebInspector.ToolbarToggle(WebInspector.UIString("Toggle Element State"), "pin-toolbar-item"); | 127 this._button = new WebInspector.ToolbarToggle(WebInspector.UIString("Toggle Element State"), "", WebInspector.UIString(":hover")); |
|
dgozman
2016/01/14 22:05:21
Kill the class and image as well?
| |
| 128 this._button.addEventListener("click", this._clicked, this); | 128 this._button.addEventListener("click", this._clicked, this); |
| 129 this._view = new WebInspector.ElementStatePaneWidget(this.item()); | 129 this._view = new WebInspector.ElementStatePaneWidget(this.item()); |
| 130 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._nod eChanged, this); | 130 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._nod eChanged, this); |
| 131 this._nodeChanged(); | 131 this._nodeChanged(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 WebInspector.ElementStatePaneWidget.ButtonProvider.prototype = { | 134 WebInspector.ElementStatePaneWidget.ButtonProvider.prototype = { |
| 135 _clicked: function() | 135 _clicked: function() |
| 136 { | 136 { |
| 137 WebInspector.ElementsPanel.instance().showToolbarPane(!this._view.isShow ing() ? this._view : null); | 137 WebInspector.ElementsPanel.instance().showToolbarPane(!this._view.isShow ing() ? this._view : null); |
| 138 }, | 138 }, |
| 139 | 139 |
| 140 /** | 140 /** |
| 141 * @override | 141 * @override |
| 142 * @return {!WebInspector.ToolbarItem} | 142 * @return {!WebInspector.ToolbarItem} |
| 143 */ | 143 */ |
| 144 item: function() | 144 item: function() |
| 145 { | 145 { |
| 146 return this._button; | 146 return this._button; |
| 147 }, | 147 }, |
| 148 | 148 |
| 149 _nodeChanged: function() | 149 _nodeChanged: function() |
| 150 { | 150 { |
| 151 var enabled = !!WebInspector.context.flavor(WebInspector.DOMNode); | 151 var enabled = !!WebInspector.context.flavor(WebInspector.DOMNode); |
| 152 this._button.setEnabled(enabled); | 152 this._button.setEnabled(enabled); |
| 153 if (!enabled && this._button.toggled()) | 153 if (!enabled && this._button.toggled()) |
| 154 WebInspector.ElementsPanel.instance().showToolbarPane(null); | 154 WebInspector.ElementsPanel.instance().showToolbarPane(null); |
| 155 } | 155 } |
| 156 } | 156 } |
| OLD | NEW |