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

Side by Side Diff: Source/core/page/DOMWindow.h

Issue 26878003: Reduce repetitive EventTarget subclassing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix nit Created 7 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 | « Source/core/loader/appcache/ApplicationCache.cpp ('k') | Source/core/page/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
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2009, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 class Storage; 74 class Storage;
75 class StyleMedia; 75 class StyleMedia;
76 class DOMWindowCSS; 76 class DOMWindowCSS;
77 77
78 struct WindowFeatures; 78 struct WindowFeatures;
79 79
80 typedef Vector<RefPtr<MessagePort>, 1> MessagePortArray; 80 typedef Vector<RefPtr<MessagePort>, 1> MessagePortArray;
81 81
82 enum SetLocationLocking { LockHistoryBasedOnGestureState, LockHistoryAndBack ForwardList }; 82 enum SetLocationLocking { LockHistoryBasedOnGestureState, LockHistoryAndBack ForwardList };
83 83
84 class DOMWindow : public RefCounted<DOMWindow>, public ScriptWrappable, publ ic EventTarget, public FrameDestructionObserver, public Supplementable<DOMWindow >, public LifecycleContext { 84 class DOMWindow : public RefCounted<DOMWindow>, public ScriptWrappable, publ ic EventTargetWithInlineData, public FrameDestructionObserver, public Supplement able<DOMWindow>, public LifecycleContext {
85 public: 85 public:
86 static PassRefPtr<DOMWindow> create(Frame* frame) { return adoptRef(new DOMWindow(frame)); } 86 static PassRefPtr<DOMWindow> create(Frame* frame) { return adoptRef(new DOMWindow(frame)); }
87 virtual ~DOMWindow(); 87 virtual ~DOMWindow();
88 88
89 // In some rare cases, we'll re-used a DOMWindow for a new Document. For example, 89 // In some rare cases, we'll re-used a DOMWindow for a new Document. For example,
90 // when a script calls window.open("..."), the browser gives JavaScript a window 90 // when a script calls window.open("..."), the browser gives JavaScript a window
91 // synchronously but kicks off the load in the window asynchronously. We b sites 91 // synchronously but kicks off the load in the window asynchronously. We b sites
92 // expect that modifications that they make to the window object synchro nously 92 // expect that modifications that they make to the window object synchro nously
93 // won't be blown away when the network load commits. To make that happe n, we 93 // won't be blown away when the network load commits. To make that happe n, we
94 // "securely transition" the existing DOMWindow to the Document that res ults from 94 // "securely transition" the existing DOMWindow to the Document that res ults from
95 // the network load. See also SecurityContext::isSecureTransitionTo. 95 // the network load. See also SecurityContext::isSecureTransitionTo.
96 void setDocument(PassRefPtr<Document>); 96 void setDocument(PassRefPtr<Document>);
97 97
98 virtual const AtomicString& interfaceName() const; 98 virtual const AtomicString& interfaceName() const OVERRIDE;
99 virtual ScriptExecutionContext* scriptExecutionContext() const; 99 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
100 100
101 virtual DOMWindow* toDOMWindow(); 101 virtual DOMWindow* toDOMWindow();
102 102
103 void registerProperty(DOMWindowProperty*); 103 void registerProperty(DOMWindowProperty*);
104 void unregisterProperty(DOMWindowProperty*); 104 void unregisterProperty(DOMWindowProperty*);
105 105
106 void reset(); 106 void reset();
107 107
108 PassRefPtr<MediaQueryList> matchMedia(const String&); 108 PassRefPtr<MediaQueryList> matchMedia(const String&);
109 109
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 240
241 // WebKit animation extensions 241 // WebKit animation extensions
242 int requestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>); 242 int requestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>);
243 int webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback >); 243 int webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback >);
244 void cancelAnimationFrame(int id); 244 void cancelAnimationFrame(int id);
245 245
246 DOMWindowCSS* css(); 246 DOMWindowCSS* css();
247 247
248 // Events 248 // Events
249 // EventTarget API 249 // EventTarget API
250 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr< EventListener>, bool useCapture); 250 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr< EventListener>, bool useCapture) OVERRIDE;
251 virtual bool removeEventListener(const AtomicString& eventType, EventLis tener*, bool useCapture); 251 virtual bool removeEventListener(const AtomicString& eventType, EventLis tener*, bool useCapture) OVERRIDE;
252 virtual void removeAllEventListeners(); 252 virtual void removeAllEventListeners() OVERRIDE;
253 253
254 using EventTarget::dispatchEvent; 254 using EventTarget::dispatchEvent;
255 bool dispatchEvent(PassRefPtr<Event> prpEvent, PassRefPtr<EventTarget> p rpTarget); 255 bool dispatchEvent(PassRefPtr<Event> prpEvent, PassRefPtr<EventTarget> p rpTarget);
256 256
257 void dispatchLoadEvent(); 257 void dispatchLoadEvent();
258 258
259 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); 259 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort);
260 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationend); 260 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationend);
261 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationiteration); 261 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationiteration);
262 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationstart); 262 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationstart);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 private: 385 private:
386 explicit DOMWindow(Frame*); 386 explicit DOMWindow(Frame*);
387 387
388 Page* page(); 388 Page* page();
389 389
390 virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE ; 390 virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE ;
391 391
392 virtual void frameDestroyed() OVERRIDE; 392 virtual void frameDestroyed() OVERRIDE;
393 virtual void willDetachPage() OVERRIDE; 393 virtual void willDetachPage() OVERRIDE;
394 394
395 virtual void refEventTarget() { ref(); } 395 virtual void refEventTarget() OVERRIDE { ref(); }
396 virtual void derefEventTarget() { deref(); } 396 virtual void derefEventTarget() OVERRIDE { deref(); }
397 virtual EventTargetData* eventTargetData();
398 virtual EventTargetData* ensureEventTargetData();
399 397
400 void resetDOMWindowProperties(); 398 void resetDOMWindowProperties();
401 void willDestroyDocumentInFrame(); 399 void willDestroyDocumentInFrame();
402 400
403 RefPtr<Document> m_document; 401 RefPtr<Document> m_document;
404 402
405 bool m_shouldPrintWhenFinishedLoading; 403 bool m_shouldPrintWhenFinishedLoading;
406 404
407 HashSet<DOMWindowProperty*> m_properties; 405 HashSet<DOMWindowProperty*> m_properties;
408 406
409 mutable RefPtr<Screen> m_screen; 407 mutable RefPtr<Screen> m_screen;
410 mutable RefPtr<History> m_history; 408 mutable RefPtr<History> m_history;
411 mutable RefPtr<BarProp> m_locationbar; 409 mutable RefPtr<BarProp> m_locationbar;
412 mutable RefPtr<BarProp> m_menubar; 410 mutable RefPtr<BarProp> m_menubar;
413 mutable RefPtr<BarProp> m_personalbar; 411 mutable RefPtr<BarProp> m_personalbar;
414 mutable RefPtr<BarProp> m_scrollbars; 412 mutable RefPtr<BarProp> m_scrollbars;
415 mutable RefPtr<BarProp> m_statusbar; 413 mutable RefPtr<BarProp> m_statusbar;
416 mutable RefPtr<BarProp> m_toolbar; 414 mutable RefPtr<BarProp> m_toolbar;
417 mutable RefPtr<Console> m_console; 415 mutable RefPtr<Console> m_console;
418 mutable RefPtr<Navigator> m_navigator; 416 mutable RefPtr<Navigator> m_navigator;
419 mutable RefPtr<Location> m_location; 417 mutable RefPtr<Location> m_location;
420 mutable RefPtr<StyleMedia> m_media; 418 mutable RefPtr<StyleMedia> m_media;
421 419
422 EventTargetData m_eventTargetData;
423
424 String m_status; 420 String m_status;
425 String m_defaultStatus; 421 String m_defaultStatus;
426 422
427 mutable RefPtr<Storage> m_sessionStorage; 423 mutable RefPtr<Storage> m_sessionStorage;
428 mutable RefPtr<Storage> m_localStorage; 424 mutable RefPtr<Storage> m_localStorage;
429 mutable RefPtr<ApplicationCache> m_applicationCache; 425 mutable RefPtr<ApplicationCache> m_applicationCache;
430 426
431 mutable RefPtr<Performance> m_performance; 427 mutable RefPtr<Performance> m_performance;
432 428
433 mutable RefPtr<DOMWindowCSS> m_css; 429 mutable RefPtr<DOMWindowCSS> m_css;
434 }; 430 };
435 431
436 inline String DOMWindow::status() const 432 inline String DOMWindow::status() const
437 { 433 {
438 return m_status; 434 return m_status;
439 } 435 }
440 436
441 inline String DOMWindow::defaultStatus() const 437 inline String DOMWindow::defaultStatus() const
442 { 438 {
443 return m_defaultStatus; 439 return m_defaultStatus;
444 } 440 }
445 441
446 } // namespace WebCore 442 } // namespace WebCore
447 443
448 #endif // DOMWindow_h 444 #endif // DOMWindow_h
OLDNEW
« no previous file with comments | « Source/core/loader/appcache/ApplicationCache.cpp ('k') | Source/core/page/DOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698