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

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

Issue 144663006: Remove the user gesture restriction for HTMLMediaElement::load() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: keep removeBehaviorsRestrictionsAfterFirstUserGesture() Created 6 years, 10 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 | Annotate | Revision Log
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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 DisplayMode displayMode() const { return m_displayMode; } 293 DisplayMode displayMode() const { return m_displayMode; }
294 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; } 294 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; }
295 295
296 virtual bool isMediaElement() const OVERRIDE FINAL { return true; } 296 virtual bool isMediaElement() const OVERRIDE FINAL { return true; }
297 297
298 void setControllerInternal(PassRefPtr<MediaController>); 298 void setControllerInternal(PassRefPtr<MediaController>);
299 299
300 // Restrictions to change default behaviors. 300 // Restrictions to change default behaviors.
301 enum BehaviorRestrictionFlags { 301 enum BehaviorRestrictionFlags {
302 NoRestrictions = 0, 302 NoRestrictions = 0,
303 RequireUserGestureForLoadRestriction = 1 << 0, 303 RequireUserGestureForPlayRestriction = 1 << 0,
304 RequireUserGestureForPlayRestriction = 1 << 1, 304 RequireUserGestureForFullscreenRestriction = 1 << 1,
305 RequireUserGestureForFullscreenRestriction = 1 << 2, 305 RequirePageConsentToLoadMediaRestriction = 1 << 2,
306 RequirePageConsentToLoadMediaRestriction = 1 << 3,
307 }; 306 };
308 typedef unsigned BehaviorRestrictions; 307 typedef unsigned BehaviorRestrictions;
309 308
310 bool userGestureRequiredForLoad() const { return m_restrictions & RequireUse rGestureForLoadRestriction; }
311 bool userGestureRequiredForPlay() const { return m_restrictions & RequireUse rGestureForPlayRestriction; } 309 bool userGestureRequiredForPlay() const { return m_restrictions & RequireUse rGestureForPlayRestriction; }
312 bool userGestureRequiredForFullscreen() const { return m_restrictions & Requ ireUserGestureForFullscreenRestriction; } 310 bool userGestureRequiredForFullscreen() const { return m_restrictions & Requ ireUserGestureForFullscreenRestriction; }
313 bool pageConsentRequiredForLoad() const { return m_restrictions & RequirePag eConsentToLoadMediaRestriction; } 311 bool pageConsentRequiredForLoad() const { return m_restrictions & RequirePag eConsentToLoadMediaRestriction; }
314 312
315 void addBehaviorRestriction(BehaviorRestrictions restriction) { m_restrictio ns |= restriction; } 313 void addBehaviorRestriction(BehaviorRestrictions restriction) { m_restrictio ns |= restriction; }
316 void removeBehaviorRestriction(BehaviorRestrictions restriction) { m_restric tions &= ~restriction; } 314 void removeBehaviorRestriction(BehaviorRestrictions restriction) { m_restric tions &= ~restriction; }
317 315
318 bool ignoreTrackDisplayUpdateRequests() const { return m_ignoreTrackDisplayU pdate > 0; } 316 bool ignoreTrackDisplayUpdateRequests() const { return m_ignoreTrackDisplayU pdate > 0; }
319 void beginIgnoringTrackDisplayUpdateRequests(); 317 void beginIgnoringTrackDisplayUpdateRequests();
320 void endIgnoringTrackDisplayUpdateRequests(); 318 void endIgnoringTrackDisplayUpdateRequests();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 374
377 void seek(double time, ExceptionState&); 375 void seek(double time, ExceptionState&);
378 void finishSeek(); 376 void finishSeek();
379 void checkIfSeekNeeded(); 377 void checkIfSeekNeeded();
380 void addPlayedRange(double start, double end); 378 void addPlayedRange(double start, double end);
381 379
382 void scheduleTimeupdateEvent(bool periodicEvent); 380 void scheduleTimeupdateEvent(bool periodicEvent);
383 void scheduleEvent(const AtomicString& eventName); 381 void scheduleEvent(const AtomicString& eventName);
384 382
385 // loading 383 // loading
384 void prepareForLoad();
385 void loadInternal();
386 void selectMediaResource(); 386 void selectMediaResource();
387 void loadResource(const KURL&, ContentType&, const String& keySystem); 387 void loadResource(const KURL&, ContentType&, const String& keySystem);
388 void scheduleNextSourceChild(); 388 void scheduleNextSourceChild();
389 void loadNextSourceChild(); 389 void loadNextSourceChild();
390 void userCancelledLoad(); 390 void userCancelledLoad();
391 void clearMediaPlayer(int flags); 391 void clearMediaPlayer(int flags);
392 void clearMediaPlayerAndAudioSourceProviderClient(); 392 void clearMediaPlayerAndAudioSourceProviderClient();
393 bool havePotentialSourceChild(); 393 bool havePotentialSourceChild();
394 void noneSupported(); 394 void noneSupported();
395 void mediaEngineError(PassRefPtr<MediaError> err); 395 void mediaEngineError(PassRefPtr<MediaError> err);
396 void cancelPendingEventsAndCallbacks(); 396 void cancelPendingEventsAndCallbacks();
397 void waitForSourceChange(); 397 void waitForSourceChange();
398 void prepareToPlay(); 398 void prepareToPlay();
399 399
400 KURL selectNextSourceChild(ContentType*, String* keySystem, InvalidURLAction ); 400 KURL selectNextSourceChild(ContentType*, String* keySystem, InvalidURLAction );
401 401
402 void mediaLoadingFailed(MediaPlayer::NetworkState); 402 void mediaLoadingFailed(MediaPlayer::NetworkState);
403 403
404 void updateActiveTextTrackCues(double); 404 void updateActiveTextTrackCues(double);
405 HTMLTrackElement* showingTrackWithSameKind(HTMLTrackElement*) const; 405 HTMLTrackElement* showingTrackWithSameKind(HTMLTrackElement*) const;
406 406
407 void markCaptionAndSubtitleTracksAsUnconfigured(); 407 void markCaptionAndSubtitleTracksAsUnconfigured();
408 408
409 // These "internal" functions do not check user gesture restrictions. 409 // This does not check user gesture restrictions.
410 void loadInternal();
411 void playInternal(); 410 void playInternal();
412 411
413 void prepareForLoad();
414 void allowVideoRendering(); 412 void allowVideoRendering();
415 413
416 void updateVolume(); 414 void updateVolume();
417 void updatePlayState(); 415 void updatePlayState();
418 bool potentiallyPlaying() const; 416 bool potentiallyPlaying() const;
419 bool endedPlayback() const; 417 bool endedPlayback() const;
420 bool stoppedDueToErrors() const; 418 bool stoppedDueToErrors() const;
421 bool pausedForUserInteraction() const; 419 bool pausedForUserInteraction() const;
422 bool couldPlayIfEnoughData() const; 420 bool couldPlayIfEnoughData() const;
423 421
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 // data has not been loaded since sending a "stalled" event 531 // data has not been loaded since sending a "stalled" event
534 bool m_sentStalledEvent : 1; 532 bool m_sentStalledEvent : 1;
535 533
536 // time has not changed since sending an "ended" event 534 // time has not changed since sending an "ended" event
537 bool m_sentEndEvent : 1; 535 bool m_sentEndEvent : 1;
538 536
539 bool m_pausedInternal : 1; 537 bool m_pausedInternal : 1;
540 538
541 bool m_closedCaptionsVisible : 1; 539 bool m_closedCaptionsVisible : 1;
542 540
543 bool m_loadInitiatedByUserGesture : 1;
544 bool m_completelyLoaded : 1; 541 bool m_completelyLoaded : 1;
545 bool m_havePreparedToPlay : 1; 542 bool m_havePreparedToPlay : 1;
546 543
547 bool m_tracksAreReady : 1; 544 bool m_tracksAreReady : 1;
548 bool m_haveVisibleTextTrack : 1; 545 bool m_haveVisibleTextTrack : 1;
549 bool m_processingPreferenceChange : 1; 546 bool m_processingPreferenceChange : 1;
550 double m_lastTextTrackUpdateTime; 547 double m_lastTextTrackUpdateTime;
551 548
552 RefPtr<TextTrackList> m_textTracks; 549 RefPtr<TextTrackList> m_textTracks;
553 Vector<RefPtr<TextTrack> > m_textTracksWhenResourceSelectionBegan; 550 Vector<RefPtr<TextTrack> > m_textTracksWhenResourceSelectionBegan;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 inline bool isHTMLMediaElement(const Node& node) 595 inline bool isHTMLMediaElement(const Node& node)
599 { 596 {
600 return node.isElementNode() && toElement(node).isMediaElement(); 597 return node.isElementNode() && toElement(node).isMediaElement();
601 } 598 }
602 599
603 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); 600 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
604 601
605 } //namespace 602 } //namespace
606 603
607 #endif 604 #endif
OLDNEW
« no previous file with comments | « LayoutTests/media/video-load-require-user-gesture-expected.txt ('k') | Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698