OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef RelatedEvent_h | 5 #ifndef RelatedEvent_h |
6 #define RelatedEvent_h | 6 #define RelatedEvent_h |
7 | 7 |
8 #include "core/events/Event.h" | 8 #include "core/events/Event.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 struct RelatedEventInit : public EventInit { | 12 struct RelatedEventInit : public EventInit { |
13 RelatedEventInit(); | 13 RelatedEventInit(); |
14 RefPtrWillBeMember<EventTarget> relatedTarget; | 14 RefPtrWillBeMember<EventTarget> relatedTarget; |
15 }; | 15 }; |
16 | 16 |
17 class RelatedEvent FINAL : public Event { | 17 class RelatedEvent FINAL : public Event { |
18 public: | 18 public: |
19 static PassRefPtrWillBeRawPtr<RelatedEvent> create(); | 19 static PassRefPtrWillBeRawPtr<RelatedEvent> create(); |
20 static PassRefPtrWillBeRawPtr<RelatedEvent> create(const AtomicString& type,
bool canBubble, bool cancelable, EventTarget* relatedTarget); | 20 static PassRefPtrWillBeRawPtr<RelatedEvent> create(const AtomicString& type,
bool canBubble, bool cancelable, EventTarget* relatedTarget); |
21 static PassRefPtrWillBeRawPtr<RelatedEvent> create(const AtomicString& event
Type, const RelatedEventInit&); | 21 static PassRefPtrWillBeRawPtr<RelatedEvent> create(const AtomicString& event
Type, const RelatedEventInit&); |
22 | 22 |
23 virtual ~RelatedEvent(); | 23 virtual ~RelatedEvent(); |
24 | 24 |
25 EventTarget* relatedTarget() const { return m_relatedTarget.get(); } | 25 EventTarget* relatedTarget() const { return m_relatedTarget.get(); } |
26 void setRelatedTarget(EventTarget* relatedTarget) { m_relatedTarget = relate
dTarget; } | |
27 | |
28 | 26 |
29 virtual const AtomicString& interfaceName() const OVERRIDE { return EventNam
es::RelatedEvent; } | 27 virtual const AtomicString& interfaceName() const OVERRIDE { return EventNam
es::RelatedEvent; } |
30 virtual bool isRelatedEvent() const OVERRIDE { return true; } | 28 virtual bool isRelatedEvent() const OVERRIDE { return true; } |
31 | 29 |
32 virtual void trace(Visitor*) OVERRIDE; | 30 virtual void trace(Visitor*) OVERRIDE; |
33 | 31 |
34 private: | 32 private: |
35 RelatedEvent(); | 33 RelatedEvent(); |
36 RelatedEvent(const AtomicString& type, bool canBubble, bool cancelable, Even
tTarget*); | 34 RelatedEvent(const AtomicString& type, bool canBubble, bool cancelable, Even
tTarget*); |
37 RelatedEvent(const AtomicString& type, const RelatedEventInit&); | 35 RelatedEvent(const AtomicString& type, const RelatedEventInit&); |
38 | 36 |
39 RefPtrWillBeMember<EventTarget> m_relatedTarget; | 37 RefPtrWillBeMember<EventTarget> m_relatedTarget; |
40 }; | 38 }; |
41 | 39 |
42 DEFINE_EVENT_TYPE_CASTS(RelatedEvent); | 40 DEFINE_EVENT_TYPE_CASTS(RelatedEvent); |
43 | 41 |
44 } // namespace blink | 42 } // namespace blink |
45 | 43 |
46 #endif // RelatedEvent_h | 44 #endif // RelatedEvent_h |
OLD | NEW |