• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2006 Zack Rusin <zack@kde.org>
3  *
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
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  *
15  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
16  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
19  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef ChromeClientQt_H
29 #define ChromeClientQt_H
30 
31 #include "ChromeClient.h"
32 #include "FloatRect.h"
33 #include "RefCounted.h"
34 #include "KURL.h"
35 #include "PlatformString.h"
36 
37 class QWebPage;
38 
39 namespace WebCore {
40 
41     class FileChooser;
42     class FloatRect;
43     class Page;
44     struct FrameLoadRequest;
45 
46     class ChromeClientQt : public ChromeClient
47     {
48     public:
49         ChromeClientQt(QWebPage* webPage);
50         virtual ~ChromeClientQt();
51         virtual void chromeDestroyed();
52 
53         virtual void setWindowRect(const FloatRect&);
54         virtual FloatRect windowRect();
55 
56         virtual FloatRect pageRect();
57 
58         virtual float scaleFactor();
59 
60         virtual void focus();
61         virtual void unfocus();
62 
63         virtual bool canTakeFocus(FocusDirection);
64         virtual void takeFocus(FocusDirection);
65 
66         virtual Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&);
67         virtual void show();
68 
69         virtual bool canRunModal();
70         virtual void runModal();
71 
72         virtual void setToolbarsVisible(bool);
73         virtual bool toolbarsVisible();
74 
75         virtual void setStatusbarVisible(bool);
76         virtual bool statusbarVisible();
77 
78         virtual void setScrollbarsVisible(bool);
79         virtual bool scrollbarsVisible();
80 
81         virtual void setMenubarVisible(bool);
82         virtual bool menubarVisible();
83 
84         virtual void setResizable(bool);
85 
86         virtual void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message,
87                                          unsigned int lineNumber, const String& sourceID);
88 
89         virtual bool canRunBeforeUnloadConfirmPanel();
90         virtual bool runBeforeUnloadConfirmPanel(const String& message, Frame* frame);
91 
92         virtual void closeWindowSoon();
93 
94         virtual void runJavaScriptAlert(Frame*, const String&);
95         virtual bool runJavaScriptConfirm(Frame*, const String&);
96         virtual bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result);
97         virtual bool shouldInterruptJavaScript();
98 
99         virtual void setStatusbarText(const String&);
100 
101         virtual bool tabsToLinks() const;
102         virtual IntRect windowResizerRect() const;
103 
104         virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false, bool repaintContentOnly = false);
105         virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
106         virtual IntPoint screenToWindow(const IntPoint&) const;
107         virtual IntRect windowToScreen(const IntRect&) const;
108         virtual PlatformWidget platformWindow() const;
109         virtual void contentsSizeChanged(Frame*, const IntSize&) const;
110 
111         virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
112 
113         virtual void setToolTip(const String&, TextDirection);
114 
115         virtual void print(Frame*);
116 #if ENABLE(DATABASE)
117         virtual void exceededDatabaseQuota(Frame*, const String&);
118 #endif
119 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
120         virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
121 #endif
122         virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
123 
formStateDidChange(const Node *)124         virtual void formStateDidChange(const Node*) { }
125 
createHTMLParserQuirks()126         virtual PassOwnPtr<HTMLParserQuirks> createHTMLParserQuirks() { return 0; }
127 
128         virtual bool setCursor(PlatformCursorHandle);
129 
scrollRectIntoView(const IntRect &,const ScrollView *)130         virtual void scrollRectIntoView(const IntRect&, const ScrollView*) const {}
131 
132         virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*);
133 
134         QWebPage* m_webPage;
135         WebCore::KURL lastHoverURL;
136         WebCore::String lastHoverTitle;
137         WebCore::String lastHoverContent;
138 
139         bool toolBarsVisible;
140         bool statusBarVisible;
141         bool menuBarVisible;
142     };
143 }
144 
145 #endif
146