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

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

Issue 2850553002: Autoplay: use an autoplay policy setting in Blink. (Closed)
Patch Set: rebase Created 3 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 | « no previous file | third_party/WebKit/LayoutTests/http/tests/media/resources/autoplay-crossorigin-iframe.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 WebRuntimeFeatures::EnableVideoRotateToFullscreen( 1043 WebRuntimeFeatures::EnableVideoRotateToFullscreen(
1044 prefs.video_rotate_to_fullscreen_enabled); 1044 prefs.video_rotate_to_fullscreen_enabled);
1045 WebRuntimeFeatures::EnableVideoFullscreenDetection( 1045 WebRuntimeFeatures::EnableVideoFullscreenDetection(
1046 prefs.video_fullscreen_detection_enabled); 1046 prefs.video_fullscreen_detection_enabled);
1047 settings->SetEmbeddedMediaExperienceEnabled( 1047 settings->SetEmbeddedMediaExperienceEnabled(
1048 prefs.embedded_media_experience_enabled); 1048 prefs.embedded_media_experience_enabled);
1049 settings->SetDoNotUpdateSelectionOnMutatingSelectionRange( 1049 settings->SetDoNotUpdateSelectionOnMutatingSelectionRange(
1050 prefs.do_not_update_selection_on_mutating_selection_range); 1050 prefs.do_not_update_selection_on_mutating_selection_range);
1051 #endif // defined(OS_ANDROID) 1051 #endif // defined(OS_ANDROID)
1052 1052
1053 // TODO(mlamouri): use an AutoplayPolicy in WebSettings.
1054 switch (prefs.autoplay_policy) { 1053 switch (prefs.autoplay_policy) {
1055 case AutoplayPolicy::kNoUserGestureRequired: 1054 case AutoplayPolicy::kNoUserGestureRequired:
1056 settings->SetMediaPlaybackRequiresUserGesture(false); 1055 settings->SetAutoplayPolicy(
1057 settings->SetCrossOriginMediaPlaybackRequiresUserGesture(false); 1056 WebSettings::AutoplayPolicy::kNoUserGestureRequired);
1058 break; 1057 break;
1059 case AutoplayPolicy::kUserGestureRequired: 1058 case AutoplayPolicy::kUserGestureRequired:
1060 settings->SetMediaPlaybackRequiresUserGesture(true); 1059 settings->SetAutoplayPolicy(
1061 settings->SetCrossOriginMediaPlaybackRequiresUserGesture(false); 1060 WebSettings::AutoplayPolicy::kUserGestureRequired);
1062 break; 1061 break;
1063 case AutoplayPolicy::kUserGestureRequiredForCrossOrigin: 1062 case AutoplayPolicy::kUserGestureRequiredForCrossOrigin:
1064 settings->SetMediaPlaybackRequiresUserGesture(false); 1063 settings->SetAutoplayPolicy(
1065 settings->SetCrossOriginMediaPlaybackRequiresUserGesture(true); 1064 WebSettings::AutoplayPolicy::kUserGestureRequiredForCrossOrigin);
1066 break; 1065 break;
1067 } 1066 }
1068 1067
1069 settings->SetViewportEnabled(prefs.viewport_enabled); 1068 settings->SetViewportEnabled(prefs.viewport_enabled);
1070 settings->SetViewportMetaEnabled(prefs.viewport_meta_enabled); 1069 settings->SetViewportMetaEnabled(prefs.viewport_meta_enabled);
1071 settings->SetShrinksViewportContentToFit( 1070 settings->SetShrinksViewportContentToFit(
1072 prefs.shrinks_viewport_contents_to_fit); 1071 prefs.shrinks_viewport_contents_to_fit);
1073 settings->SetViewportStyle( 1072 settings->SetViewportStyle(
1074 static_cast<blink::WebViewportStyle>(prefs.viewport_style)); 1073 static_cast<blink::WebViewportStyle>(prefs.viewport_style));
1075 1074
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
2671 input_event.GetCoalescedEventsPointers(), latency_info, 2670 input_event.GetCoalescedEventsPointers(), latency_info,
2672 dispatch_type); 2671 dispatch_type);
2673 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; 2672 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
2674 } 2673 }
2675 idle_user_detector_->ActivityDetected(); 2674 idle_user_detector_->ActivityDetected();
2676 return RenderWidget::HandleInputEvent(input_event, latency_info, 2675 return RenderWidget::HandleInputEvent(input_event, latency_info,
2677 dispatch_type); 2676 dispatch_type);
2678 } 2677 }
2679 2678
2680 } // namespace content 2679 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/media/resources/autoplay-crossorigin-iframe.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698