Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: third_party/WebKit/Source/core/html/media/AutoplayPolicy.h

Issue 2850553002: Autoplay: use an autoplay policy setting in Blink. (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 AutoplayPolicy_h 5 #ifndef AutoplayPolicy_h
6 #define AutoplayPolicy_h 6 #define AutoplayPolicy_h
7 7
8 #include "bindings/core/v8/Nullable.h" 8 #include "bindings/core/v8/Nullable.h"
9 #include "core/CoreExport.h"
9 #include "core/dom/ExceptionCode.h" 10 #include "core/dom/ExceptionCode.h"
10 #include "platform/heap/Handle.h" 11 #include "platform/heap/Handle.h"
11 12
12 namespace blink { 13 namespace blink {
13 14
14 class AutoplayUmaHelper; 15 class AutoplayUmaHelper;
15 class Document; 16 class Document;
16 class ElementVisibilityObserver; 17 class ElementVisibilityObserver;
17 class HTMLMediaElement; 18 class HTMLMediaElement;
18 19
19 // AutoplayPolicy is the class for handles autoplay logics. 20 // AutoplayPolicy is the class for handles autoplay logics.
20 class AutoplayPolicy final : public GarbageCollected<AutoplayPolicy> { 21 class AutoplayPolicy final : public GarbageCollected<AutoplayPolicy> {
21 public: 22 public:
23 // Different autoplay policy types.
24 enum class Type {
25 kNoUserGestureRequired = 0,
26 kUserGestureRequired,
27 kUserGestureRequiredForCrossOrigin,
28 };
29
30 CORE_EXPORT static Type GetAutoplayPolicyForDocument(const Document&);
31
22 explicit AutoplayPolicy(HTMLMediaElement*); 32 explicit AutoplayPolicy(HTMLMediaElement*);
23 33
24 void VideoWillBeDrawnToCanvas() const; 34 void VideoWillBeDrawnToCanvas() const;
25 35
26 // Called when the media element is moved to a new document. 36 // Called when the media element is moved to a new document.
27 void DidMoveToNewDocument(Document& old_document); 37 void DidMoveToNewDocument(Document& old_document);
28 38
29 // Stop autoplaying the video element whenever its visible. 39 // Stop autoplaying the video element whenever its visible.
30 // TODO(mlamouri): hide these methods from HTMLMediaElement. 40 // TODO(mlamouri): hide these methods from HTMLMediaElement.
31 void StopAutoplayMutedWhenVisible(); 41 void StopAutoplayMutedWhenVisible();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 Member<ElementVisibilityObserver> autoplay_visibility_observer_; 114 Member<ElementVisibilityObserver> autoplay_visibility_observer_;
105 115
106 Member<AutoplayUmaHelper> autoplay_uma_helper_; 116 Member<AutoplayUmaHelper> autoplay_uma_helper_;
107 117
108 DISALLOW_COPY_AND_ASSIGN(AutoplayPolicy); 118 DISALLOW_COPY_AND_ASSIGN(AutoplayPolicy);
109 }; 119 };
110 120
111 } // namespace blink 121 } // namespace blink
112 122
113 #endif // AutoplayPolicy_h 123 #endif // AutoplayPolicy_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/Settings.json5 ('k') | third_party/WebKit/Source/core/html/media/AutoplayPolicy.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698