• 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 QEventLoop;
38 class QWebPage;
39 
40 namespace WebCore {
41 
42     class FileChooser;
43     class FloatRect;
44     class Page;
45     struct FrameLoadRequest;
46     class QtAbstractWebPopup;
47 
48     class ChromeClientQt : public ChromeClient
49     {
50     public:
51         ChromeClientQt(QWebPage* webPage);
52         virtual ~ChromeClientQt();
53         virtual void chromeDestroyed();
54 
55         virtual void setWindowRect(const FloatRect&);
56         virtual FloatRect windowRect();
57 
58         virtual FloatRect pageRect();
59 
60         virtual float scaleFactor();
61 
62         virtual void focus();
63         virtual void unfocus();
64 
65         virtual bool canTakeFocus(FocusDirection);
66         virtual void takeFocus(FocusDirection);
67 
68         virtual void focusedNodeChanged(Node*);
69 
70         virtual Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&);
71         virtual void show();
72 
73         virtual bool canRunModal();
74         virtual void runModal();
75 
76         virtual void setToolbarsVisible(bool);
77         virtual bool toolbarsVisible();
78 
79         virtual void setStatusbarVisible(bool);
80         virtual bool statusbarVisible();
81 
82         virtual void setScrollbarsVisible(bool);
83         virtual bool scrollbarsVisible();
84 
85         virtual void setMenubarVisible(bool);
86         virtual bool menubarVisible();
87 
88         virtual void setResizable(bool);
89 
90         virtual void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message,
91                                          unsigned int lineNumber, const String& sourceID);
92 
93         virtual bool canRunBeforeUnloadConfirmPanel();
94         virtual bool runBeforeUnloadConfirmPanel(const String& message, Frame* frame);
95 
96         virtual void closeWindowSoon();
97 
98         virtual void runJavaScriptAlert(Frame*, const String&);
99         virtual bool runJavaScriptConfirm(Frame*, const String&);
100         virtual bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result);
101         virtual bool shouldInterruptJavaScript();
102 
103         virtual void setStatusbarText(const String&);
104 
105         virtual bool tabsToLinks() const;
106         virtual IntRect windowResizerRect() const;
107 
108         virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false, bool repaintContentOnly = false);
109         virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
110         virtual IntPoint screenToWindow(const IntPoint&) const;
111         virtual IntRect windowToScreen(const IntRect&) const;
112         virtual PlatformPageClient platformPageClient() const;
113         virtual void contentsSizeChanged(Frame*, const IntSize&) const;
114 
scrollbarsModeDidChange()115         virtual void scrollbarsModeDidChange() const { }
116         virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
117 
118         virtual void setToolTip(const String&, TextDirection);
119 
120         virtual void print(Frame*);
121 #if ENABLE(DATABASE)
122         virtual void exceededDatabaseQuota(Frame*, const String&);
123 #endif
124 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
125         virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
126 #endif
127 
128 #if USE(ACCELERATED_COMPOSITING)
129         // see ChromeClient.h
130         // this is a hook for WebCore to tell us what we need to do with the GraphicsLayers
131         virtual void attachRootGraphicsLayer(Frame*, GraphicsLayer*);
132         virtual void setNeedsOneShotDrawingSynchronization();
133         virtual void scheduleCompositingLayerSync();
134 #endif
135 
136 #if ENABLE(TOUCH_EVENTS)
needTouchEvents(bool)137         virtual void needTouchEvents(bool) { }
138 #endif
139 
140         virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
141 
formStateDidChange(const Node *)142         virtual void formStateDidChange(const Node*) { }
143 
createHTMLParserQuirks()144         virtual PassOwnPtr<HTMLParserQuirks> createHTMLParserQuirks() { return 0; }
145 
146         virtual bool setCursor(PlatformCursorHandle);
147 
scrollRectIntoView(const IntRect &,const ScrollView *)148         virtual void scrollRectIntoView(const IntRect&, const ScrollView*) const {}
149 
150         virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*);
151 
152         QtAbstractWebPopup* createSelectPopup();
153 
154         QWebPage* m_webPage;
155         WebCore::KURL lastHoverURL;
156         WebCore::String lastHoverTitle;
157         WebCore::String lastHoverContent;
158 
159         bool toolBarsVisible;
160         bool statusBarVisible;
161         bool menuBarVisible;
162         QEventLoop* m_eventLoop;
163     };
164 }
165 
166 #endif
167