• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2006, 2007 Apple Inc.  All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
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 Computer, 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.
16  *
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.
27  */
28 
29 #ifndef WebInspectorClient_h
30 #define WebInspectorClient_h
31 
32 #include <WebCore/COMPtr.h>
33 #include <WebCore/InspectorClient.h>
34 #include <WebCore/PlatformString.h>
35 #include <WebCore/WindowMessageListener.h>
36 #include <wtf/OwnPtr.h>
37 #include <windows.h>
38 
39 class WebNodeHighlight;
40 class WebView;
41 
42 class WebInspectorClient : public WebCore::InspectorClient, WebCore::WindowMessageListener {
43 public:
44     WebInspectorClient(WebView*);
45 
46     // InspectorClient
47     virtual void inspectorDestroyed();
48 
49     virtual WebCore::Page* createPage();
50 
51     virtual WebCore::String localizedStringsURL();
52 
53     virtual WebCore::String hiddenPanels();
54 
55     virtual void showWindow();
56     virtual void closeWindow();
57     virtual bool windowVisible();
58 
59     virtual void attachWindow();
60     virtual void detachWindow();
61 
62     virtual void setAttachedWindowHeight(unsigned height);
63 
64     virtual void highlight(WebCore::Node*);
65     virtual void hideHighlight();
66 
67     virtual void inspectedURLChanged(const WebCore::String& newURL);
68 
69     virtual void populateSetting(const WebCore::String& key, WebCore::InspectorController::Setting&);
70     virtual void storeSetting(const WebCore::String& key, const WebCore::InspectorController::Setting&);
71     virtual void removeSetting(const WebCore::String& key);
72 
73     virtual void inspectorWindowObjectCleared();
74 
75 private:
76     ~WebInspectorClient();
77 
78     void closeWindowWithoutNotifications();
79     void showWindowWithoutNotifications();
80 
81     void updateWindowTitle();
82 
83     LRESULT onGetMinMaxInfo(WPARAM, LPARAM);
84     LRESULT onSize(WPARAM, LPARAM);
85     LRESULT onClose(WPARAM, LPARAM);
86     LRESULT onSetFocus();
87 
88     virtual void windowReceivedMessage(HWND, UINT message, WPARAM, LPARAM);
89 
90     void onWebViewWindowPosChanging(WPARAM, LPARAM);
91 
92     WebView* m_inspectedWebView;
93     HWND m_inspectedWebViewHwnd;
94     HWND m_hwnd;
95     COMPtr<WebView> m_webView;
96     HWND m_webViewHwnd;
97 
98     bool m_shouldAttachWhenShown;
99     bool m_attached;
100 
101     OwnPtr<WebNodeHighlight> m_highlight;
102 
103     WebCore::String m_inspectedURL;
104 
105     static friend LRESULT CALLBACK WebInspectorWndProc(HWND, UINT, WPARAM, LPARAM);
106 };
107 
108 #endif // !defined(WebInspectorClient_h)
109