2 * Copyright (C) 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
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
26 #ifndef WebInspector_h
27 #define WebInspector_h
31 #include "APIObject.h"
32 #include "Connection.h"
33 #include <wtf/Noncopyable.h>
34 #include <wtf/text/WTFString.h>
37 class InspectorFrontendChannel;
42 class WebInspectorFrontendClient;
44 struct WebPageCreationParameters;
46 class WebInspector : public APIObject {
48 static const Type APIType = TypeBundleInspector;
50 static PassRefPtr<WebInspector> create(WebPage*, WebCore::InspectorFrontendChannel*);
52 WebPage* page() const { return m_page; }
53 WebPage* inspectorPage() const { return m_inspectorPage; }
55 // Implemented in generated WebInspectorMessageReceiver.cpp
56 void didReceiveWebInspectorMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
58 // Called by WebInspector messages
62 void evaluateScriptForTest(long callID, const String& script);
64 void setJavaScriptProfilingEnabled(bool);
65 void startPageProfiling();
66 void stopPageProfiling();
68 #if ENABLE(INSPECTOR_SERVER)
69 bool hasRemoteFrontendConnected() const { return m_remoteFrontendConnected; }
70 void sendMessageToRemoteFrontend(const String& message);
71 void dispatchMessageFromRemoteFrontend(const String& message);
72 void remoteFrontendConnected();
73 void remoteFrontendDisconnected();
77 void setInspectorUsesWebKitUserInterface(bool);
81 friend class WebInspectorClient;
82 friend class WebInspectorFrontendClient;
84 explicit WebInspector(WebPage*, WebCore::InspectorFrontendChannel*);
86 virtual Type type() const { return APIType; }
88 // Called from WebInspectorClient
89 WebPage* createInspectorPage();
90 void destroyInspectorPage();
92 // Called from WebInspectorFrontendClient
93 void didLoadInspectorPage();
96 void inspectedURLChanged(const String&);
101 void setAttachedWindowHeight(unsigned);
103 // Implemented in platform WebInspector file
104 String localizedStringsURL() const;
108 void showResources();
110 void showMainResourceForFrame(uint64_t frameID);
112 void startJavaScriptDebugging();
113 void stopJavaScriptDebugging();
115 void startJavaScriptProfiling();
116 void stopJavaScriptProfiling();
118 void updateDockingAvailability();
121 WebPage* m_inspectorPage;
122 WebInspectorFrontendClient* m_frontendClient;
123 WebCore::InspectorFrontendChannel* m_frontendChannel;
125 String m_localizedStringsURL;
127 #if ENABLE(INSPECTOR_SERVER)
128 bool m_remoteFrontendConnected;
132 } // namespace WebKit
134 #endif // ENABLE(INSPECTOR)
136 #endif // WebInspector_h