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

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

Issue 2510353004: Deprecating AutoplayExperimentHelper (Closed)
Patch Set: rebased Created 4 years 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 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 16 matching lines...) Expand all
27 #ifndef HTMLMediaElement_h 27 #ifndef HTMLMediaElement_h
28 #define HTMLMediaElement_h 28 #define HTMLMediaElement_h
29 29
30 #include "bindings/core/v8/ActiveScriptWrappable.h" 30 #include "bindings/core/v8/ActiveScriptWrappable.h"
31 #include "bindings/core/v8/ScriptPromise.h" 31 #include "bindings/core/v8/ScriptPromise.h"
32 #include "bindings/core/v8/TraceWrapperMember.h" 32 #include "bindings/core/v8/TraceWrapperMember.h"
33 #include "core/CoreExport.h" 33 #include "core/CoreExport.h"
34 #include "core/dom/ActiveDOMObject.h" 34 #include "core/dom/ActiveDOMObject.h"
35 #include "core/dom/ExceptionCode.h" 35 #include "core/dom/ExceptionCode.h"
36 #include "core/events/GenericEventQueue.h" 36 #include "core/events/GenericEventQueue.h"
37 #include "core/html/AutoplayExperimentHelper.h"
38 #include "core/html/HTMLElement.h" 37 #include "core/html/HTMLElement.h"
39 #include "core/html/track/TextTrack.h" 38 #include "core/html/track/TextTrack.h"
40 #include "platform/MIMETypeRegistry.h" 39 #include "platform/MIMETypeRegistry.h"
41 #include "platform/Supplementable.h" 40 #include "platform/Supplementable.h"
42 #include "platform/WebTaskRunner.h" 41 #include "platform/WebTaskRunner.h"
43 #include "platform/audio/AudioSourceProvider.h" 42 #include "platform/audio/AudioSourceProvider.h"
44 #include "public/platform/WebAudioSourceProviderClient.h" 43 #include "public/platform/WebAudioSourceProviderClient.h"
45 #include "public/platform/WebMediaPlayerClient.h" 44 #include "public/platform/WebMediaPlayerClient.h"
46 #include <memory> 45 #include <memory>
47 46
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 bool paused() const; 165 bool paused() const;
167 double defaultPlaybackRate() const; 166 double defaultPlaybackRate() const;
168 void setDefaultPlaybackRate(double); 167 void setDefaultPlaybackRate(double);
169 double playbackRate() const; 168 double playbackRate() const;
170 void setPlaybackRate(double); 169 void setPlaybackRate(double);
171 void updatePlaybackRate(); 170 void updatePlaybackRate();
172 TimeRanges* played(); 171 TimeRanges* played();
173 TimeRanges* seekable() const; 172 TimeRanges* seekable() const;
174 bool ended() const; 173 bool ended() const;
175 bool autoplay() const; 174 bool autoplay() const;
176 bool shouldAutoplay( 175 bool shouldAutoplay();
177 const RecordMetricsBehavior = RecordMetricsBehavior::DoNotRecord);
178 bool loop() const; 176 bool loop() const;
179 void setLoop(bool); 177 void setLoop(bool);
180 ScriptPromise playForBindings(ScriptState*); 178 ScriptPromise playForBindings(ScriptState*);
181 Nullable<ExceptionCode> play(); 179 Nullable<ExceptionCode> play();
182 void pause(); 180 void pause();
183 void requestRemotePlayback(); 181 void requestRemotePlayback();
184 void requestRemotePlaybackControl(); 182 void requestRemotePlaybackControl();
185 void requestRemotePlaybackStop(); 183 void requestRemotePlaybackStop();
186 184
187 // statistics 185 // statistics
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 // Returns the "effective media volume" value as specified in the HTML5 spec. 295 // Returns the "effective media volume" value as specified in the HTML5 spec.
298 double effectiveMediaVolume() const; 296 double effectiveMediaVolume() const;
299 297
300 // Predicates also used when dispatching wrapper creation (cf. 298 // Predicates also used when dispatching wrapper creation (cf.
301 // [SpecialWrapFor] IDL attribute usage.) 299 // [SpecialWrapFor] IDL attribute usage.)
302 virtual bool isHTMLAudioElement() const { return false; } 300 virtual bool isHTMLAudioElement() const { return false; }
303 virtual bool isHTMLVideoElement() const { return false; } 301 virtual bool isHTMLVideoElement() const { return false; }
304 302
305 void videoWillBeDrawnToCanvas() const; 303 void videoWillBeDrawnToCanvas() const;
306 304
307 // Temporary callback for crbug.com/487345,402044
308 void notifyPositionMayHaveChanged(const IntRect&);
309 void updatePositionNotificationRegistration();
310
311 WebRemotePlaybackClient* remotePlaybackClient() { 305 WebRemotePlaybackClient* remotePlaybackClient() {
312 return m_remotePlaybackClient; 306 return m_remotePlaybackClient;
313 } 307 }
314 const WebRemotePlaybackClient* remotePlaybackClient() const { 308 const WebRemotePlaybackClient* remotePlaybackClient() const {
315 return m_remotePlaybackClient; 309 return m_remotePlaybackClient;
316 } 310 }
317 311
318 protected: 312 protected:
319 HTMLMediaElement(const QualifiedName&, Document&); 313 HTMLMediaElement(const QualifiedName&, Document&);
320 ~HTMLMediaElement() override; 314 ~HTMLMediaElement() override;
321 void dispose(); 315 void dispose();
322 316
323 void parseAttribute(const QualifiedName&, 317 void parseAttribute(const QualifiedName&,
324 const AtomicString&, 318 const AtomicString&,
325 const AtomicString&) override; 319 const AtomicString&) override;
326 void finishParsingChildren() final; 320 void finishParsingChildren() final;
327 bool isURLAttribute(const Attribute&) const override; 321 bool isURLAttribute(const Attribute&) const override;
328 void attachLayoutTree(const AttachContext& = AttachContext()) override; 322 void attachLayoutTree(const AttachContext& = AttachContext()) override;
329 323
330 void didMoveToNewDocument(Document& oldDocument) override; 324 void didMoveToNewDocument(Document& oldDocument) override;
331 virtual KURL posterImageURL() const { return KURL(); } 325 virtual KURL posterImageURL() const { return KURL(); }
332 326
333 enum DisplayMode { Unknown, Poster, Video }; 327 enum DisplayMode { Unknown, Poster, Video };
334 DisplayMode getDisplayMode() const { return m_displayMode; } 328 DisplayMode getDisplayMode() const { return m_displayMode; }
335 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; } 329 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; }
336 330
337 void recordAutoplayMetric(AutoplayMetrics);
338
339 private: 331 private:
340 void resetMediaPlayerAndMediaSource(); 332 void resetMediaPlayerAndMediaSource();
341 333
342 bool alwaysCreateUserAgentShadowRoot() const final { return true; } 334 bool alwaysCreateUserAgentShadowRoot() const final { return true; }
343 bool areAuthorShadowsAllowed() const final { return false; } 335 bool areAuthorShadowsAllowed() const final { return false; }
344 336
345 bool supportsFocus() const final; 337 bool supportsFocus() const final;
346 bool isMouseFocusable() const final; 338 bool isMouseFocusable() const final;
347 bool layoutObjectIsNeeded(const ComputedStyle&) override; 339 bool layoutObjectIsNeeded(const ComputedStyle&) override;
348 LayoutObject* createLayoutObject(const ComputedStyle&) override; 340 LayoutObject* createLayoutObject(const ComputedStyle&) override;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 bool isGestureNeededForPlayback() const; 517 bool isGestureNeededForPlayback() const;
526 518
527 // Return true if and only if the settings allow autoplay of media on this 519 // Return true if and only if the settings allow autoplay of media on this
528 // frame. 520 // frame.
529 bool isAutoplayAllowedPerSettings() const; 521 bool isAutoplayAllowedPerSettings() const;
530 522
531 void setNetworkState(NetworkState); 523 void setNetworkState(NetworkState);
532 524
533 void audioTracksTimerFired(TimerBase*); 525 void audioTracksTimerFired(TimerBase*);
534 526
535 // TODO(liberato): remove once autoplay gesture override experiment concludes.
536 void triggerAutoplayViewportCheckForTesting();
537
538 void scheduleResolvePlayPromises(); 527 void scheduleResolvePlayPromises();
539 void scheduleRejectPlayPromises(ExceptionCode); 528 void scheduleRejectPlayPromises(ExceptionCode);
540 void scheduleNotifyPlaying(); 529 void scheduleNotifyPlaying();
541 void resolveScheduledPlayPromises(); 530 void resolveScheduledPlayPromises();
542 void rejectScheduledPlayPromises(); 531 void rejectScheduledPlayPromises();
543 void rejectPlayPromises(ExceptionCode, const String&); 532 void rejectPlayPromises(ExceptionCode, const String&);
544 void rejectPlayPromisesInternal(ExceptionCode, const String&); 533 void rejectPlayPromisesInternal(ExceptionCode, const String&);
545 534
546 EnumerationHistogram& showControlsHistogram() const; 535 EnumerationHistogram& showControlsHistogram() const;
547 536
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 DECLARE_TRACE(); 699 DECLARE_TRACE();
711 700
712 private: 701 private:
713 WebAudioSourceProvider* m_webAudioSourceProvider; 702 WebAudioSourceProvider* m_webAudioSourceProvider;
714 Member<AudioClientImpl> m_client; 703 Member<AudioClientImpl> m_client;
715 Mutex provideInputLock; 704 Mutex provideInputLock;
716 }; 705 };
717 706
718 AudioSourceProviderImpl m_audioSourceProvider; 707 AudioSourceProviderImpl m_audioSourceProvider;
719 708
720 class AutoplayHelperClientImpl;
721
722 friend class AutoplayUmaHelper; // for isAutoplayAllowedPerSettings 709 friend class AutoplayUmaHelper; // for isAutoplayAllowedPerSettings
723 friend class AutoplayUmaHelperTest; 710 friend class AutoplayUmaHelperTest;
724 friend class Internals; 711 friend class Internals;
725 friend class TrackDisplayUpdateScope; 712 friend class TrackDisplayUpdateScope;
726 friend class AutoplayExperimentHelper;
727 friend class MediaControlsTest; 713 friend class MediaControlsTest;
728 friend class HTMLVideoElementTest; 714 friend class HTMLVideoElementTest;
729 715
730 Member<AutoplayExperimentHelper::Client> m_autoplayHelperClient;
731 Member<AutoplayExperimentHelper> m_autoplayHelper;
732 Member<AutoplayUmaHelper> m_autoplayUmaHelper; 716 Member<AutoplayUmaHelper> m_autoplayUmaHelper;
733 717
734 WebRemotePlaybackClient* m_remotePlaybackClient; 718 WebRemotePlaybackClient* m_remotePlaybackClient;
735 719
736 // class AutoplayVisibilityObserver; 720 // class AutoplayVisibilityObserver;
737 Member<ElementVisibilityObserver> m_autoplayVisibilityObserver; 721 Member<ElementVisibilityObserver> m_autoplayVisibilityObserver;
738 722
739 static URLRegistry* s_mediaStreamRegistry; 723 static URLRegistry* s_mediaStreamRegistry;
740 }; 724 };
741 725
742 inline bool isHTMLMediaElement(const HTMLElement& element) { 726 inline bool isHTMLMediaElement(const HTMLElement& element) {
743 return isHTMLAudioElement(element) || isHTMLVideoElement(element); 727 return isHTMLAudioElement(element) || isHTMLVideoElement(element);
744 } 728 }
745 729
746 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); 730 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
747 731
748 } // namespace blink 732 } // namespace blink
749 733
750 #endif // HTMLMediaElement_h 734 #endif // HTMLMediaElement_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/BUILD.gn ('k') | third_party/WebKit/Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698