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

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

Issue 2524443002: Adding Rappor metrics for disabling cross-origin autoplay with sound experiment (Closed)
Patch Set: new implementation 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 return m_audioSourceProvider; 282 return m_audioSourceProvider;
283 } 283 }
284 284
285 enum InvalidURLAction { DoNothing, Complain }; 285 enum InvalidURLAction { DoNothing, Complain };
286 bool isSafeToLoadURL(const KURL&, InvalidURLAction); 286 bool isSafeToLoadURL(const KURL&, InvalidURLAction);
287 287
288 // Checks to see if current media data is CORS-same-origin as the 288 // Checks to see if current media data is CORS-same-origin as the
289 // specified origin. 289 // specified origin.
290 bool isMediaDataCORSSameOrigin(SecurityOrigin*) const; 290 bool isMediaDataCORSSameOrigin(SecurityOrigin*) const;
291 291
292 // Returns this media element is in a cross-origin frame.
293 bool isCrossOrigin() const;
whywhat 2016/11/29 21:42:04 nit: add frame to the name? it could be cross-orig
Zhiqiang Zhang (Slow) 2016/11/30 17:30:52 s/isCrossOrigin/isInCrossOriginFrame
294
292 void scheduleEvent(Event*); 295 void scheduleEvent(Event*);
293 void scheduleTimeupdateEvent(bool periodicEvent); 296 void scheduleTimeupdateEvent(bool periodicEvent);
294 297
295 // Returns the "effective media volume" value as specified in the HTML5 spec. 298 // Returns the "effective media volume" value as specified in the HTML5 spec.
296 double effectiveMediaVolume() const; 299 double effectiveMediaVolume() const;
297 300
298 // Predicates also used when dispatching wrapper creation (cf. 301 // Predicates also used when dispatching wrapper creation (cf.
299 // [SpecialWrapFor] IDL attribute usage.) 302 // [SpecialWrapFor] IDL attribute usage.)
300 virtual bool isHTMLAudioElement() const { return false; } 303 virtual bool isHTMLAudioElement() const { return false; }
301 virtual bool isHTMLVideoElement() const { return false; } 304 virtual bool isHTMLVideoElement() const { return false; }
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 // TODO(zqzhang): move this to anonymous namespace when AutoplayExperiment is 514 // TODO(zqzhang): move this to anonymous namespace when AutoplayExperiment is
512 // removed. See https://crbug.com/666370 515 // removed. See https://crbug.com/666370
513 bool computeLockedPendingUserGesture(Document&) const; 516 bool computeLockedPendingUserGesture(Document&) const;
514 517
515 // Return true if and only if a user gesture is required to unlock this 518 // Return true if and only if a user gesture is required to unlock this
516 // media element for unrestricted autoplay / script control. Don't confuse 519 // media element for unrestricted autoplay / script control. Don't confuse
517 // this with isGestureNeededForPlayback(). The latter is usually what one 520 // this with isGestureNeededForPlayback(). The latter is usually what one
518 // should use, if checking to see if an action is allowed. 521 // should use, if checking to see if an action is allowed.
519 bool isLockedPendingUserGesture() const; 522 bool isLockedPendingUserGesture() const;
520 523
524 bool isLockedPendingUserGestureIfCrossOriginExperimentEnabled() const;
whywhat 2016/11/29 21:42:05 can't this be part of the method above instead? it
Zhiqiang Zhang (Slow) 2016/11/30 17:30:52 Please see the other reply.
525
521 // If the user gesture is required, then this will remove it. Note that 526 // If the user gesture is required, then this will remove it. Note that
522 // one should not generally call this method directly; use the one on 527 // one should not generally call this method directly; use the one on
523 // m_helper and give it a reason. 528 // m_helper and give it a reason.
524 void unlockUserGesture(); 529 void unlockUserGesture();
525 530
526 // Return true if and only if a user gesture is requried for playback. Even 531 // Return true if and only if a user gesture is requried for playback. Even
527 // if isLockedPendingUserGesture() return true, this might return false if 532 // if isLockedPendingUserGesture() return true, this might return false if
528 // the requirement is currently overridden. This does not check if a user 533 // the requirement is currently overridden. This does not check if a user
529 // gesture is currently being processed. 534 // gesture is currently being processed.
530 bool isGestureNeededForPlayback() const; 535 bool isGestureNeededForPlayback() const;
531 536
537 bool isGestureNeededForPlaybackIfCrossOriginExperimentEnabled() const;
whywhat 2016/11/29 21:42:05 ditto
538
532 // Return true if and only if the settings allow autoplay of media on this 539 // Return true if and only if the settings allow autoplay of media on this
533 // frame. 540 // frame.
534 bool isAutoplayAllowedPerSettings() const; 541 bool isAutoplayAllowedPerSettings() const;
535 542
536 void setNetworkState(NetworkState); 543 void setNetworkState(NetworkState);
537 544
538 void audioTracksTimerFired(TimerBase*); 545 void audioTracksTimerFired(TimerBase*);
539 546
540 // TODO(liberato): remove once autoplay gesture override experiment concludes. 547 // TODO(liberato): remove once autoplay gesture override experiment concludes.
541 void triggerAutoplayViewportCheckForTesting(); 548 void triggerAutoplayViewportCheckForTesting();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 mutable double m_officialPlaybackPosition; 633 mutable double m_officialPlaybackPosition;
627 mutable bool m_officialPlaybackPositionNeedsUpdate; 634 mutable bool m_officialPlaybackPositionNeedsUpdate;
628 635
629 double m_fragmentEndTime; 636 double m_fragmentEndTime;
630 637
631 typedef unsigned PendingActionFlags; 638 typedef unsigned PendingActionFlags;
632 PendingActionFlags m_pendingActionFlags; 639 PendingActionFlags m_pendingActionFlags;
633 640
634 // FIXME: HTMLMediaElement has way too many state bits. 641 // FIXME: HTMLMediaElement has way too many state bits.
635 bool m_lockedPendingUserGesture : 1; 642 bool m_lockedPendingUserGesture : 1;
643 bool m_lockedPendingUserGestureIfCrossOriginExperimentEnabled : 1;
636 bool m_playing : 1; 644 bool m_playing : 1;
637 bool m_shouldDelayLoadEvent : 1; 645 bool m_shouldDelayLoadEvent : 1;
638 bool m_haveFiredLoadedData : 1; 646 bool m_haveFiredLoadedData : 1;
639 bool m_autoplaying : 1; 647 bool m_autoplaying : 1;
640 bool m_muted : 1; 648 bool m_muted : 1;
641 bool m_paused : 1; 649 bool m_paused : 1;
642 bool m_seeking : 1; 650 bool m_seeking : 1;
643 651
644 // data has not been loaded since sending a "stalled" event 652 // data has not been loaded since sending a "stalled" event
645 bool m_sentStalledEvent : 1; 653 bool m_sentStalledEvent : 1;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 752
745 inline bool isHTMLMediaElement(const HTMLElement& element) { 753 inline bool isHTMLMediaElement(const HTMLElement& element) {
746 return isHTMLAudioElement(element) || isHTMLVideoElement(element); 754 return isHTMLAudioElement(element) || isHTMLVideoElement(element);
747 } 755 }
748 756
749 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); 757 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
750 758
751 } // namespace blink 759 } // namespace blink
752 760
753 #endif // HTMLMediaElement_h 761 #endif // HTMLMediaElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698