| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef AutoplayUmaHelper_h |
| 6 #define AutoplayUmaHelper_h |
| 7 |
| 8 #include "platform/heap/Handle.h" |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 // These values are used for histograms. Do not reorder. |
| 13 enum class AutoplaySource { |
| 14 // Autoplay comes from HTMLMediaElement `autoplay` attribute. |
| 15 Attribute = 0, |
| 16 // Autoplay comes from `play()` method. |
| 17 Method = 1, |
| 18 // This enum value must be last. |
| 19 NumberOfSources = 2, |
| 20 }; |
| 21 |
| 22 class HTMLMediaElement; |
| 23 |
| 24 class AutoplayUmaHelper final : public GarbageCollectedFinalized<AutoplayUmaHelp
er> { |
| 25 |
| 26 public: |
| 27 |
| 28 static AutoplayUmaHelper* create(HTMLMediaElement* element) |
| 29 { |
| 30 return new AutoplayUmaHelper(element); |
| 31 } |
| 32 |
| 33 ~AutoplayUmaHelper(); |
| 34 |
| 35 void onAutoplayInitiated(AutoplaySource); |
| 36 void onAutoplayStarted(); |
| 37 void onElementDestroyed(); |
| 38 |
| 39 DECLARE_TRACE(); |
| 40 |
| 41 private: |
| 42 explicit AutoplayUmaHelper(HTMLMediaElement*); |
| 43 |
| 44 // The autoplay source. Use AutoplaySource::NumberOfSources for invalid sour
ce. |
| 45 AutoplaySource m_source; |
| 46 WeakMember<HTMLMediaElement> m_element; |
| 47 }; |
| 48 |
| 49 } // namespace blink |
| 50 |
| 51 #endif // AutoplayUmaHelper_h |
| OLD | NEW |