• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2006, 2007, 2008, 2009 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  * 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.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 
26 #include <WebCore/ChromeClient.h>
27 #include <WebCore/COMPtr.h>
28 #include <WebCore/GraphicsContext.h>
29 #include <WebCore/FocusDirection.h>
30 #include <WebCore/ScrollTypes.h>
31 #include <wtf/Forward.h>
32 
33 class WebView;
34 
35 interface IWebUIDelegate;
36 
37 class WebChromeClient : public WebCore::ChromeClient {
38 public:
39     WebChromeClient(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 float scaleFactor();
49 
50     virtual void focus();
51     virtual void unfocus();
52 
53     virtual bool canTakeFocus(WebCore::FocusDirection);
54     virtual void takeFocus(WebCore::FocusDirection);
55 
56     virtual WebCore::Page* createWindow(WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&);
57     virtual void show();
58 
59     virtual bool canRunModal();
60     virtual void runModal();
61 
62     virtual void setToolbarsVisible(bool);
63     virtual bool toolbarsVisible();
64 
65     virtual void setStatusbarVisible(bool);
66     virtual bool statusbarVisible();
67 
68     virtual void setScrollbarsVisible(bool);
69     virtual bool scrollbarsVisible();
70 
71     virtual void setMenubarVisible(bool);
72     virtual bool menubarVisible();
73 
74     virtual void setResizable(bool);
75 
76     virtual void addMessageToConsole(WebCore::MessageSource source, WebCore::MessageType type, WebCore::MessageLevel level, const WebCore::String& message, unsigned line, const WebCore::String& url);
77 
78     virtual bool canRunBeforeUnloadConfirmPanel();
79     virtual bool runBeforeUnloadConfirmPanel(const WebCore::String& message, WebCore::Frame* frame);
80 
81     virtual void closeWindowSoon();
82 
83     virtual void runJavaScriptAlert(WebCore::Frame*, const WebCore::String&);
84     virtual bool runJavaScriptConfirm(WebCore::Frame*, const WebCore::String&);
85     virtual bool runJavaScriptPrompt(WebCore::Frame*, const WebCore::String& message, const WebCore::String& defaultValue, WebCore::String& result);
86     virtual void setStatusbarText(const WebCore::String&);
87     virtual bool shouldInterruptJavaScript();
88 
89     virtual bool tabsToLinks() const;
90     virtual WebCore::IntRect windowResizerRect() const;
91 
92     virtual void repaint(const WebCore::IntRect&, bool contentChanged, bool immediate = false, bool repaintContentOnly = false);
93     virtual void scroll(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& rectToScroll, const WebCore::IntRect& clipRect);
94     virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint& p) const;
95     virtual WebCore::IntRect windowToScreen(const WebCore::IntRect& r) const;
96     virtual PlatformWidget platformWindow() const;
97     virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const;
98 
99     virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags);
100 
101     virtual void setToolTip(const WebCore::String&, WebCore::TextDirection);
102 
103     virtual void print(WebCore::Frame*);
104 
105 #if ENABLE(DATABASE)
106     virtual void exceededDatabaseQuota(WebCore::Frame*, const WebCore::String&);
107 #endif
108 
109 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
110     virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
111 #endif
112 
113     virtual void populateVisitedLinks();
114 
115     virtual bool paintCustomScrollbar(WebCore::GraphicsContext*, const WebCore::FloatRect&, WebCore::ScrollbarControlSize,
116                                         WebCore::ScrollbarControlState, WebCore::ScrollbarPart pressedPart, bool vertical,
117                                         float value, float proportion, WebCore::ScrollbarControlPartMask);
118     virtual bool paintCustomScrollCorner(WebCore::GraphicsContext*, const WebCore::FloatRect&);
119 
120     virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
121 
122     virtual bool setCursor(WebCore::PlatformCursorHandle cursor);
123 
webView()124     WebView* webView() const { return m_webView; }
125 
formStateDidChange(const WebCore::Node *)126     virtual void formStateDidChange(const WebCore::Node*) { }
127 
createHTMLParserQuirks()128     virtual PassOwnPtr<WebCore::HTMLParserQuirks> createHTMLParserQuirks() { return 0; }
129 
scrollRectIntoView(const WebCore::IntRect &,const WebCore::ScrollView *)130     virtual void scrollRectIntoView(const WebCore::IntRect&, const WebCore::ScrollView*) const {}
131 
132     virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*);
133 
134 private:
135     COMPtr<IWebUIDelegate> uiDelegate();
136 
137     WebView* m_webView;
138 };
139