2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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.
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.
30 #import <WebCore/ChromeClient.h>
31 #import <WebCore/FocusDirection.h>
32 #import <wtf/Forward.h>
36 class WebChromeClient : public WebCore::ChromeClient {
38 WebChromeClient(WebView*);
39 virtual void* webView() const { return static_cast<void*>(m_webView); }
41 virtual void chromeDestroyed();
43 virtual void setWindowRect(const WebCore::FloatRect&);
44 virtual WebCore::FloatRect windowRect();
46 virtual WebCore::FloatRect pageRect();
49 virtual void unfocus();
51 virtual bool canTakeFocus(WebCore::FocusDirection);
52 virtual void takeFocus(WebCore::FocusDirection);
54 virtual void focusedNodeChanged(WebCore::Node*);
55 virtual void focusedFrameChanged(WebCore::Frame*);
57 virtual WebCore::Page* createWindow(WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&, const WebCore::NavigationAction&);
60 virtual bool canRunModal();
61 virtual void runModal();
63 virtual void setToolbarsVisible(bool);
64 virtual bool toolbarsVisible();
66 virtual void setStatusbarVisible(bool);
67 virtual bool statusbarVisible();
69 virtual void setScrollbarsVisible(bool);
70 virtual bool scrollbarsVisible();
72 virtual void setMenubarVisible(bool);
73 virtual bool menubarVisible();
75 virtual void setResizable(bool);
77 virtual void addMessageToConsole(WebCore::MessageSource source, WebCore::MessageType type, WebCore::MessageLevel level, const WTF::String& message, unsigned int lineNumber, const WTF::String& sourceURL);
79 virtual bool canRunBeforeUnloadConfirmPanel();
80 virtual bool runBeforeUnloadConfirmPanel(const WTF::String& message, WebCore::Frame* frame);
82 virtual void closeWindowSoon();
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();
89 virtual WebCore::IntRect windowResizerRect() const;
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);
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;
102 virtual void setStatusbarText(const WTF::String&);
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);
109 virtual void setToolTip(const WTF::String&, WebCore::TextDirection);
111 virtual void print(WebCore::Frame*);
113 virtual void exceededDatabaseQuota(WebCore::Frame*, const WTF::String& databaseName);
115 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
116 virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
117 virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*, int64_t totalSpaceNeeded);
119 virtual void populateVisitedLinks();
121 #if ENABLE(DASHBOARD_SUPPORT)
122 virtual void dashboardRegionsChanged();
125 virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
126 virtual void loadIconForFiles(const Vector<WTF::String>&, WebCore::FileIconLoader*);
128 virtual void setCursor(const WebCore::Cursor&);
129 virtual void setCursorHiddenUntilMouseMoves(bool);
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);
137 virtual WebCore::KeyboardUIMode keyboardUIMode();
139 virtual NSResponder *firstResponder();
140 virtual void makeFirstResponder(NSResponder *);
142 virtual void willPopUpMenu(NSMenu *);
144 virtual bool shouldReplaceWithGeneratedFileForUpload(const WTF::String& path, WTF::String &generatedFilename);
145 virtual WTF::String generateReplacementFile(const WTF::String& path);
147 virtual void formStateDidChange(const WebCore::Node*) { }
149 virtual void elementDidFocus(const WebCore::Node*);
150 virtual void elementDidBlur(const WebCore::Node*);
152 #if USE(ACCELERATED_COMPOSITING)
153 virtual void attachRootGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*);
154 virtual void setNeedsOneShotDrawingSynchronization();
155 virtual void scheduleCompositingLayerSync();
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*);
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*);
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*) { }
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;
181 #if ENABLE(CONTEXT_MENUS)
182 virtual void showContextMenu();
185 virtual void numWheelEventHandlersChanged(unsigned) { }
187 virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const { return false; }