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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.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: using EventListener Created 4 years, 5 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 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 26 matching lines...) Expand all
37 #include "core/html/track/TextTrack.h" 37 #include "core/html/track/TextTrack.h"
38 #include "platform/Supplementable.h" 38 #include "platform/Supplementable.h"
39 #include "platform/audio/AudioSourceProvider.h" 39 #include "platform/audio/AudioSourceProvider.h"
40 #include "public/platform/WebAudioSourceProviderClient.h" 40 #include "public/platform/WebAudioSourceProviderClient.h"
41 #include "public/platform/WebMediaPlayerClient.h" 41 #include "public/platform/WebMediaPlayerClient.h"
42 #include "public/platform/WebMimeRegistry.h" 42 #include "public/platform/WebMimeRegistry.h"
43 #include <memory> 43 #include <memory>
44 44
45 namespace blink { 45 namespace blink {
46 46
47 enum class AutoplaySource;
mlamouri (slow - plz ping) 2016/07/07 10:17:53 I don't think you need this
Zhiqiang Zhang (Slow) 2016/07/07 11:01:10 Done.
48
47 class AudioSourceProviderClient; 49 class AudioSourceProviderClient;
48 class AudioTrackList; 50 class AudioTrackList;
51 class AutoplayUmaHelper;
49 class ContentType; 52 class ContentType;
50 class CueTimeline; 53 class CueTimeline;
51 class ElementVisibilityObserver; 54 class ElementVisibilityObserver;
52 class EnumerationHistogram; 55 class EnumerationHistogram;
53 class Event; 56 class Event;
54 class ExceptionState; 57 class ExceptionState;
55 class HTMLSourceElement; 58 class HTMLSourceElement;
56 class HTMLTrackElement; 59 class HTMLTrackElement;
57 class KURL; 60 class KURL;
58 class MediaControls; 61 class MediaControls;
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 void didMoveToNewDocument(Document& oldDocument) override; 294 void didMoveToNewDocument(Document& oldDocument) override;
292 virtual KURL posterImageURL() const { return KURL(); } 295 virtual KURL posterImageURL() const { return KURL(); }
293 296
294 enum DisplayMode { Unknown, Poster, Video }; 297 enum DisplayMode { Unknown, Poster, Video };
295 DisplayMode getDisplayMode() const { return m_displayMode; } 298 DisplayMode getDisplayMode() const { return m_displayMode; }
296 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; } 299 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; }
297 300
298 void recordAutoplayMetric(AutoplayMetrics); 301 void recordAutoplayMetric(AutoplayMetrics);
299 302
300 private: 303 private:
301 // These values are used for histograms. Do not reorder.
302 enum AutoplayUnmuteActionStatus {
303 AutoplayUnmuteActionFailure = 0,
304 AutoplayUnmuteActionSuccess = 1,
305 AutoplayUnmuteActionMax
306 };
307
308 void resetMediaPlayerAndMediaSource(); 304 void resetMediaPlayerAndMediaSource();
309 305
310 bool alwaysCreateUserAgentShadowRoot() const final { return true; } 306 bool alwaysCreateUserAgentShadowRoot() const final { return true; }
311 bool areAuthorShadowsAllowed() const final { return false; } 307 bool areAuthorShadowsAllowed() const final { return false; }
312 308
313 bool supportsFocus() const final; 309 bool supportsFocus() const final;
314 bool isMouseFocusable() const final; 310 bool isMouseFocusable() const final;
315 bool layoutObjectIsNeeded(const ComputedStyle&) override; 311 bool layoutObjectIsNeeded(const ComputedStyle&) override;
316 LayoutObject* createLayoutObject(const ComputedStyle&) override; 312 LayoutObject* createLayoutObject(const ComputedStyle&) override;
317 InsertionNotificationRequest insertedInto(ContainerNode*) final; 313 InsertionNotificationRequest insertedInto(ContainerNode*) final;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 void scheduleResolvePlayPromises(); 488 void scheduleResolvePlayPromises();
493 void scheduleRejectPlayPromises(ExceptionCode); 489 void scheduleRejectPlayPromises(ExceptionCode);
494 void scheduleNotifyPlaying(); 490 void scheduleNotifyPlaying();
495 void resolveScheduledPlayPromises(); 491 void resolveScheduledPlayPromises();
496 void rejectScheduledPlayPromises(); 492 void rejectScheduledPlayPromises();
497 void rejectPlayPromises(ExceptionCode, const String&); 493 void rejectPlayPromises(ExceptionCode, const String&);
498 void rejectPlayPromisesInternal(ExceptionCode, const String&); 494 void rejectPlayPromisesInternal(ExceptionCode, const String&);
499 495
500 EnumerationHistogram& showControlsHistogram() const; 496 EnumerationHistogram& showControlsHistogram() const;
501 497
502 void recordAutoplaySourceMetric(int source);
503 void recordAutoplayUnmuteStatus(AutoplayUnmuteActionStatus);
504
505 void onVisibilityChangedForAutoplay(bool isVisible); 498 void onVisibilityChangedForAutoplay(bool isVisible);
506 499
507 UnthrottledTimer<HTMLMediaElement> m_loadTimer; 500 UnthrottledTimer<HTMLMediaElement> m_loadTimer;
508 UnthrottledTimer<HTMLMediaElement> m_progressEventTimer; 501 UnthrottledTimer<HTMLMediaElement> m_progressEventTimer;
509 UnthrottledTimer<HTMLMediaElement> m_playbackProgressTimer; 502 UnthrottledTimer<HTMLMediaElement> m_playbackProgressTimer;
510 UnthrottledTimer<HTMLMediaElement> m_audioTracksTimer; 503 UnthrottledTimer<HTMLMediaElement> m_audioTracksTimer;
511 Member<TimeRanges> m_playedTimeRanges; 504 Member<TimeRanges> m_playedTimeRanges;
512 Member<GenericEventQueue> m_asyncEventQueue; 505 Member<GenericEventQueue> m_asyncEventQueue;
513 506
514 double m_playbackRate; 507 double m_playbackRate;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 664
672 class AutoplayHelperClientImpl; 665 class AutoplayHelperClientImpl;
673 666
674 friend class Internals; 667 friend class Internals;
675 friend class TrackDisplayUpdateScope; 668 friend class TrackDisplayUpdateScope;
676 friend class AutoplayExperimentHelper; 669 friend class AutoplayExperimentHelper;
677 friend class MediaControlsTest; 670 friend class MediaControlsTest;
678 671
679 Member<AutoplayExperimentHelper::Client> m_autoplayHelperClient; 672 Member<AutoplayExperimentHelper::Client> m_autoplayHelperClient;
680 Member<AutoplayExperimentHelper> m_autoplayHelper; 673 Member<AutoplayExperimentHelper> m_autoplayHelper;
674 Member<AutoplayUmaHelper> m_autoplayUmaHelper;
681 675
682 WebRemotePlaybackClient* m_remotePlaybackClient; 676 WebRemotePlaybackClient* m_remotePlaybackClient;
683 677
684 // class AutoplayVisibilityObserver; 678 // class AutoplayVisibilityObserver;
685 Member<ElementVisibilityObserver> m_autoplayVisibilityObserver; 679 Member<ElementVisibilityObserver> m_autoplayVisibilityObserver;
686 680
687 static URLRegistry* s_mediaStreamRegistry; 681 static URLRegistry* s_mediaStreamRegistry;
688 }; 682 };
689 683
690 inline bool isHTMLMediaElement(const HTMLElement& element) 684 inline bool isHTMLMediaElement(const HTMLElement& element)
691 { 685 {
692 return isHTMLAudioElement(element) || isHTMLVideoElement(element); 686 return isHTMLAudioElement(element) || isHTMLVideoElement(element);
693 } 687 }
694 688
695 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); 689 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
696 690
697 } // namespace blink 691 } // namespace blink
698 692
699 #endif // HTMLMediaElement_h 693 #endif // HTMLMediaElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698