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

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

Issue 1920863005: Disable autoplay experiments if the autoplay content settings is set to block. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@autoplay-ifsameorigin-ormuted
Patch Set: split autoplay experiment tests 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
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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 PageVisibilityState pageVisibilityState() const override; 317 PageVisibilityState pageVisibilityState() const override;
318 String autoplayExperimentMode() const override; 318 String autoplayExperimentMode() const override;
319 319
320 // Frame 320 // Frame
321 bool isCrossOrigin() const override 321 bool isCrossOrigin() const override
322 { 322 {
323 const Frame* frame = m_element->document().frame(); 323 const Frame* frame = m_element->document().frame();
324 return frame && frame->isCrossOrigin(); 324 return frame && frame->isCrossOrigin();
325 } 325 }
326 326
327 bool isAutoplayAllowedPerSettings() const override;
328
327 // LayoutObject 329 // LayoutObject
328 void setRequestPositionUpdates(bool) override; 330 void setRequestPositionUpdates(bool) override;
329 IntRect absoluteBoundingBoxRect() const override; 331 IntRect absoluteBoundingBoxRect() const override;
330 332
331 DEFINE_INLINE_VIRTUAL_TRACE() 333 DEFINE_INLINE_VIRTUAL_TRACE()
332 { 334 {
333 visitor->trace(m_element); 335 visitor->trace(m_element);
334 Client::trace(visitor); 336 Client::trace(visitor);
335 } 337 }
336 338
(...skipping 3496 matching lines...) Expand 10 before | Expand all | Expand 10 after
3833 3835
3834 String HTMLMediaElement::AutoplayHelperClientImpl::autoplayExperimentMode() cons t 3836 String HTMLMediaElement::AutoplayHelperClientImpl::autoplayExperimentMode() cons t
3835 { 3837 {
3836 String mode; 3838 String mode;
3837 if (m_element->document().settings()) 3839 if (m_element->document().settings())
3838 mode = m_element->document().settings()->autoplayExperimentMode(); 3840 mode = m_element->document().settings()->autoplayExperimentMode();
3839 3841
3840 return mode; 3842 return mode;
3841 } 3843 }
3842 3844
3845 bool HTMLMediaElement::AutoplayHelperClientImpl::isAutoplayAllowedPerSettings() const
3846 {
3847 LocalFrame* frame = m_element->document().frame();
3848 if (!frame)
3849 return false;
3850 FrameLoaderClient* frameLoaderClient = frame->loader().client();
3851 return frameLoaderClient && frameLoaderClient->allowAutoplay(false);
3852 }
3853
3843 void HTMLMediaElement::AutoplayHelperClientImpl::setRequestPositionUpdates(bool request) 3854 void HTMLMediaElement::AutoplayHelperClientImpl::setRequestPositionUpdates(bool request)
3844 { 3855 {
3845 if (LayoutObject* layoutObject = m_element->layoutObject()) { 3856 if (LayoutObject* layoutObject = m_element->layoutObject()) {
3846 LayoutMediaItem layoutMediaItem = LayoutMediaItem(toLayoutMedia(layoutOb ject)); 3857 LayoutMediaItem layoutMediaItem = LayoutMediaItem(toLayoutMedia(layoutOb ject));
3847 layoutMediaItem.setRequestPositionUpdates(request); 3858 layoutMediaItem.setRequestPositionUpdates(request);
3848 } 3859 }
3849 } 3860 }
3850 3861
3851 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst 3862 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst
3852 { 3863 {
3853 IntRect result; 3864 IntRect result;
3854 if (LayoutObject* object = m_element->layoutObject()) 3865 if (LayoutObject* object = m_element->layoutObject())
3855 result = object->absoluteBoundingBoxRect(); 3866 result = object->absoluteBoundingBoxRect();
3856 return result; 3867 return result;
3857 } 3868 }
3858 3869
3859 } // namespace blink 3870 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698