summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/events/drag_event.h
blob: c03a738f3a0a05cb76349db4f7817bc1fdf60ad8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_EVENTS_DRAG_EVENT_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_EVENTS_DRAG_EVENT_H_

#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/events/drag_event_init.h"
#include "third_party/blink/renderer/core/events/mouse_event.h"

namespace blink {

class DataTransfer;

class CORE_EXPORT DragEvent final : public MouseEvent {
  DEFINE_WRAPPERTYPEINFO();

 public:
  static DragEvent* Create() { return new DragEvent; }

  static DragEvent* Create(const AtomicString& type,
                           const DragEventInit& initializer,
                           TimeTicks platform_time_stamp,
                           SyntheticEventType synthetic_event_type) {
    return new DragEvent(type, initializer, platform_time_stamp,
                         synthetic_event_type);
  }

  static DragEvent* Create(const AtomicString& type,
                           const DragEventInit& initializer) {
    return new DragEvent(type, initializer, CurrentTimeTicks(),
                         kRealOrIndistinguishable);
  }

  DataTransfer* getDataTransfer() const override {
    return IsDragEvent() ? data_transfer_.Get() : nullptr;
  }

  bool IsDragEvent() const override;
  bool IsMouseEvent() const override;

  DispatchEventResult DispatchEvent(EventDispatcher&) override;

  void Trace(blink::Visitor*) override;

 private:
  DragEvent();
  DragEvent(const AtomicString& type,
            const DragEventInit&,
            TimeTicks platform_time_stamp,
            SyntheticEventType);

  Member<DataTransfer> data_transfer_;
};

DEFINE_EVENT_TYPE_CASTS(DragEvent);

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_EVENTS_DRAG_EVENT_H_