author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 06 Jul 2010 15:10:48 +0300 | |
changeset 30 | 5dc02b23752f |
parent 0 | 1918ee327afb |
permissions | -rw-r--r-- |
0 | 1 |
/* |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2 |
* Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
0 | 3 |
* Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) |
4 |
* |
|
5 |
* This library is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU Library General Public |
|
7 |
* License as published by the Free Software Foundation; either |
|
8 |
* version 2 of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This library is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 |
* Library General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU Library General Public License |
|
16 |
* along with this library; see the file COPYING.LIB. If not, write to |
|
17 |
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
18 |
* Boston, MA 02110-1301, USA. |
|
19 |
*/ |
|
20 |
||
21 |
#ifndef Page_h |
|
22 |
#define Page_h |
|
23 |
||
24 |
#include "FrameLoaderTypes.h" |
|
25 |
#include "PlatformString.h" |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
26 |
#include <wtf/Forward.h> |
0 | 27 |
#include <wtf/HashSet.h> |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
28 |
#include <wtf/Noncopyable.h> |
0 | 29 |
|
30 |
#if PLATFORM(MAC) |
|
31 |
#include "SchedulePair.h" |
|
32 |
#endif |
|
33 |
||
34 |
namespace JSC { |
|
35 |
class Debugger; |
|
36 |
} |
|
37 |
||
38 |
namespace WebCore { |
|
39 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
40 |
class BackForwardList; |
0 | 41 |
class Chrome; |
42 |
class ChromeClient; |
|
43 |
class ContextMenuClient; |
|
44 |
class ContextMenuController; |
|
45 |
class Document; |
|
46 |
class DragClient; |
|
47 |
class DragController; |
|
48 |
class EditorClient; |
|
49 |
class FocusController; |
|
50 |
class Frame; |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
51 |
class GeolocationController; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
52 |
class GeolocationControllerClient; |
0 | 53 |
class HaltablePlugin; |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
54 |
class HistoryItem; |
0 | 55 |
class InspectorClient; |
56 |
class InspectorController; |
|
57 |
class InspectorTimelineAgent; |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
58 |
class MediaCanStartListener; |
0 | 59 |
class Node; |
60 |
class PageGroup; |
|
61 |
class PluginData; |
|
62 |
class PluginHalter; |
|
63 |
class PluginHalterClient; |
|
64 |
class ProgressTracker; |
|
65 |
class RenderTheme; |
|
66 |
class VisibleSelection; |
|
67 |
class SelectionController; |
|
68 |
class Settings; |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
69 |
|
0 | 70 |
#if ENABLE(DOM_STORAGE) |
71 |
class StorageNamespace; |
|
72 |
#endif |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
73 |
#if ENABLE(NOTIFICATIONS) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
74 |
class NotificationPresenter; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
75 |
#endif |
0 | 76 |
#if ENABLE(WML) |
77 |
class WMLPageState; |
|
78 |
#endif |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
79 |
|
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
80 |
typedef uint64_t LinkHash; |
0 | 81 |
|
82 |
enum FindDirection { FindDirectionForward, FindDirectionBackward }; |
|
83 |
||
84 |
class Page : public Noncopyable { |
|
85 |
public: |
|
86 |
static void setNeedsReapplyStyles(); |
|
87 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
88 |
Page(ChromeClient*, ContextMenuClient*, EditorClient*, DragClient*, InspectorClient*, PluginHalterClient*, GeolocationControllerClient*); |
0 | 89 |
~Page(); |
90 |
||
91 |
RenderTheme* theme() const { return m_theme.get(); }; |
|
92 |
||
93 |
static void refreshPlugins(bool reload); |
|
94 |
PluginData* pluginData() const; |
|
95 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
96 |
void setCanStartMedia(bool); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
97 |
bool canStartMedia() const { return m_canStartMedia; } |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
98 |
void addMediaCanStartListener(MediaCanStartListener*); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
99 |
void removeMediaCanStartListener(MediaCanStartListener*); |
0 | 100 |
|
101 |
EditorClient* editorClient() const { return m_editorClient; } |
|
102 |
||
103 |
void setMainFrame(PassRefPtr<Frame>); |
|
104 |
Frame* mainFrame() const { return m_mainFrame.get(); } |
|
105 |
||
106 |
bool openedByDOM() const; |
|
107 |
void setOpenedByDOM(); |
|
108 |
||
109 |
BackForwardList* backForwardList(); |
|
110 |
||
111 |
// FIXME: The following three methods don't fall under the responsibilities of the Page object |
|
112 |
// They seem to fit a hypothetical Page-controller object that would be akin to the |
|
113 |
// Frame-FrameLoader relationship. They have to live here now, but should move somewhere that |
|
114 |
// makes more sense when that class exists. |
|
115 |
bool goBack(); |
|
116 |
bool goForward(); |
|
117 |
bool canGoBackOrForward(int distance) const; |
|
118 |
void goBackOrForward(int distance); |
|
119 |
void goToItem(HistoryItem*, FrameLoadType); |
|
120 |
int getHistoryLength(); |
|
121 |
||
122 |
HistoryItem* globalHistoryItem() const { return m_globalHistoryItem.get(); } |
|
123 |
void setGlobalHistoryItem(HistoryItem*); |
|
124 |
||
125 |
void setGroupName(const String&); |
|
126 |
const String& groupName() const; |
|
127 |
||
128 |
PageGroup& group() { if (!m_group) initGroup(); return *m_group; } |
|
129 |
PageGroup* groupPtr() { return m_group; } // can return 0 |
|
130 |
||
131 |
void incrementFrameCount() { ++m_frameCount; } |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
132 |
void decrementFrameCount() { ASSERT(m_frameCount); --m_frameCount; } |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
133 |
int frameCount() const { checkFrameCountConsistency(); return m_frameCount; } |
0 | 134 |
|
135 |
Chrome* chrome() const { return m_chrome.get(); } |
|
136 |
SelectionController* dragCaretController() const { return m_dragCaretController.get(); } |
|
137 |
#if ENABLE(DRAG_SUPPORT) |
|
138 |
DragController* dragController() const { return m_dragController.get(); } |
|
139 |
#endif |
|
140 |
FocusController* focusController() const { return m_focusController.get(); } |
|
141 |
#if ENABLE(CONTEXT_MENUS) |
|
142 |
ContextMenuController* contextMenuController() const { return m_contextMenuController.get(); } |
|
143 |
#endif |
|
144 |
#if ENABLE(INSPECTOR) |
|
145 |
InspectorController* inspectorController() const { return m_inspectorController.get(); } |
|
146 |
#endif |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
147 |
#if ENABLE(CLIENT_BASED_GEOLOCATION) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
148 |
GeolocationController* geolocationController() const { return m_geolocationController.get(); } |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
149 |
#endif |
0 | 150 |
Settings* settings() const { return m_settings.get(); } |
151 |
ProgressTracker* progress() const { return m_progress.get(); } |
|
152 |
||
153 |
void setTabKeyCyclesThroughElements(bool b) { m_tabKeyCyclesThroughElements = b; } |
|
154 |
bool tabKeyCyclesThroughElements() const { return m_tabKeyCyclesThroughElements; } |
|
155 |
||
156 |
bool findString(const String&, TextCaseSensitivity, FindDirection, bool shouldWrap); |
|
157 |
unsigned int markAllMatchesForText(const String&, TextCaseSensitivity, bool shouldHighlight, unsigned); |
|
158 |
void unmarkAllTextMatches(); |
|
159 |
||
160 |
#if PLATFORM(MAC) |
|
161 |
void addSchedulePair(PassRefPtr<SchedulePair>); |
|
162 |
void removeSchedulePair(PassRefPtr<SchedulePair>); |
|
163 |
SchedulePairHashSet* scheduledRunLoopPairs() { return m_scheduledRunLoopPairs.get(); } |
|
164 |
||
165 |
OwnPtr<SchedulePairHashSet> m_scheduledRunLoopPairs; |
|
166 |
#endif |
|
167 |
||
168 |
const VisibleSelection& selection() const; |
|
169 |
||
170 |
void setDefersLoading(bool); |
|
171 |
bool defersLoading() const { return m_defersLoading; } |
|
172 |
||
173 |
void clearUndoRedoOperations(); |
|
174 |
||
175 |
bool inLowQualityImageInterpolationMode() const; |
|
176 |
void setInLowQualityImageInterpolationMode(bool = true); |
|
177 |
||
178 |
bool cookieEnabled() const { return m_cookieEnabled; } |
|
179 |
void setCookieEnabled(bool enabled) { m_cookieEnabled = enabled; } |
|
180 |
||
181 |
float mediaVolume() const { return m_mediaVolume; } |
|
182 |
void setMediaVolume(float volume); |
|
183 |
||
184 |
// Notifications when the Page starts and stops being presented via a native window. |
|
185 |
void didMoveOnscreen(); |
|
186 |
void willMoveOffscreen(); |
|
187 |
||
188 |
void userStyleSheetLocationChanged(); |
|
189 |
const String& userStyleSheet() const; |
|
190 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
191 |
void privateBrowsingStateChanged(); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
192 |
|
0 | 193 |
void didStartPlugin(HaltablePlugin*); |
194 |
void didStopPlugin(HaltablePlugin*); |
|
195 |
void pluginAllowedRunTimeChanged(); |
|
196 |
||
197 |
static void setDebuggerForAllPages(JSC::Debugger*); |
|
198 |
void setDebugger(JSC::Debugger*); |
|
199 |
JSC::Debugger* debugger() const { return m_debugger; } |
|
200 |
||
201 |
static void removeAllVisitedLinks(); |
|
202 |
||
203 |
static void allVisitedStateChanged(PageGroup*); |
|
204 |
static void visitedStateChanged(PageGroup*, LinkHash visitedHash); |
|
205 |
||
206 |
#if ENABLE(DOM_STORAGE) |
|
207 |
StorageNamespace* sessionStorage(bool optionalCreate = true); |
|
208 |
void setSessionStorage(PassRefPtr<StorageNamespace>); |
|
209 |
#endif |
|
210 |
||
211 |
#if ENABLE(WML) |
|
212 |
WMLPageState* wmlPageState(); |
|
213 |
#endif |
|
214 |
||
215 |
void setCustomHTMLTokenizerTimeDelay(double); |
|
216 |
bool hasCustomHTMLTokenizerTimeDelay() const { return m_customHTMLTokenizerTimeDelay != -1; } |
|
217 |
double customHTMLTokenizerTimeDelay() const { ASSERT(m_customHTMLTokenizerTimeDelay != -1); return m_customHTMLTokenizerTimeDelay; } |
|
218 |
||
219 |
void setCustomHTMLTokenizerChunkSize(int); |
|
220 |
bool hasCustomHTMLTokenizerChunkSize() const { return m_customHTMLTokenizerChunkSize != -1; } |
|
221 |
int customHTMLTokenizerChunkSize() const { ASSERT(m_customHTMLTokenizerChunkSize != -1); return m_customHTMLTokenizerChunkSize; } |
|
222 |
||
223 |
void setMemoryCacheClientCallsEnabled(bool); |
|
224 |
bool areMemoryCacheClientCallsEnabled() const { return m_areMemoryCacheClientCallsEnabled; } |
|
225 |
||
226 |
void setJavaScriptURLsAreAllowed(bool); |
|
227 |
bool javaScriptURLsAreAllowed() const; |
|
228 |
||
229 |
#if ENABLE(INSPECTOR) |
|
230 |
InspectorTimelineAgent* inspectorTimelineAgent() const; |
|
231 |
#endif |
|
232 |
private: |
|
233 |
void initGroup(); |
|
234 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
235 |
#if ASSERT_DISABLED |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
236 |
void checkFrameCountConsistency() const { } |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
237 |
#else |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
238 |
void checkFrameCountConsistency() const; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
239 |
#endif |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
240 |
|
0 | 241 |
OwnPtr<Chrome> m_chrome; |
242 |
OwnPtr<SelectionController> m_dragCaretController; |
|
243 |
#if ENABLE(DRAG_SUPPORT) |
|
244 |
OwnPtr<DragController> m_dragController; |
|
245 |
#endif |
|
246 |
OwnPtr<FocusController> m_focusController; |
|
247 |
#if ENABLE(CONTEXT_MENUS) |
|
248 |
OwnPtr<ContextMenuController> m_contextMenuController; |
|
249 |
#endif |
|
250 |
#if ENABLE(INSPECTOR) |
|
251 |
OwnPtr<InspectorController> m_inspectorController; |
|
252 |
#endif |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
253 |
#if ENABLE(CLIENT_BASED_GEOLOCATION) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
254 |
OwnPtr<GeolocationController> m_geolocationController; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
255 |
#endif |
0 | 256 |
OwnPtr<Settings> m_settings; |
257 |
OwnPtr<ProgressTracker> m_progress; |
|
258 |
||
259 |
RefPtr<BackForwardList> m_backForwardList; |
|
260 |
RefPtr<Frame> m_mainFrame; |
|
261 |
||
262 |
RefPtr<HistoryItem> m_globalHistoryItem; |
|
263 |
||
264 |
mutable RefPtr<PluginData> m_pluginData; |
|
265 |
||
266 |
RefPtr<RenderTheme> m_theme; |
|
267 |
||
268 |
EditorClient* m_editorClient; |
|
269 |
||
270 |
int m_frameCount; |
|
271 |
String m_groupName; |
|
272 |
bool m_openedByDOM; |
|
273 |
||
274 |
bool m_tabKeyCyclesThroughElements; |
|
275 |
bool m_defersLoading; |
|
276 |
||
277 |
bool m_inLowQualityInterpolationMode; |
|
278 |
bool m_cookieEnabled; |
|
279 |
bool m_areMemoryCacheClientCallsEnabled; |
|
280 |
float m_mediaVolume; |
|
281 |
||
282 |
bool m_javaScriptURLsAreAllowed; |
|
283 |
||
284 |
String m_userStyleSheetPath; |
|
285 |
mutable String m_userStyleSheet; |
|
286 |
mutable bool m_didLoadUserStyleSheet; |
|
287 |
mutable time_t m_userStyleSheetModificationTime; |
|
288 |
||
289 |
OwnPtr<PageGroup> m_singlePageGroup; |
|
290 |
PageGroup* m_group; |
|
291 |
||
292 |
JSC::Debugger* m_debugger; |
|
293 |
||
294 |
double m_customHTMLTokenizerTimeDelay; |
|
295 |
int m_customHTMLTokenizerChunkSize; |
|
296 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
297 |
bool m_canStartMedia; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
298 |
HashSet<MediaCanStartListener*> m_mediaCanStartListeners; |
0 | 299 |
|
300 |
OwnPtr<PluginHalter> m_pluginHalter; |
|
301 |
||
302 |
#if ENABLE(DOM_STORAGE) |
|
303 |
RefPtr<StorageNamespace> m_sessionStorage; |
|
304 |
#endif |
|
305 |
||
306 |
#if ENABLE(WML) |
|
307 |
OwnPtr<WMLPageState> m_wmlPageState; |
|
308 |
#endif |
|
309 |
||
310 |
#if ENABLE(NOTIFICATIONS) |
|
311 |
NotificationPresenter* m_notificationPresenter; |
|
312 |
#endif |
|
313 |
}; |
|
314 |
||
315 |
} // namespace WebCore |
|
316 |
||
317 |
#endif // Page_h |