Home | History | Annotate | Download | only in events
      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 RelatedEvent_h
      6 #define RelatedEvent_h
      7 
      8 #include "core/events/Event.h"
      9 
     10 namespace blink {
     11 
     12 struct RelatedEventInit : public EventInit {
     13     RelatedEventInit();
     14     RefPtrWillBeMember<EventTarget> relatedTarget;
     15 };
     16 
     17 class RelatedEvent FINAL : public Event {
     18     DEFINE_WRAPPERTYPEINFO();
     19 public:
     20     static PassRefPtrWillBeRawPtr<RelatedEvent> create();
     21     static PassRefPtrWillBeRawPtr<RelatedEvent> create(const AtomicString& type, bool canBubble, bool cancelable, EventTarget* relatedTarget);
     22     static PassRefPtrWillBeRawPtr<RelatedEvent> create(const AtomicString& eventType, const RelatedEventInit&);
     23 
     24     virtual ~RelatedEvent();
     25 
     26     EventTarget* relatedTarget() const { return m_relatedTarget.get(); }
     27 
     28     virtual const AtomicString& interfaceName() const OVERRIDE { return EventNames::RelatedEvent; }
     29     virtual bool isRelatedEvent() const OVERRIDE { return true; }
     30 
     31     virtual void trace(Visitor*) OVERRIDE;
     32 
     33 private:
     34     RelatedEvent();
     35     RelatedEvent(const AtomicString& type, bool canBubble, bool cancelable, EventTarget*);
     36     RelatedEvent(const AtomicString& type, const RelatedEventInit&);
     37 
     38     RefPtrWillBeMember<EventTarget> m_relatedTarget;
     39 };
     40 
     41 DEFINE_EVENT_TYPE_CASTS(RelatedEvent);
     42 
     43 } // namespace blink
     44 
     45 #endif // RelatedEvent_h
     46