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

Unified Diff: third_party/WebKit/Source/core/html/AutoplayUmaHelper.h

Issue 2108403003: Measure whether muted videos that started playing with play() become visible at some point (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: this one is ready Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/AutoplayUmaHelper.h
diff --git a/third_party/WebKit/Source/core/html/AutoplayUmaHelper.h b/third_party/WebKit/Source/core/html/AutoplayUmaHelper.h
new file mode 100644
index 0000000000000000000000000000000000000000..a5709587175969c02759dc561e83245fcddae52c
--- /dev/null
+++ b/third_party/WebKit/Source/core/html/AutoplayUmaHelper.h
@@ -0,0 +1,51 @@
+// Copyright 2016 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 AutoplayUmaHelper_h
+#define AutoplayUmaHelper_h
+
+#include "platform/heap/Handle.h"
+
+namespace blink {
+
+// These values are used for histograms. Do not reorder.
+enum class AutoplaySource {
+ // Autoplay comes from HTMLMediaElement `autoplay` attribute.
+ Attribute = 0,
+ // Autoplay comes from `play()` method.
+ Method = 1,
+ // This enum value must be last.
+ NumberOfSources = 2,
+};
+
+class HTMLMediaElement;
+
+class AutoplayUmaHelper final : public GarbageCollectedFinalized<AutoplayUmaHelper> {
+
+public:
+
+ static AutoplayUmaHelper* create(HTMLMediaElement* element)
+ {
+ return new AutoplayUmaHelper(element);
+ }
+
+ ~AutoplayUmaHelper();
+
+ void onAutoplayInitiated(AutoplaySource);
+ void onAutoplayStarted();
+ void onElementDestroyed();
+
+ DECLARE_TRACE();
+
+private:
+ explicit AutoplayUmaHelper(HTMLMediaElement*);
+
+ // The autoplay source. Use AutoplaySource::NumberOfSources for invalid source.
+ AutoplaySource m_source;
+ WeakMember<HTMLMediaElement> m_element;
+};
+
+} // namespace blink
+
+#endif // AutoplayUmaHelper_h

Powered by Google App Engine
This is Rietveld 408576698