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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 2496593002: Adding an experimental flag to block autoplay with sound in cross-origin iframes (Closed)
Patch Set: falling back to adding a boolean flag Created 4 years, 1 month 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 1021
1022 // Force preload=none and disable autoplay on older or low end Android 1022 // Force preload=none and disable autoplay on older or low end Android
1023 // platforms because their media pipelines are not stable enough to handle 1023 // platforms because their media pipelines are not stable enough to handle
1024 // concurrent elements. See http://crbug.com/612909, http://crbug.com/622826. 1024 // concurrent elements. See http://crbug.com/612909, http://crbug.com/622826.
1025 const bool is_low_end_device = 1025 const bool is_low_end_device =
1026 base::android::BuildInfo::GetInstance()->sdk_int() <= 1026 base::android::BuildInfo::GetInstance()->sdk_int() <=
1027 base::android::SDK_VERSION_JELLY_BEAN_MR2 || 1027 base::android::SDK_VERSION_JELLY_BEAN_MR2 ||
1028 base::SysInfo::IsLowEndDevice(); 1028 base::SysInfo::IsLowEndDevice();
1029 // TODO(mlamouri): rename this setting "isLowEndDevice". 1029 // TODO(mlamouri): rename this setting "isLowEndDevice".
1030 settings->setForcePreloadNoneForMediaElements(is_low_end_device); 1030 settings->setForcePreloadNoneForMediaElements(is_low_end_device);
1031 #endif 1031 #else // defined(OS_ANDROID)
1032 settings->setCrossOriginMediaPlaybackRequiresUserGesture(
1033 prefs.cross_origin_media_playback_requires_user_gesture);
1034 #endif // defined(OS_ANDROID)
1032 1035
1033 settings->setAutoplayExperimentMode( 1036 settings->setAutoplayExperimentMode(
1034 blink::WebString::fromUTF8(prefs.autoplay_experiment_mode)); 1037 blink::WebString::fromUTF8(prefs.autoplay_experiment_mode));
1035 1038
1036 settings->setViewportEnabled(prefs.viewport_enabled); 1039 settings->setViewportEnabled(prefs.viewport_enabled);
1037 settings->setViewportMetaEnabled(prefs.viewport_meta_enabled); 1040 settings->setViewportMetaEnabled(prefs.viewport_meta_enabled);
1038 settings->setShrinksViewportContentToFit( 1041 settings->setShrinksViewportContentToFit(
1039 prefs.shrinks_viewport_contents_to_fit); 1042 prefs.shrinks_viewport_contents_to_fit);
1040 settings->setViewportStyle( 1043 settings->setViewportStyle(
1041 static_cast<blink::WebViewportStyle>(prefs.viewport_style)); 1044 static_cast<blink::WebViewportStyle>(prefs.viewport_style));
(...skipping 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after
2777 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 2780 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
2778 } 2781 }
2779 2782
2780 std::unique_ptr<InputEventAck> ack( 2783 std::unique_ptr<InputEventAck> ack(
2781 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type, 2784 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type,
2782 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); 2785 INPUT_EVENT_ACK_STATE_NOT_CONSUMED));
2783 OnInputEventAck(std::move(ack)); 2786 OnInputEventAck(std::move(ack));
2784 } 2787 }
2785 2788
2786 } // namespace content 2789 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698