2 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following disclaimer
13 * in the documentation and/or other materials provided with the
16 * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC.
20 * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 WebInspector.InspectElementModeController = function()
34 this._toggleSearchButton = new WebInspector.StatusBarButton(WebInspector.UIString("Select an element in the page to inspect it."), "node-search-status-bar-item");
35 this._shortcut = WebInspector.InspectElementModeController.createShortcut();
36 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.EnterInspectElementMode, this._toggleSearch, this);
40 * @return {!WebInspector.KeyboardShortcut.Descriptor}
42 WebInspector.InspectElementModeController.createShortcut = function()
44 return WebInspector.KeyboardShortcut.makeDescriptor("c", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta | WebInspector.KeyboardShortcut.Modifiers.Shift);
47 WebInspector.InspectElementModeController.prototype = {
53 return this._toggleSearchButton.toggled;
62 _toggleSearch: function()
64 var enabled = !this.enabled();
65 this._toggleSearchButton.toggled = enabled;
67 var targets = WebInspector.targetManager.targets();
68 for (var i = 0; i < targets.length; ++i)
69 targets[i].domModel.setInspectModeEnabled(enabled, WebInspector.settings.showUAShadowDOM.get());
75 * @implements {WebInspector.ActionDelegate}
77 WebInspector.InspectElementModeController.ToggleSearchActionDelegate = function()
81 WebInspector.InspectElementModeController.ToggleSearchActionDelegate.prototype = {
85 handleAction: function()
87 if (!WebInspector.inspectElementModeController)
89 WebInspector.inspectElementModeController._toggleSearch();
96 * @implements {WebInspector.StatusBarItem.Provider}
98 WebInspector.InspectElementModeController.ToggleButtonProvider = function()
102 WebInspector.InspectElementModeController.ToggleButtonProvider.prototype = {
104 * @return {?WebInspector.StatusBarItem}
108 if (!WebInspector.inspectElementModeController)
111 return WebInspector.inspectElementModeController._toggleSearchButton;
115 /** @type {?WebInspector.InspectElementModeController} */
116 WebInspector.inspectElementModeController = null;