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

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

Issue 1850903002: Enable user gesture requirement for autoplay experiment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased. Created 4 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/core/html/AutoplayExperimentHelper.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 , m_playPromiseRejectTask(CancellableTaskFactory::create(this, &HTMLMediaEle ment::rejectPlayPromises)) 434 , m_playPromiseRejectTask(CancellableTaskFactory::create(this, &HTMLMediaEle ment::rejectPlayPromises))
435 , m_audioSourceNode(nullptr) 435 , m_audioSourceNode(nullptr)
436 , m_autoplayHelperClient(AutoplayHelperClientImpl::create(this)) 436 , m_autoplayHelperClient(AutoplayHelperClientImpl::create(this))
437 , m_autoplayHelper(AutoplayExperimentHelper::create(m_autoplayHelperClient.g et())) 437 , m_autoplayHelper(AutoplayExperimentHelper::create(m_autoplayHelperClient.g et()))
438 , m_remotePlaybackClient(nullptr) 438 , m_remotePlaybackClient(nullptr)
439 { 439 {
440 ThreadState::current()->registerPreFinalizer(this); 440 ThreadState::current()->registerPreFinalizer(this);
441 441
442 WTF_LOG(Media, "HTMLMediaElement::HTMLMediaElement(%p)", this); 442 WTF_LOG(Media, "HTMLMediaElement::HTMLMediaElement(%p)", this);
443 443
444 if (document.settings() && document.settings()->mediaPlaybackRequiresUserGes ture()) 444 // If any experiment is enabled, then we want to enable a user gesture by
445 // default, otherwise the experiment does nothing.
446 if ((document.settings() && document.settings()->mediaPlaybackRequiresUserGe sture())
447 || m_autoplayHelper->isExperimentEnabled()) {
445 m_userGestureRequiredForPlay = true; 448 m_userGestureRequiredForPlay = true;
449 }
446 450
447 setHasCustomStyleCallbacks(); 451 setHasCustomStyleCallbacks();
448 addElementToDocumentMap(this, &document); 452 addElementToDocumentMap(this, &document);
449 453
450 UseCounter::count(document, UseCounter::HTMLMediaElement); 454 UseCounter::count(document, UseCounter::HTMLMediaElement);
451 } 455 }
452 456
453 HTMLMediaElement::~HTMLMediaElement() 457 HTMLMediaElement::~HTMLMediaElement()
454 { 458 {
455 WTF_LOG(Media, "HTMLMediaElement::~HTMLMediaElement(%p)", this); 459 WTF_LOG(Media, "HTMLMediaElement::~HTMLMediaElement(%p)", this);
(...skipping 3394 matching lines...) Expand 10 before | Expand all | Expand 10 after
3850 3854
3851 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst 3855 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst
3852 { 3856 {
3853 IntRect result; 3857 IntRect result;
3854 if (LayoutObject* object = m_element->layoutObject()) 3858 if (LayoutObject* object = m_element->layoutObject())
3855 result = object->absoluteBoundingBoxRect(); 3859 result = object->absoluteBoundingBoxRect();
3856 return result; 3860 return result;
3857 } 3861 }
3858 3862
3859 } // namespace blink 3863 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/AutoplayExperimentHelper.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698