summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/modules/media_controls/elements/media_control_panel_element.h
blob: ccb43bbb8fab5654a7f0af66d2a4a50c0776e585 (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
62
63
// Copyright 2017 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_MODULES_MEDIA_CONTROLS_ELEMENTS_MEDIA_CONTROL_PANEL_ELEMENT_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIA_CONTROLS_ELEMENTS_MEDIA_CONTROL_PANEL_ELEMENT_H_

#include "third_party/blink/renderer/modules/media_controls/elements/media_control_div_element.h"
#include "third_party/blink/renderer/modules/modules_export.h"

namespace blink {

class ContainerNode;
class Event;
class MediaControlsImpl;

class MODULES_EXPORT MediaControlPanelElement final
    : public MediaControlDivElement {
 public:
  explicit MediaControlPanelElement(MediaControlsImpl&);

 public:
  // Methods called by `MediaControlsImpl`.
  void SetIsDisplayed(bool);
  bool IsOpaque() const;
  void MakeOpaque();
  void MakeTransparent();

  bool KeepDisplayedForAccessibility();
  void SetKeepDisplayedForAccessibility(bool);

  // Node override;
  void RemovedFrom(ContainerNode&) override;

  void Trace(blink::Visitor*) override;

 protected:
  friend class MediaControlPanelElementTest;

  bool EventListenerIsAttachedForTest() const;

 private:
  class TransitionEventListener;

  void EnsureTransitionEventListener();
  void DetachTransitionEventListener();

  void DefaultEventHandler(Event&) override;
  bool KeepEventInNode(const Event&) const override;

  void DidBecomeVisible();
  void HandleTransitionEndEvent();

  bool is_displayed_ = false;
  bool opaque_ = true;
  bool keep_displayed_for_accessibility_ = false;

  Member<TransitionEventListener> event_listener_;
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIA_CONTROLS_ELEMENTS_MEDIA_CONTROL_PANEL_ELEMENT_H_