Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: webkit/pending/DOMWindow.h

Issue 6500: Cleaning up the unfork (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/pending/CompositeAnimation.h ('k') | webkit/pending/DOMWindow.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2006, 2007 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 #ifndef DOMWindow_h
27 #define DOMWindow_h
28
29 #include "KURL.h"
30 #include "PlatformString.h"
31 #include "SecurityOrigin.h"
32 #include <wtf/Forward.h>
33 #include <wtf/RefCounted.h>
34
35 #if USE(V8)
36 #include <wtf/HashMap.h>
37 #endif
38 #include <wtf/RefPtr.h>
39
40 namespace WebCore {
41
42 class BarInfo;
43 class CSSRuleList;
44 class CSSStyleDeclaration;
45 class Console;
46 class DOMSelection;
47 class Database;
48 class Document;
49 class Element;
50 class FloatRect;
51 class Frame;
52 class History;
53 class Location;
54 class Navigator;
55 class PostMessageTimer;
56 class Screen;
57 class String;
58
59 #if USE(V8)
60 class ScheduledAction;
61 class PausedTimeouts;
62 class DOMWindowTimer;
63 #endif
64
65 #if ENABLE(DOM_STORAGE)
66 class SessionStorage;
67 class Storage;
68 #endif
69
70 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
71 class DOMApplicationCache;
72 #endif
73
74 typedef int ExceptionCode;
75
76 class DOMWindow : public RefCounted<DOMWindow> {
77 public:
78 static PassRefPtr<DOMWindow> create(Frame* frame) { return adoptRef(new DOMWindow(frame)); }
79 virtual ~DOMWindow();
80
81 Frame* frame() { return m_frame; }
82 void disconnectFrame();
83
84 void clear();
85
86 void setSecurityOrigin(SecurityOrigin* securityOrigin) { m_securityOrigi n = securityOrigin; }
87 SecurityOrigin* securityOrigin() const { return m_securityOrigin.get(); }
88
89 void setURL(const KURL& url) { m_url = url; }
90 KURL url() const { return m_url; }
91
92 static void adjustWindowRect(const FloatRect& screen, FloatRect& window, const FloatRect& pendingChanges);
93
94 // DOM Level 0
95 Screen* screen() const;
96 History* history() const;
97 BarInfo* locationbar() const;
98 BarInfo* menubar() const;
99 BarInfo* personalbar() const;
100 BarInfo* scrollbars() const;
101 BarInfo* statusbar() const;
102 BarInfo* toolbar() const;
103 Navigator* navigator() const;
104 Navigator* clientInformation() const { return navigator(); }
105 Location* location() const;
106
107 DOMSelection* getSelection();
108
109 Element* frameElement() const;
110
111 void focus();
112 void blur();
113 void close();
114 void print();
115 void stop();
116
117 void alert(const String& message);
118 bool confirm(const String& message);
119 String prompt(const String& message, const String& defaultValue);
120
121 bool find(const String&, bool caseSensitive, bool backwards, bool wrap, bool wholeWord, bool searchInFrames, bool showDialog) const;
122
123 bool offscreenBuffering() const;
124
125 int outerHeight() const;
126 int outerWidth() const;
127 int innerHeight() const;
128 int innerWidth() const;
129 int screenX() const;
130 int screenY() const;
131 int screenLeft() const { return screenX(); }
132 int screenTop() const { return screenY(); }
133 int scrollX() const;
134 int scrollY() const;
135 int pageXOffset() const { return scrollX(); }
136 int pageYOffset() const { return scrollY(); }
137
138 bool closed() const;
139
140 unsigned length() const;
141
142 String name() const;
143 void setName(const String&);
144
145 String status() const;
146 void setStatus(const String&);
147 String defaultStatus() const;
148 void setDefaultStatus(const String&);
149 // This attribute is an alias of defaultStatus and is necessary for lega cy uses.
150 String defaultstatus() const { return defaultStatus(); }
151 void setDefaultstatus(const String& status) { setDefaultStatus(status); }
152
153 // Self referential attributes
154 DOMWindow* self() const;
155 DOMWindow* window() const { return self(); }
156 DOMWindow* frames() const { return self(); }
157
158 DOMWindow* opener() const;
159 DOMWindow* parent() const;
160 DOMWindow* top() const;
161
162 // DOM Level 2 AbstractView Interface
163 Document* document() const;
164
165 // DOM Level 2 Style Interface
166 PassRefPtr<CSSStyleDeclaration> getComputedStyle(Element*, const String& pseudoElt) const;
167
168 // WebKit extensions
169 PassRefPtr<CSSRuleList> getMatchedCSSRules(Element*, const String& pseud oElt, bool authorOnly = true) const;
170 double devicePixelRatio() const;
171
172 #if ENABLE(DATABASE)
173 // HTML 5 client-side database
174 PassRefPtr<Database> openDatabase(const String& name, const String& vers ion, const String& displayName, unsigned long estimatedSize, ExceptionCode&);
175 #endif
176
177 #if ENABLE(DOM_STORAGE)
178 // HTML 5 key/value storage
179 Storage* sessionStorage() const;
180 Storage* localStorage() const;
181 #endif
182
183 Console* console() const;
184
185 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
186 DOMApplicationCache* applicationCache() const;
187 #endif
188
189 void postMessage(const String& message, const String& targetOrigin, DOMW indow* source, ExceptionCode&);
190 void postMessageTimerFired(PostMessageTimer*);
191
192 void scrollBy(int x, int y) const;
193 void scrollTo(int x, int y) const;
194 void scroll(int x, int y) const { scrollTo(x, y); }
195
196 void moveBy(float x, float y) const;
197 void moveTo(float x, float y) const;
198
199 void resizeBy(float x, float y) const;
200 void resizeTo(float width, float height) const;
201
202 // These methods are used for GC marking. See JSDOMWindow::mark() in
203 // JSDOMWindowCustom.cpp.
204 Screen* optionalScreen() const { return m_screen.get(); }
205 DOMSelection* optionalSelection() const { return m_selection.get(); }
206 History* optionalHistory() const { return m_history.get(); }
207 BarInfo* optionalLocationbar() const { return m_locationbar.get(); }
208 BarInfo* optionalMenubar() const { return m_menubar.get(); }
209 BarInfo* optionalPersonalbar() const { return m_personalbar.get(); }
210 BarInfo* optionalScrollbars() const { return m_scrollbars.get(); }
211 BarInfo* optionalStatusbar() const { return m_statusbar.get(); }
212 BarInfo* optionalToolbar() const { return m_toolbar.get(); }
213 Console* optionalConsole() const { return m_console.get(); }
214 Navigator* optionalNavigator() const { return m_navigator.get(); }
215 Location* optionalLocation() const { return m_location.get(); }
216 #if ENABLE(DOM_STORAGE)
217 Storage* optionalSessionStorage() const { return m_sessionStorage.get(); }
218 Storage* optionalLocalStorage() const { return m_sessionStorage.get(); }
219 #endif
220 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
221 DOMApplicationCache* optionalApplicationCache() const { return m_applica tionCache.get(); }
222 #endif
223
224 private:
225 DOMWindow(Frame*);
226
227 RefPtr<SecurityOrigin> m_securityOrigin;
228 KURL m_url;
229
230 Frame* m_frame;
231 mutable RefPtr<Screen> m_screen;
232 mutable RefPtr<DOMSelection> m_selection;
233 mutable RefPtr<History> m_history;
234 mutable RefPtr<BarInfo> m_locationbar;
235 mutable RefPtr<BarInfo> m_menubar;
236 mutable RefPtr<BarInfo> m_personalbar;
237 mutable RefPtr<BarInfo> m_scrollbars;
238 mutable RefPtr<BarInfo> m_statusbar;
239 mutable RefPtr<BarInfo> m_toolbar;
240 mutable RefPtr<Console> m_console;
241 mutable RefPtr<Navigator> m_navigator;
242 mutable RefPtr<Location> m_location;
243 #if ENABLE(DOM_STORAGE)
244 mutable RefPtr<Storage> m_sessionStorage;
245 mutable RefPtr<Storage> m_localStorage;
246 #endif
247 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
248 mutable RefPtr<DOMApplicationCache> m_applicationCache;
249 #endif
250
251 private:
252 void updateLayout() const;
253
254
255 #if USE(V8)
256 public:
257 // DOM methods & attributes for Window.
258
259 DOMWindow* open(const String& url = "",
260 const String& name = "_blank",
261 const String& options = "");
262
263 void back();
264 void forward();
265
266 Navigator* navigator();
267 void dump(const String&);
268
269 Location* location();
270
271 // Change the current window location to a new location.
272 // The function checks domain security.
273 void setLocation(const String& loc);
274
275 // void home();
276 // void stop();
277
278 void clearTimeout(int id);
279 void clearInterval(int id) { clearTimeout(id); }
280
281 void timerFired(DOMWindowTimer* timer);
282
283 // void updateCommands(const String&);
284 //
285 // String escape(const String&);
286 // String unescape(const String&);
287
288 int installTimeout(ScheduledAction* a, int t, bool singleShot);
289
290 void scheduleClose();
291 void clearAllTimeouts();
292
293 void pauseTimeouts(OwnPtr<PausedTimeouts>&);
294 void resumeTimeouts(OwnPtr<PausedTimeouts>&);
295
296 private:
297 typedef HashMap<int, DOMWindowTimer*> TimeoutsMap;
298 TimeoutsMap m_timeouts;
299 #endif
300 };
301
302 } // namespace WebCore
303
304 #endif
OLDNEW
« no previous file with comments | « webkit/pending/CompositeAnimation.h ('k') | webkit/pending/DOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698