Home | History | Annotate | Download | only in frame
      1 // Copyright 2014 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef DeviceSingleWindowEventController_h
      6 #define DeviceSingleWindowEventController_h
      7 
      8 #include "core/frame/DOMWindowLifecycleObserver.h"
      9 #include "core/frame/PlatformEventController.h"
     10 #include "platform/heap/Handle.h"
     11 
     12 namespace blink {
     13 
     14 class Document;
     15 class Event;
     16 
     17 class DeviceSingleWindowEventController : public NoBaseWillBeGarbageCollectedFinalized<DeviceSingleWindowEventController>, public PlatformEventController, public DOMWindowLifecycleObserver {
     18 public:
     19     virtual ~DeviceSingleWindowEventController();
     20 
     21     // Inherited from DeviceEventControllerBase.
     22     virtual void didUpdateData() OVERRIDE;
     23     virtual void trace(Visitor*);
     24 
     25     // Inherited from DOMWindowLifecycleObserver.
     26     virtual void didAddEventListener(LocalDOMWindow*, const AtomicString&) OVERRIDE;
     27     virtual void didRemoveEventListener(LocalDOMWindow*, const AtomicString&) OVERRIDE;
     28     virtual void didRemoveAllEventListeners(LocalDOMWindow*) OVERRIDE;
     29 
     30 protected:
     31     explicit DeviceSingleWindowEventController(Document&);
     32 
     33     void dispatchDeviceEvent(const PassRefPtrWillBeRawPtr<Event>);
     34 
     35     virtual PassRefPtrWillBeRawPtr<Event> lastEvent() const = 0;
     36     virtual const AtomicString& eventTypeName() const = 0;
     37     virtual bool isNullEvent(Event*) const = 0;
     38 
     39 private:
     40     Document& document() const { return *m_document; }
     41 
     42     bool m_needsCheckingNullEvents;
     43     RawPtrWillBeMember<Document> m_document;
     44 };
     45 
     46 } // namespace blink
     47 
     48 #endif // DeviceSingleWindowEventController_h
     49