summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/frame/device_single_window_event_controller.h
blob: c5bc23e299d4c35cd26f59072e7f872b083c8337 (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
// Copyright 2014 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_FRAME_DEVICE_SINGLE_WINDOW_EVENT_CONTROLLER_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_DEVICE_SINGLE_WINDOW_EVENT_CONTROLLER_H_

#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/platform_event_controller.h"
#include "third_party/blink/renderer/platform/heap/handle.h"

namespace blink {

class Event;

class CORE_EXPORT DeviceSingleWindowEventController
    : public GarbageCollected<DeviceSingleWindowEventController>,
      public PlatformEventController,
      public LocalDOMWindow::EventListenerObserver {
 public:
  ~DeviceSingleWindowEventController() override;

  // Inherited from PlatformEventController.
  void DidUpdateData() override;
  void Trace(Visitor*) const override;

  // Inherited from LocalDOMWindow::EventListenerObserver.
  void DidAddEventListener(LocalDOMWindow*, const AtomicString&) override;
  void DidRemoveEventListener(LocalDOMWindow*, const AtomicString&) override;
  void DidRemoveAllEventListeners(LocalDOMWindow*) override;

 protected:
  explicit DeviceSingleWindowEventController(LocalDOMWindow&);

  bool IsSameSecurityOriginAsMainFrame() const;
  bool CheckPolicyFeatures(
      const Vector<mojom::blink::FeaturePolicyFeature>& features) const;

  void DispatchDeviceEvent(Event*);

  virtual Event* LastEvent() const = 0;
  virtual const AtomicString& EventTypeName() const = 0;
  virtual bool IsNullEvent(Event*) const = 0;

 private:
  bool needs_checking_null_events_;
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_DEVICE_SINGLE_WINDOW_EVENT_CONTROLLER_H_