OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef DragEvent_h |
| 6 #define DragEvent_h |
| 7 |
| 8 #include "core/events/DragEventInit.h" |
| 9 #include "core/events/MouseEvent.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 class DataTransfer; |
| 14 |
| 15 class DragEvent final : public MouseEvent { |
| 16 DEFINE_WRAPPERTYPEINFO(); |
| 17 |
| 18 public: |
| 19 static PassRefPtrWillBeRawPtr<DragEvent> create() |
| 20 { |
| 21 return adoptRefWillBeNoop(new DragEvent); |
| 22 } |
| 23 |
| 24 static PassRefPtrWillBeRawPtr<DragEvent> create(DataTransfer* dataTransfer) |
| 25 { |
| 26 return adoptRefWillBeNoop(new DragEvent(dataTransfer)); |
| 27 } |
| 28 |
| 29 static PassRefPtrWillBeRawPtr<DragEvent> create(const AtomicString& type, co
nst DragEventInit& initializer) |
| 30 { |
| 31 return adoptRefWillBeNoop(new DragEvent(type, initializer)); |
| 32 } |
| 33 |
| 34 DataTransfer* dataTransfer() const override { return isDragEvent() ? m_dataT
ransfer.get() : 0; } |
| 35 |
| 36 bool isDragEvent() const override; |
| 37 bool isMouseEvent() const override; |
| 38 |
| 39 DECLARE_VIRTUAL_TRACE(); |
| 40 |
| 41 private: |
| 42 DragEvent(); |
| 43 DragEvent(DataTransfer*); |
| 44 DragEvent(const AtomicString& type, const DragEventInit&); |
| 45 |
| 46 PersistentWillBeMember<DataTransfer> m_dataTransfer; |
| 47 }; |
| 48 |
| 49 class DragEventDispatchMediator final : public EventDispatchMediator { |
| 50 public: |
| 51 static PassRefPtrWillBeRawPtr<DragEventDispatchMediator> create(PassRefPtrWi
llBeRawPtr<DragEvent>); |
| 52 |
| 53 private: |
| 54 explicit DragEventDispatchMediator(PassRefPtrWillBeRawPtr<DragEvent>); |
| 55 DragEvent& event() const; |
| 56 bool dispatchEvent(EventDispatcher&) const override; |
| 57 }; |
| 58 |
| 59 DEFINE_EVENT_TYPE_CASTS(DragEvent); |
| 60 |
| 61 } // namespace blink |
| 62 |
| 63 #endif // DragEvent_h |
OLD | NEW |