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

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

Issue 1329853004: Include viewport visibility checks for autoplay experiment. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@autoplay_step1
Patch Set: Created 5 years, 3 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 void scheduleEvent(PassRefPtrWillBeRawPtr<Event>); 257 void scheduleEvent(PassRefPtrWillBeRawPtr<Event>);
258 void scheduleTimeupdateEvent(bool periodicEvent); 258 void scheduleTimeupdateEvent(bool periodicEvent);
259 259
260 // Returns the "effective media volume" value as specified in the HTML5 spec . 260 // Returns the "effective media volume" value as specified in the HTML5 spec .
261 double effectiveMediaVolume() const; 261 double effectiveMediaVolume() const;
262 262
263 // Predicates also used when dispatching wrapper creation (cf. [SpecialWrapF or] IDL attribute usage.) 263 // Predicates also used when dispatching wrapper creation (cf. [SpecialWrapF or] IDL attribute usage.)
264 virtual bool isHTMLAudioElement() const { return false; } 264 virtual bool isHTMLAudioElement() const { return false; }
265 virtual bool isHTMLVideoElement() const { return false; } 265 virtual bool isHTMLVideoElement() const { return false; }
266 266
267 // Temporary callback for crbug.com/487345,402044
268 void notifyPositionMayHaveChanged();
269
267 protected: 270 protected:
268 HTMLMediaElement(const QualifiedName&, Document&); 271 HTMLMediaElement(const QualifiedName&, Document&);
269 ~HTMLMediaElement() override; 272 ~HTMLMediaElement() override;
270 #if ENABLE(OILPAN) 273 #if ENABLE(OILPAN)
271 void dispose(); 274 void dispose();
272 #endif 275 #endif
273 276
274 void parseAttribute(const QualifiedName&, const AtomicString&) override; 277 void parseAttribute(const QualifiedName&, const AtomicString&) override;
275 void finishParsingChildren() final; 278 void finishParsingChildren() final;
276 bool isURLAttribute(const Attribute&) const override; 279 bool isURLAttribute(const Attribute&) const override;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 void selectInitialTracksIfNecessary(); 457 void selectInitialTracksIfNecessary();
455 458
456 // Return true if and only if we require a user gesture before letting 459 // Return true if and only if we require a user gesture before letting
457 // the media play. 460 // the media play.
458 bool isUserGestureRequiredForPlay() const; 461 bool isUserGestureRequiredForPlay() const;
459 void removeUserGestureRequirement(); 462 void removeUserGestureRequirement();
460 void setInitialPlayWithoutUserGestures(bool); 463 void setInitialPlayWithoutUserGestures(bool);
461 464
462 void audioTracksTimerFired(Timer<HTMLMediaElement>*); 465 void audioTracksTimerFired(Timer<HTMLMediaElement>*);
463 466
467 // For tests.
468 void triggerAutoplayViewportCheck();
469
464 Timer<HTMLMediaElement> m_loadTimer; 470 Timer<HTMLMediaElement> m_loadTimer;
465 Timer<HTMLMediaElement> m_progressEventTimer; 471 Timer<HTMLMediaElement> m_progressEventTimer;
466 Timer<HTMLMediaElement> m_playbackProgressTimer; 472 Timer<HTMLMediaElement> m_playbackProgressTimer;
467 Timer<HTMLMediaElement> m_audioTracksTimer; 473 Timer<HTMLMediaElement> m_audioTracksTimer;
468 PersistentWillBeMember<TimeRanges> m_playedTimeRanges; 474 PersistentWillBeMember<TimeRanges> m_playedTimeRanges;
469 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; 475 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue;
470 476
471 double m_playbackRate; 477 double m_playbackRate;
472 double m_defaultPlaybackRate; 478 double m_defaultPlaybackRate;
473 NetworkState m_networkState; 479 NetworkState m_networkState;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 inline bool isHTMLMediaElement(const HTMLElement& element) 649 inline bool isHTMLMediaElement(const HTMLElement& element)
644 { 650 {
645 return isHTMLAudioElement(element) || isHTMLVideoElement(element); 651 return isHTMLAudioElement(element) || isHTMLVideoElement(element);
646 } 652 }
647 653
648 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); 654 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
649 655
650 } // namespace blink 656 } // namespace blink
651 657
652 #endif // HTMLMediaElement_h 658 #endif // HTMLMediaElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698