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

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: clean up in a unload event listener 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 28 matching lines...) Expand all
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 class AudioSourceProviderClient; 47 class AudioSourceProviderClient;
48 class AudioTrackList; 48 class AudioTrackList;
49 class AutoplayUmaHelper;
49 class ContentType; 50 class ContentType;
50 class CueTimeline; 51 class CueTimeline;
51 class ElementVisibilityObserver; 52 class ElementVisibilityObserver;
52 class EnumerationHistogram; 53 class EnumerationHistogram;
53 class Event; 54 class Event;
54 class ExceptionState; 55 class ExceptionState;
55 class HTMLSourceElement; 56 class HTMLSourceElement;
56 class HTMLTrackElement; 57 class HTMLTrackElement;
57 class KURL; 58 class KURL;
58 class MediaControls; 59 class MediaControls;
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 void didMoveToNewDocument(Document& oldDocument) override; 292 void didMoveToNewDocument(Document& oldDocument) override;
292 virtual KURL posterImageURL() const { return KURL(); } 293 virtual KURL posterImageURL() const { return KURL(); }
293 294
294 enum DisplayMode { Unknown, Poster, Video }; 295 enum DisplayMode { Unknown, Poster, Video };
295 DisplayMode getDisplayMode() const { return m_displayMode; } 296 DisplayMode getDisplayMode() const { return m_displayMode; }
296 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; } 297 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; }
297 298
298 void recordAutoplayMetric(AutoplayMetrics); 299 void recordAutoplayMetric(AutoplayMetrics);
299 300
300 private: 301 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(); 302 void resetMediaPlayerAndMediaSource();
309 303
310 bool alwaysCreateUserAgentShadowRoot() const final { return true; } 304 bool alwaysCreateUserAgentShadowRoot() const final { return true; }
311 bool areAuthorShadowsAllowed() const final { return false; } 305 bool areAuthorShadowsAllowed() const final { return false; }
312 306
313 bool supportsFocus() const final; 307 bool supportsFocus() const final;
314 bool isMouseFocusable() const final; 308 bool isMouseFocusable() const final;
315 bool layoutObjectIsNeeded(const ComputedStyle&) override; 309 bool layoutObjectIsNeeded(const ComputedStyle&) override;
316 LayoutObject* createLayoutObject(const ComputedStyle&) override; 310 LayoutObject* createLayoutObject(const ComputedStyle&) override;
317 InsertionNotificationRequest insertedInto(ContainerNode*) final; 311 InsertionNotificationRequest insertedInto(ContainerNode*) final;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 void scheduleResolvePlayPromises(); 486 void scheduleResolvePlayPromises();
493 void scheduleRejectPlayPromises(ExceptionCode); 487 void scheduleRejectPlayPromises(ExceptionCode);
494 void scheduleNotifyPlaying(); 488 void scheduleNotifyPlaying();
495 void resolveScheduledPlayPromises(); 489 void resolveScheduledPlayPromises();
496 void rejectScheduledPlayPromises(); 490 void rejectScheduledPlayPromises();
497 void rejectPlayPromises(ExceptionCode, const String&); 491 void rejectPlayPromises(ExceptionCode, const String&);
498 void rejectPlayPromisesInternal(ExceptionCode, const String&); 492 void rejectPlayPromisesInternal(ExceptionCode, const String&);
499 493
500 EnumerationHistogram& showControlsHistogram() const; 494 EnumerationHistogram& showControlsHistogram() const;
501 495
502 void recordAutoplaySourceMetric(int source);
503 void recordAutoplayUnmuteStatus(AutoplayUnmuteActionStatus);
504
505 void onVisibilityChangedForAutoplay(bool isVisible); 496 void onVisibilityChangedForAutoplay(bool isVisible);
506 497
507 UnthrottledTimer<HTMLMediaElement> m_loadTimer; 498 UnthrottledTimer<HTMLMediaElement> m_loadTimer;
508 UnthrottledTimer<HTMLMediaElement> m_progressEventTimer; 499 UnthrottledTimer<HTMLMediaElement> m_progressEventTimer;
509 UnthrottledTimer<HTMLMediaElement> m_playbackProgressTimer; 500 UnthrottledTimer<HTMLMediaElement> m_playbackProgressTimer;
510 UnthrottledTimer<HTMLMediaElement> m_audioTracksTimer; 501 UnthrottledTimer<HTMLMediaElement> m_audioTracksTimer;
511 Member<TimeRanges> m_playedTimeRanges; 502 Member<TimeRanges> m_playedTimeRanges;
512 Member<GenericEventQueue> m_asyncEventQueue; 503 Member<GenericEventQueue> m_asyncEventQueue;
513 504
514 double m_playbackRate; 505 double m_playbackRate;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 662
672 class AutoplayHelperClientImpl; 663 class AutoplayHelperClientImpl;
673 664
674 friend class Internals; 665 friend class Internals;
675 friend class TrackDisplayUpdateScope; 666 friend class TrackDisplayUpdateScope;
676 friend class AutoplayExperimentHelper; 667 friend class AutoplayExperimentHelper;
677 friend class MediaControlsTest; 668 friend class MediaControlsTest;
678 669
679 Member<AutoplayExperimentHelper::Client> m_autoplayHelperClient; 670 Member<AutoplayExperimentHelper::Client> m_autoplayHelperClient;
680 Member<AutoplayExperimentHelper> m_autoplayHelper; 671 Member<AutoplayExperimentHelper> m_autoplayHelper;
672 Member<AutoplayUmaHelper> m_autoplayUmaHelper;
681 673
682 WebRemotePlaybackClient* m_remotePlaybackClient; 674 WebRemotePlaybackClient* m_remotePlaybackClient;
683 675
684 // class AutoplayVisibilityObserver; 676 // class AutoplayVisibilityObserver;
685 Member<ElementVisibilityObserver> m_autoplayVisibilityObserver; 677 Member<ElementVisibilityObserver> m_autoplayVisibilityObserver;
686 678
687 static URLRegistry* s_mediaStreamRegistry; 679 static URLRegistry* s_mediaStreamRegistry;
688 }; 680 };
689 681
690 inline bool isHTMLMediaElement(const HTMLElement& element) 682 inline bool isHTMLMediaElement(const HTMLElement& element)
691 { 683 {
692 return isHTMLAudioElement(element) || isHTMLVideoElement(element); 684 return isHTMLAudioElement(element) || isHTMLVideoElement(element);
693 } 685 }
694 686
695 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); 687 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
696 688
697 } // namespace blink 689 } // namespace blink
698 690
699 #endif // HTMLMediaElement_h 691 #endif // HTMLMediaElement_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/AutoplayUmaHelper.cpp ('k') | third_party/WebKit/Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698