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

Side by Side Diff: content/browser/renderer_host/render_view_host_impl.cc

Issue 2846623003: Make autoplay policies no longer platform dependant. (Closed)
Patch Set: bauerb review comments 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 | « chrome/browser/flag_descriptions.cc ('k') | content/child/runtime_features.cc » ('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/browser/renderer_host/render_view_host_impl.h" 5 #include "content/browser/renderer_host/render_view_host_impl.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 430
431 prefs.inert_visual_viewport = 431 prefs.inert_visual_viewport =
432 command_line.HasSwitch(switches::kInertVisualViewport); 432 command_line.HasSwitch(switches::kInertVisualViewport);
433 433
434 prefs.use_solid_color_scrollbars = false; 434 prefs.use_solid_color_scrollbars = false;
435 435
436 prefs.history_entry_requires_user_gesture = 436 prefs.history_entry_requires_user_gesture =
437 command_line.HasSwitch(switches::kHistoryEntryRequiresUserGesture); 437 command_line.HasSwitch(switches::kHistoryEntryRequiresUserGesture);
438 438
439 #if defined(OS_ANDROID) 439 #if defined(OS_ANDROID)
440 // On Android, user gestures are normally required, unless that requirement
441 // is disabled with a command-line switch or the equivalent field trial is
442 // is set to "Enabled".
443 prefs.user_gesture_required_for_media_playback =
444 !command_line.HasSwitch(switches::kIgnoreAutoplayRestrictionsForTests) &&
445 command_line.GetSwitchValueASCII(switches::kAutoplayPolicy) !=
446 switches::autoplay::kNoUserGestureRequiredPolicy;
447
448 prefs.progress_bar_completion = GetProgressBarCompletionPolicy(); 440 prefs.progress_bar_completion = GetProgressBarCompletionPolicy();
449 441
450 prefs.use_solid_color_scrollbars = true; 442 prefs.use_solid_color_scrollbars = true;
451 #else // defined(OS_ANDROID)
452 prefs.cross_origin_media_playback_requires_user_gesture =
453 command_line.GetSwitchValueASCII(switches::kAutoplayPolicy) ==
454 switches::autoplay::kCrossOriginUserGestureRequiredPolicy;
455 #endif // defined(OS_ANDROID) 443 #endif // defined(OS_ANDROID)
456 444
445 std::string autoplay_policy = media::GetEffectiveAutoplayPolicy(command_line);
446 if (autoplay_policy == switches::autoplay::kNoUserGestureRequiredPolicy) {
447 prefs.autoplay_policy = AutoplayPolicy::kNoUserGestureRequired;
448 } else if (autoplay_policy ==
449 switches::autoplay::kUserGestureRequiredPolicy) {
450 prefs.autoplay_policy = AutoplayPolicy::kUserGestureRequired;
451 } else if (autoplay_policy ==
452 switches::autoplay::kUserGestureRequiredForCrossOriginPolicy) {
453 prefs.autoplay_policy = AutoplayPolicy::kUserGestureRequiredForCrossOrigin;
454 }
455
457 const std::string touch_enabled_switch = 456 const std::string touch_enabled_switch =
458 command_line.HasSwitch(switches::kTouchEventFeatureDetection) 457 command_line.HasSwitch(switches::kTouchEventFeatureDetection)
459 ? command_line.GetSwitchValueASCII( 458 ? command_line.GetSwitchValueASCII(
460 switches::kTouchEventFeatureDetection) 459 switches::kTouchEventFeatureDetection)
461 : switches::kTouchEventFeatureDetectionAuto; 460 : switches::kTouchEventFeatureDetectionAuto;
462 prefs.touch_event_feature_detection_enabled = 461 prefs.touch_event_feature_detection_enabled =
463 (touch_enabled_switch == switches::kTouchEventFeatureDetectionAuto) 462 (touch_enabled_switch == switches::kTouchEventFeatureDetectionAuto)
464 ? (ui::GetTouchScreensAvailability() == 463 ? (ui::GetTouchScreensAvailability() ==
465 ui::TouchScreensAvailability::ENABLED) 464 ui::TouchScreensAvailability::ENABLED)
466 : (touch_enabled_switch.empty() || 465 : (touch_enabled_switch.empty() ||
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 } 958 }
960 959
961 void RenderViewHostImpl::ClosePageTimeout() { 960 void RenderViewHostImpl::ClosePageTimeout() {
962 if (delegate_->ShouldIgnoreUnresponsiveRenderer()) 961 if (delegate_->ShouldIgnoreUnresponsiveRenderer())
963 return; 962 return;
964 963
965 ClosePageIgnoringUnloadEvents(); 964 ClosePageIgnoringUnloadEvents();
966 } 965 }
967 966
968 } // namespace content 967 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/flag_descriptions.cc ('k') | content/child/runtime_features.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698