 Chromium Code Reviews
 Chromium Code Reviews Issue 2837023002:
  Create autoplay policy flag and merge cross-origin autoplay blocking into it.  (Closed)
    
  
    Issue 2837023002:
  Create autoplay policy flag and merge cross-origin autoplay blocking into it.  (Closed) 
  | OLD | NEW | 
|---|---|
| 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 432 | 432 | 
| 433 prefs.use_solid_color_scrollbars = false; | 433 prefs.use_solid_color_scrollbars = false; | 
| 434 | 434 | 
| 435 prefs.history_entry_requires_user_gesture = | 435 prefs.history_entry_requires_user_gesture = | 
| 436 command_line.HasSwitch(switches::kHistoryEntryRequiresUserGesture); | 436 command_line.HasSwitch(switches::kHistoryEntryRequiresUserGesture); | 
| 437 | 437 | 
| 438 #if defined(OS_ANDROID) | 438 #if defined(OS_ANDROID) | 
| 439 // On Android, user gestures are normally required, unless that requirement | 439 // On Android, user gestures are normally required, unless that requirement | 
| 440 // is disabled with a command-line switch or the equivalent field trial is | 440 // is disabled with a command-line switch or the equivalent field trial is | 
| 441 // is set to "Enabled". | 441 // is set to "Enabled". | 
| 442 prefs.user_gesture_required_for_media_playback = !command_line.HasSwitch( | 442 prefs.user_gesture_required_for_media_playback = | 
| 443 switches::kDisableGestureRequirementForMediaPlayback); | 443 !command_line.HasSwitch( | 
| 444 switches::kDisableGestureRequirementForMediaPlayback) || | |
| 445 command_line.GetSwitchValueASCII(switches::kAutoplayPolicy) == | |
| 
whywhat
2017/04/24 18:06:24
shouldn't this be != ?
or rather == kAutoplayPolic
 
mlamouri (slow - plz ping)
2017/04/24 18:41:23
Oups, yes :)
 | |
| 446 switches::autoplay::kNoRestrictionPolicy; | |
| 444 | 447 | 
| 445 prefs.progress_bar_completion = GetProgressBarCompletionPolicy(); | 448 prefs.progress_bar_completion = GetProgressBarCompletionPolicy(); | 
| 446 | 449 | 
| 447 prefs.use_solid_color_scrollbars = true; | 450 prefs.use_solid_color_scrollbars = true; | 
| 448 #else // defined(OS_ANDROID) | 451 #else // defined(OS_ANDROID) | 
| 449 prefs.cross_origin_media_playback_requires_user_gesture = | 452 prefs.cross_origin_media_playback_requires_user_gesture = | 
| 450 base::FeatureList::GetInstance()->IsEnabled( | 453 command_line.GetSwitchValueASCII(switches::kAutoplayPolicy) == | 
| 451 features::kCrossOriginMediaPlaybackRequiresUserGesture); | 454 switches::autoplay::kCrossOriginUserGestureRequiredPolicy; | 
| 452 #endif // defined(OS_ANDROID) | 455 #endif // defined(OS_ANDROID) | 
| 453 | 456 | 
| 454 const std::string touch_enabled_switch = | 457 const std::string touch_enabled_switch = | 
| 455 command_line.HasSwitch(switches::kTouchEventFeatureDetection) | 458 command_line.HasSwitch(switches::kTouchEventFeatureDetection) | 
| 456 ? command_line.GetSwitchValueASCII( | 459 ? command_line.GetSwitchValueASCII( | 
| 457 switches::kTouchEventFeatureDetection) | 460 switches::kTouchEventFeatureDetection) | 
| 458 : switches::kTouchEventFeatureDetectionAuto; | 461 : switches::kTouchEventFeatureDetectionAuto; | 
| 459 prefs.touch_event_feature_detection_enabled = | 462 prefs.touch_event_feature_detection_enabled = | 
| 460 (touch_enabled_switch == switches::kTouchEventFeatureDetectionAuto) | 463 (touch_enabled_switch == switches::kTouchEventFeatureDetectionAuto) | 
| 461 ? (ui::GetTouchScreensAvailability() == | 464 ? (ui::GetTouchScreensAvailability() == | 
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 953 } | 956 } | 
| 954 | 957 | 
| 955 void RenderViewHostImpl::ClosePageTimeout() { | 958 void RenderViewHostImpl::ClosePageTimeout() { | 
| 956 if (delegate_->ShouldIgnoreUnresponsiveRenderer()) | 959 if (delegate_->ShouldIgnoreUnresponsiveRenderer()) | 
| 957 return; | 960 return; | 
| 958 | 961 | 
| 959 ClosePageIgnoringUnloadEvents(); | 962 ClosePageIgnoringUnloadEvents(); | 
| 960 } | 963 } | 
| 961 | 964 | 
| 962 } // namespace content | 965 } // namespace content | 
| OLD | NEW |