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 WebInspectorProxy_h
27 #define WebInspectorProxy_h
31 #include "APIObject.h"
32 #include "Connection.h"
33 #include <wtf/Forward.h>
34 #include <wtf/PassRefPtr.h>
35 #include <wtf/RefPtr.h>
38 #include <wtf/RetainPtr.h>
41 OBJC_CLASS WebInspectorProxyObjCAdapter;
42 OBJC_CLASS WebInspectorWKView;
46 #include <WebCore/WindowMessageListener.h>
53 struct WebPageCreationParameters;
59 class WebInspectorProxy : public APIObject
61 , public WebCore::WindowMessageListener
65 static const Type APIType = TypeInspector;
67 static PassRefPtr<WebInspectorProxy> create(WebPageProxy* page)
69 return adoptRef(new WebInspectorProxy(page));
77 WebPageProxy* page() const { return m_page; }
79 bool isVisible() const { return m_isVisible; }
84 void inspectedViewFrameDidChange();
89 bool isAttached() const { return m_isAttached; }
92 void setAttachedWindowHeight(unsigned);
94 bool isDebuggingJavaScript() const { return m_isDebuggingJavaScript; }
95 void toggleJavaScriptDebugging();
97 bool isProfilingJavaScript() const { return m_isProfilingJavaScript; }
98 void toggleJavaScriptProfiling();
100 bool isProfilingPage() const { return m_isProfilingPage; }
101 void togglePageProfiling();
103 #if ENABLE(INSPECTOR)
104 // Implemented in generated WebInspectorProxyMessageReceiver.cpp
105 void didReceiveWebInspectorProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
106 void didReceiveSyncWebInspectorProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
109 static bool isInspectorPage(WebPageProxy*);
112 WebInspectorProxy(WebPageProxy* page);
114 virtual Type type() const { return APIType; }
116 WebPageProxy* platformCreateInspectorPage();
118 void platformDidClose();
119 void platformBringToFront();
120 void platformInspectedURLChanged(const String&);
121 unsigned platformInspectedWindowHeight();
122 void platformAttach();
123 void platformDetach();
124 void platformSetAttachedWindowHeight(unsigned);
126 // Implemented the platform WebInspectorProxy file
127 String inspectorPageURL() const;
129 // Called by WebInspectorProxy messages
130 void createInspectorPage(uint64_t& inspectorPageID, WebPageCreationParameters&);
131 void didLoadInspectorPage();
134 void inspectedURLChanged(const String&);
137 bool shouldOpenAttached();
139 static WebPageGroup* inspectorPageGroup();
142 static bool registerInspectorViewWindowClass();
143 static LRESULT CALLBACK InspectorViewWndProc(HWND, UINT, WPARAM, LPARAM);
144 LRESULT wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
146 LRESULT onSizeEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
147 LRESULT onMinMaxInfoEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
148 LRESULT onSetFocusEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
149 LRESULT onCloseEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled);
151 void onWebViewWindowPosChangingEvent(WPARAM, LPARAM);
152 virtual void windowReceivedMessage(HWND, UINT message, WPARAM, LPARAM);
155 static const unsigned minimumWindowWidth = 500;
156 static const unsigned minimumWindowHeight = 400;
158 static const unsigned initialWindowWidth = 750;
159 static const unsigned initialWindowHeight = 650;
160 static const unsigned minimumAttachedHeight = 250;
162 WebPageProxy* m_page;
166 bool m_isDebuggingJavaScript;
167 bool m_isProfilingJavaScript;
168 bool m_isProfilingPage;
171 RetainPtr<WebInspectorWKView> m_inspectorView;
172 RetainPtr<NSWindow> m_inspectorWindow;
173 RetainPtr<WebInspectorProxyObjCAdapter> m_inspectorProxyObjCAdapter;
175 HWND m_inspectorWindow;
176 RefPtr<WebView> m_inspectorView;
180 } // namespace WebKit
182 #endif // ENABLE(INSPECTOR)
184 #endif // WebInspectorProxy_h