| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * | 10 * |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 { | 34 { |
| 35 this._toggleSearchAction = WebInspector.actionRegistry.action("elements.togg
le-element-search"); | 35 this._toggleSearchAction = WebInspector.actionRegistry.action("elements.togg
le-element-search"); |
| 36 if (Runtime.experiments.isEnabled("layoutEditor")) { | 36 if (Runtime.experiments.isEnabled("layoutEditor")) { |
| 37 this._layoutEditorButton = new WebInspector.ToolbarToggle(WebInspector.U
IString("Toggle Layout Editor"), "layout-editor-toolbar-item"); | 37 this._layoutEditorButton = new WebInspector.ToolbarToggle(WebInspector.U
IString("Toggle Layout Editor"), "layout-editor-toolbar-item"); |
| 38 this._layoutEditorButton.addEventListener("click", this._toggleLayoutEdi
tor, this); | 38 this._layoutEditorButton.addEventListener("click", this._toggleLayoutEdi
tor, this); |
| 39 } | 39 } |
| 40 | 40 |
| 41 this._mode = DOMAgent.InspectMode.None; | 41 this._mode = DOMAgent.InspectMode.None; |
| 42 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event
s.SuspendStateChanged, this._suspendStateChanged, this); | 42 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event
s.SuspendStateChanged, this._suspendStateChanged, this); |
| 43 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capabili
ty.DOM); | 43 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capabili
ty.DOM); |
| 44 } | 44 }; |
| 45 | 45 |
| 46 WebInspector.InspectElementModeController.prototype = { | 46 WebInspector.InspectElementModeController.prototype = { |
| 47 /** | 47 /** |
| 48 * @override | 48 * @override |
| 49 * @param {!WebInspector.Target} target | 49 * @param {!WebInspector.Target} target |
| 50 */ | 50 */ |
| 51 targetAdded: function(target) | 51 targetAdded: function(target) |
| 52 { | 52 { |
| 53 // When DevTools are opening in the inspect element mode, the first targ
et comes in | 53 // When DevTools are opening in the inspect element mode, the first targ
et comes in |
| 54 // much later than the InspectorFrontendAPI.enterInspectElementMode even
t. | 54 // much later than the InspectorFrontendAPI.enterInspectElementMode even
t. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 _suspendStateChanged: function() | 129 _suspendStateChanged: function() |
| 130 { | 130 { |
| 131 if (!WebInspector.targetManager.allTargetsSuspended()) | 131 if (!WebInspector.targetManager.allTargetsSuspended()) |
| 132 return; | 132 return; |
| 133 | 133 |
| 134 this._mode = DOMAgent.InspectMode.None; | 134 this._mode = DOMAgent.InspectMode.None; |
| 135 this._toggleSearchAction.setToggled(false); | 135 this._toggleSearchAction.setToggled(false); |
| 136 if (this._layoutEditorButton) | 136 if (this._layoutEditorButton) |
| 137 this._layoutEditorButton.setToggled(false); | 137 this._layoutEditorButton.setToggled(false); |
| 138 } | 138 } |
| 139 } | 139 }; |
| 140 | 140 |
| 141 /** | 141 /** |
| 142 * @constructor | 142 * @constructor |
| 143 * @implements {WebInspector.ActionDelegate} | 143 * @implements {WebInspector.ActionDelegate} |
| 144 */ | 144 */ |
| 145 WebInspector.InspectElementModeController.ToggleSearchActionDelegate = function(
) | 145 WebInspector.InspectElementModeController.ToggleSearchActionDelegate = function(
) |
| 146 { | 146 { |
| 147 } | 147 }; |
| 148 | 148 |
| 149 WebInspector.InspectElementModeController.ToggleSearchActionDelegate.prototype =
{ | 149 WebInspector.InspectElementModeController.ToggleSearchActionDelegate.prototype =
{ |
| 150 /** | 150 /** |
| 151 * @override | 151 * @override |
| 152 * @param {!WebInspector.Context} context | 152 * @param {!WebInspector.Context} context |
| 153 * @param {string} actionId | 153 * @param {string} actionId |
| 154 * @return {boolean} | 154 * @return {boolean} |
| 155 */ | 155 */ |
| 156 handleAction: function(context, actionId) | 156 handleAction: function(context, actionId) |
| 157 { | 157 { |
| 158 if (!WebInspector.inspectElementModeController) | 158 if (!WebInspector.inspectElementModeController) |
| 159 return false; | 159 return false; |
| 160 WebInspector.inspectElementModeController._toggleInspectMode(); | 160 WebInspector.inspectElementModeController._toggleInspectMode(); |
| 161 return true; | 161 return true; |
| 162 } | 162 } |
| 163 } | 163 }; |
| 164 | 164 |
| 165 /** | 165 /** |
| 166 * @constructor | 166 * @constructor |
| 167 * @implements {WebInspector.ToolbarItem.Provider} | 167 * @implements {WebInspector.ToolbarItem.Provider} |
| 168 */ | 168 */ |
| 169 WebInspector.InspectElementModeController.LayoutEditorButtonProvider = function(
) | 169 WebInspector.InspectElementModeController.LayoutEditorButtonProvider = function(
) |
| 170 { | 170 { |
| 171 } | 171 }; |
| 172 | 172 |
| 173 WebInspector.InspectElementModeController.LayoutEditorButtonProvider.prototype =
{ | 173 WebInspector.InspectElementModeController.LayoutEditorButtonProvider.prototype =
{ |
| 174 /** | 174 /** |
| 175 * @override | 175 * @override |
| 176 * @return {?WebInspector.ToolbarItem} | 176 * @return {?WebInspector.ToolbarItem} |
| 177 */ | 177 */ |
| 178 item: function() | 178 item: function() |
| 179 { | 179 { |
| 180 if (!WebInspector.inspectElementModeController) | 180 if (!WebInspector.inspectElementModeController) |
| 181 return null; | 181 return null; |
| 182 | 182 |
| 183 return WebInspector.inspectElementModeController._layoutEditorButton; | 183 return WebInspector.inspectElementModeController._layoutEditorButton; |
| 184 } | 184 } |
| 185 } | 185 }; |
| 186 | 186 |
| 187 /** @type {?WebInspector.InspectElementModeController} */ | 187 /** @type {?WebInspector.InspectElementModeController} */ |
| 188 WebInspector.inspectElementModeController = Runtime.queryParam("isSharedWorker")
? null : new WebInspector.InspectElementModeController(); | 188 WebInspector.inspectElementModeController = Runtime.queryParam("isSharedWorker")
? null : new WebInspector.InspectElementModeController(); |
| OLD | NEW |