| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 DragEvent_h | 5 #ifndef DragEvent_h |
| 6 #define DragEvent_h | 6 #define DragEvent_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/events/DragEventInit.h" | 9 #include "core/events/DragEventInit.h" |
| 10 #include "core/events/MouseEvent.h" | 10 #include "core/events/MouseEvent.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class DataTransfer; | 14 class DataTransfer; |
| 15 | 15 |
| 16 class CORE_EXPORT DragEvent final : public MouseEvent { | 16 class CORE_EXPORT DragEvent final : public MouseEvent { |
| 17 DEFINE_WRAPPERTYPEINFO(); | 17 DEFINE_WRAPPERTYPEINFO(); |
| 18 | 18 |
| 19 public: | 19 public: |
| 20 static PassRefPtrWillBeRawPtr<DragEvent> create() | 20 static RawPtr<DragEvent> create() |
| 21 { | 21 { |
| 22 return adoptRefWillBeNoop(new DragEvent); | 22 return adoptRefWillBeNoop(new DragEvent); |
| 23 } | 23 } |
| 24 | 24 |
| 25 static PassRefPtrWillBeRawPtr<DragEvent> create(DataTransfer* dataTransfer) | 25 static RawPtr<DragEvent> create(DataTransfer* dataTransfer) |
| 26 { | 26 { |
| 27 return adoptRefWillBeNoop(new DragEvent(dataTransfer)); | 27 return new DragEvent(dataTransfer); |
| 28 } | 28 } |
| 29 | 29 |
| 30 static PassRefPtrWillBeRawPtr<DragEvent> create(const AtomicString& type, bo
ol canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>, | 30 static RawPtr<DragEvent> create(const AtomicString& type, bool canBubble, bo
ol cancelable, RawPtr<AbstractView>, |
| 31 int detail, int screenX, int screenY, int windowX, int windowY, | 31 int detail, int screenX, int screenY, int windowX, int windowY, |
| 32 int movementX, int movementY, | 32 int movementX, int movementY, |
| 33 PlatformEvent::Modifiers, short button, unsigned short buttons, | 33 PlatformEvent::Modifiers, short button, unsigned short buttons, |
| 34 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, | 34 RawPtr<EventTarget> relatedTarget, |
| 35 double platformTimeStamp, DataTransfer*, | 35 double platformTimeStamp, DataTransfer*, |
| 36 PlatformMouseEvent::SyntheticEventType = PlatformMouseEvent::RealOrIndis
tinguishable); | 36 PlatformMouseEvent::SyntheticEventType = PlatformMouseEvent::RealOrIndis
tinguishable); |
| 37 | 37 |
| 38 static PassRefPtrWillBeRawPtr<DragEvent> create(const AtomicString& type, co
nst DragEventInit& initializer) | 38 static RawPtr<DragEvent> create(const AtomicString& type, const DragEventIni
t& initializer) |
| 39 { | 39 { |
| 40 return adoptRefWillBeNoop(new DragEvent(type, initializer)); | 40 return new DragEvent(type, initializer); |
| 41 } | 41 } |
| 42 | 42 |
| 43 DataTransfer* getDataTransfer() const override { return isDragEvent() ? m_da
taTransfer.get() : nullptr; } | 43 DataTransfer* getDataTransfer() const override { return isDragEvent() ? m_da
taTransfer.get() : nullptr; } |
| 44 | 44 |
| 45 bool isDragEvent() const override; | 45 bool isDragEvent() const override; |
| 46 bool isMouseEvent() const override; | 46 bool isMouseEvent() const override; |
| 47 | 47 |
| 48 PassRefPtrWillBeRawPtr<EventDispatchMediator> createMediator() override; | 48 RawPtr<EventDispatchMediator> createMediator() override; |
| 49 | 49 |
| 50 DECLARE_VIRTUAL_TRACE(); | 50 DECLARE_VIRTUAL_TRACE(); |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 DragEvent(); | 53 DragEvent(); |
| 54 DragEvent(DataTransfer*); | 54 DragEvent(DataTransfer*); |
| 55 DragEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRef
PtrWillBeRawPtr<AbstractView>, | 55 DragEvent(const AtomicString& type, bool canBubble, bool cancelable, RawPtr<
AbstractView>, |
| 56 int detail, int screenX, int screenY, int windowX, int windowY, | 56 int detail, int screenX, int screenY, int windowX, int windowY, |
| 57 int movementX, int movementY, | 57 int movementX, int movementY, |
| 58 PlatformEvent::Modifiers, short button, unsigned short buttons, | 58 PlatformEvent::Modifiers, short button, unsigned short buttons, |
| 59 PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, | 59 RawPtr<EventTarget> relatedTarget, |
| 60 double platformTimeStamp, DataTransfer*, | 60 double platformTimeStamp, DataTransfer*, |
| 61 PlatformMouseEvent::SyntheticEventType); | 61 PlatformMouseEvent::SyntheticEventType); |
| 62 | 62 |
| 63 DragEvent(const AtomicString& type, const DragEventInit&); | 63 DragEvent(const AtomicString& type, const DragEventInit&); |
| 64 | 64 |
| 65 PersistentWillBeMember<DataTransfer> m_dataTransfer; | 65 Member<DataTransfer> m_dataTransfer; |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 class DragEventDispatchMediator final : public EventDispatchMediator { | 68 class DragEventDispatchMediator final : public EventDispatchMediator { |
| 69 public: | 69 public: |
| 70 static PassRefPtrWillBeRawPtr<DragEventDispatchMediator> create(PassRefPtrWi
llBeRawPtr<DragEvent>); | 70 static RawPtr<DragEventDispatchMediator> create(RawPtr<DragEvent>); |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 explicit DragEventDispatchMediator(PassRefPtrWillBeRawPtr<DragEvent>); | 73 explicit DragEventDispatchMediator(RawPtr<DragEvent>); |
| 74 DragEvent& event() const; | 74 DragEvent& event() const; |
| 75 DispatchEventResult dispatchEvent(EventDispatcher&) const override; | 75 DispatchEventResult dispatchEvent(EventDispatcher&) const override; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 DEFINE_EVENT_TYPE_CASTS(DragEvent); | 78 DEFINE_EVENT_TYPE_CASTS(DragEvent); |
| 79 | 79 |
| 80 } // namespace blink | 80 } // namespace blink |
| 81 | 81 |
| 82 #endif // DragEvent_h | 82 #endif // DragEvent_h |
| OLD | NEW |