initial import
[vuplus_webkit] / Source / WebKit / mac / WebCoreSupport / WebChromeClient.h
1 /*
2  * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3  * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1.  Redistributions of source code must retain the above copyright
10  *     notice, this list of conditions and the following disclaimer. 
11  * 2.  Redistributions in binary form must reproduce the above copyright
12  *     notice, this list of conditions and the following disclaimer in the
13  *     documentation and/or other materials provided with the distribution. 
14  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
15  *     its contributors may be used to endorse or promote products derived
16  *     from this software without specific prior written permission. 
17  *
18  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29
30 #import <WebCore/ChromeClient.h>
31 #import <WebCore/FocusDirection.h>
32 #import <wtf/Forward.h>
33
34 @class WebView;
35
36 class WebChromeClient : public WebCore::ChromeClient {
37 public:
38     WebChromeClient(WebView*);
39     virtual void* webView() const { return static_cast<void*>(m_webView); }
40     
41     virtual void chromeDestroyed();
42     
43     virtual void setWindowRect(const WebCore::FloatRect&);
44     virtual WebCore::FloatRect windowRect();
45
46     virtual WebCore::FloatRect pageRect();
47
48     virtual void focus();
49     virtual void unfocus();
50     
51     virtual bool canTakeFocus(WebCore::FocusDirection);
52     virtual void takeFocus(WebCore::FocusDirection);
53
54     virtual void focusedNodeChanged(WebCore::Node*);
55     virtual void focusedFrameChanged(WebCore::Frame*);
56
57     virtual WebCore::Page* createWindow(WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&, const WebCore::NavigationAction&);
58     virtual void show();
59
60     virtual bool canRunModal();
61     virtual void runModal();
62
63     virtual void setToolbarsVisible(bool);
64     virtual bool toolbarsVisible();
65     
66     virtual void setStatusbarVisible(bool);
67     virtual bool statusbarVisible();
68     
69     virtual void setScrollbarsVisible(bool);
70     virtual bool scrollbarsVisible();
71     
72     virtual void setMenubarVisible(bool);
73     virtual bool menubarVisible();
74     
75     virtual void setResizable(bool);
76     
77     virtual void addMessageToConsole(WebCore::MessageSource source, WebCore::MessageType type, WebCore::MessageLevel level, const WTF::String& message, unsigned int lineNumber, const WTF::String& sourceURL);
78
79     virtual bool canRunBeforeUnloadConfirmPanel();
80     virtual bool runBeforeUnloadConfirmPanel(const WTF::String& message, WebCore::Frame* frame);
81
82     virtual void closeWindowSoon();
83
84     virtual void runJavaScriptAlert(WebCore::Frame*, const WTF::String&);
85     virtual bool runJavaScriptConfirm(WebCore::Frame*, const WTF::String&);
86     virtual bool runJavaScriptPrompt(WebCore::Frame*, const WTF::String& message, const WTF::String& defaultValue, WTF::String& result);
87     virtual bool shouldInterruptJavaScript();
88
89     virtual WebCore::IntRect windowResizerRect() const;
90
91     virtual void invalidateWindow(const WebCore::IntRect&, bool);
92     virtual void invalidateContentsAndWindow(const WebCore::IntRect&, bool);
93     virtual void invalidateContentsForSlowScroll(const WebCore::IntRect&, bool);
94     virtual void scroll(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& rectToScroll, const WebCore::IntRect& clipRect);
95
96     virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const;
97     virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const;
98     virtual PlatformPageClient platformPageClient() const;
99     virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const;
100     virtual void scrollRectIntoView(const WebCore::IntRect&) const;
101     
102     virtual void setStatusbarText(const WTF::String&);
103
104     virtual void scrollbarsModeDidChange() const { }
105     virtual bool shouldMissingPluginMessageBeButton() const;
106     virtual void missingPluginButtonClicked(WebCore::Element*) const;
107     virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags);
108
109     virtual void setToolTip(const WTF::String&, WebCore::TextDirection);
110
111     virtual void print(WebCore::Frame*);
112 #if ENABLE(DATABASE)
113     virtual void exceededDatabaseQuota(WebCore::Frame*, const WTF::String& databaseName);
114 #endif
115 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
116     virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
117     virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*, int64_t totalSpaceNeeded);
118 #endif
119     virtual void populateVisitedLinks();
120
121 #if ENABLE(DASHBOARD_SUPPORT)
122     virtual void dashboardRegionsChanged();
123 #endif
124
125     virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
126     virtual void loadIconForFiles(const Vector<WTF::String>&, WebCore::FileIconLoader*);
127
128     virtual void setCursor(const WebCore::Cursor&);
129     virtual void setCursorHiddenUntilMouseMoves(bool);
130
131     virtual WebCore::FloatRect customHighlightRect(WebCore::Node*, const WTF::AtomicString& type,
132         const WebCore::FloatRect& lineRect);
133     virtual void paintCustomHighlight(WebCore::Node*, const WTF::AtomicString& type,
134         const WebCore::FloatRect& boxRect, const WebCore::FloatRect& lineRect,
135         bool behindText, bool entireLine);
136
137     virtual WebCore::KeyboardUIMode keyboardUIMode();
138
139     virtual NSResponder *firstResponder();
140     virtual void makeFirstResponder(NSResponder *);
141
142     virtual void willPopUpMenu(NSMenu *);
143     
144     virtual bool shouldReplaceWithGeneratedFileForUpload(const WTF::String& path, WTF::String &generatedFilename);
145     virtual WTF::String generateReplacementFile(const WTF::String& path);
146
147     virtual void formStateDidChange(const WebCore::Node*) { }
148
149     virtual void elementDidFocus(const WebCore::Node*);
150     virtual void elementDidBlur(const WebCore::Node*);
151
152 #if USE(ACCELERATED_COMPOSITING)
153     virtual void attachRootGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*);
154     virtual void setNeedsOneShotDrawingSynchronization();
155     virtual void scheduleCompositingLayerSync();
156 #endif
157
158 #if ENABLE(VIDEO)
159     virtual bool supportsFullscreenForNode(const WebCore::Node*);
160     virtual void enterFullscreenForNode(WebCore::Node*);
161     virtual void exitFullscreenForNode(WebCore::Node*);
162     virtual void fullScreenRendererChanged(WebCore::RenderBox*);
163 #endif
164     
165 #if ENABLE(FULLSCREEN_API)
166     virtual bool supportsFullScreenForElement(const WebCore::Element*, bool withKeyboard);
167     virtual void enterFullScreenForElement(WebCore::Element*);
168     virtual void exitFullScreenForElement(WebCore::Element*);
169 #endif
170
171     // FIXME: Remove once all ports are using client-based geolocation. https://bugs.webkit.org/show_bug.cgi?id=40373
172     // For client-based geolocation, these two methods have moved to WebGeolocationClient. https://bugs.webkit.org/show_bug.cgi?id=50061
173     virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*) { }
174     virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*) { }
175
176     virtual bool selectItemWritingDirectionIsNatural();
177     virtual bool selectItemAlignmentFollowsMenuWritingDirection();
178     virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const;
179     virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const;
180
181 #if ENABLE(CONTEXT_MENUS)
182     virtual void showContextMenu();
183 #endif
184     
185     virtual void numWheelEventHandlersChanged(unsigned) { }
186     
187     virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const { return false; }
188 private:
189     WebView *m_webView;
190 };