2 * Copyright (C) 2006, 2007, 2008, 2010 Apple 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
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of Apple Inc. ("Apple") nor the names of
14 * its contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #import "WebInspectorClient.h"
33 #import "WebFrameInternal.h"
34 #import "WebInspector.h"
35 #import "WebNodeHighlighter.h"
36 #import "WebViewInternal.h"
37 #import <WebCore/InspectorController.h>
38 #import <WebCore/NotImplemented.h>
39 #import <WebCore/Page.h>
40 #import <WebCore/Settings.h>
41 #import <WebCore/WebCoreThread.h>
43 using namespace WebCore;
45 WebInspectorClient::WebInspectorClient(WebView *webView)
47 , m_highlighter(adoptNS([[WebNodeHighlighter alloc] initWithInspectedWebView:webView]))
52 void WebInspectorClient::inspectorDestroyed()
57 InspectorFrontendChannel* WebInspectorClient::openInspectorFrontend(InspectorController*)
59 // iOS does not have a local inspector, this should not be reached.
64 void WebInspectorClient::bringFrontendToFront()
66 // iOS does not have a local inspector, nothing to do here.
69 void WebInspectorClient::closeInspectorFrontend()
71 // iOS does not have a local inspector, nothing to do here.
74 void WebInspectorClient::didResizeMainFrame(Frame*)
76 // iOS does not have a local inspector, nothing to do here.
79 void WebInspectorClient::highlight()
81 [m_highlighter.get() highlight];
84 void WebInspectorClient::hideHighlight()
86 [m_highlighter.get() hideHighlight];
89 void WebInspectorClient::showInspectorIndication()
91 [m_webView setShowingInspectorIndication:YES];
94 void WebInspectorClient::hideInspectorIndication()
96 [m_webView setShowingInspectorIndication:NO];
99 void WebInspectorClient::setShowPaintRects(bool)
104 void WebInspectorClient::showPaintRect(const FloatRect&)
106 // FIXME: need to do CALayer-based highlighting of paint rects.
109 void WebInspectorClient::didSetSearchingForNode(bool enabled)
111 WebInspector *inspector = [m_webView inspector];
112 NSString *notificationName = enabled ? WebInspectorDidStartSearchingForNode : WebInspectorDidStopSearchingForNode;
113 dispatch_async(dispatch_get_main_queue(), ^{
114 [[NSNotificationCenter defaultCenter] postNotificationName:notificationName object:inspector];
119 #pragma mark WebInspectorFrontendClient Implementation
121 WebInspectorFrontendClient::WebInspectorFrontendClient(WebView* inspectedWebView, WebInspectorWindowController* windowController, InspectorController* inspectorController, Page* frontendPage, std::unique_ptr<Settings> settings)
122 : InspectorFrontendClientLocal(inspectorController, frontendPage, WTF::move(settings))
124 // iOS does not have a local inspector, this should not be reached.
128 void WebInspectorFrontendClient::attachAvailabilityChanged(bool) { }
129 void WebInspectorFrontendClient::frontendLoaded() { }
130 String WebInspectorFrontendClient::localizedStringsURL() { return String(); }
131 void WebInspectorFrontendClient::bringToFront() { }
132 void WebInspectorFrontendClient::closeWindow() { }
133 void WebInspectorFrontendClient::disconnectFromBackend() { }
134 void WebInspectorFrontendClient::attachWindow(DockSide) { }
135 void WebInspectorFrontendClient::detachWindow() { }
136 void WebInspectorFrontendClient::setAttachedWindowHeight(unsigned) { }
137 void WebInspectorFrontendClient::setAttachedWindowWidth(unsigned) { }
138 void WebInspectorFrontendClient::setToolbarHeight(unsigned) { }
139 void WebInspectorFrontendClient::startWindowDrag() { }
140 void WebInspectorFrontendClient::inspectedURLChanged(const String&) { }
141 void WebInspectorFrontendClient::updateWindowTitle() const { }
142 void WebInspectorFrontendClient::save(const String&, const String&, bool, bool) { }
143 void WebInspectorFrontendClient::append(const String&, const String&) { }
145 #endif // PLATFORM(IOS)