Rename pref/settings for media autoplay scope to be Web Application Scope.

This is also removing a feature flag that is no longer needed.

Bug: 923910
Change-Id: I45dde867148e1eee92178bd398a356c6acdcbf24
Reviewed-on: https://chromium-review.googlesource.com/c/1425857
Commit-Queue: Mounir Lamouri <mlamouri@chromium.org>
Auto-Submit: Mounir Lamouri <mlamouri@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#625932}(cherry picked from commit 5fa01ee9445401038f074d8f39e8c0792fc694bb)
Reviewed-on: https://chromium-review.googlesource.com/c/1450403
Reviewed-by: Mounir Lamouri <mlamouri@chromium.org>
Cr-Commit-Position: refs/branch-heads/3683@{#131}
Cr-Branched-From: e51029943e0a38dd794b73caaf6373d5496ae783-refs/heads/master@{#625896}
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 0991654..81c2d0f 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -3191,11 +3191,7 @@
       web_prefs->embedded_media_experience_enabled =
           tab_android->ShouldEnableEmbeddedMediaExperience();
 
-      if (base::FeatureList::IsEnabled(
-              features::kAllowAutoplayUnmutedInWebappManifestScope)) {
-        web_prefs->media_playback_gesture_whitelist_scope =
-            tab_android->GetWebappManifestScope();
-      }
+      web_prefs->web_app_scope = tab_android->GetWebappManifestScope();
 
       web_prefs->picture_in_picture_enabled =
           tab_android->IsPictureInPictureEnabled();
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc
index 8edf7403..d330ffd 100644
--- a/chrome/common/chrome_features.cc
+++ b/chrome/common/chrome_features.cc
@@ -14,12 +14,6 @@
 
 // All features in alphabetical order.
 
-#if defined(OS_ANDROID)
-const base::Feature kAllowAutoplayUnmutedInWebappManifestScope{
-    "AllowAutoplayUnmutedInWebappManifestScope",
-    base::FEATURE_ENABLED_BY_DEFAULT};
-#endif  // defined(OS_ANDROID)
-
 #if defined(OS_MACOSX)
 // Enables the menu item for Javascript execution via AppleScript.
 const base::Feature kAppleScriptExecuteJavaScriptMenuItem{
diff --git a/chrome/common/chrome_features.h b/chrome/common/chrome_features.h
index 8efa069d..8919c3b 100644
--- a/chrome/common/chrome_features.h
+++ b/chrome/common/chrome_features.h
@@ -24,11 +24,6 @@
 // All features in alphabetical order. The features should be documented
 // alongside the definition of their values in the .cc file.
 
-#if defined(OS_ANDROID)
-COMPONENT_EXPORT(CHROME_FEATURES)
-extern const base::Feature kAllowAutoplayUnmutedInWebappManifestScope;
-#endif  // defined(OS_ANDROID)
-
 #if defined(OS_MACOSX)
 COMPONENT_EXPORT(CHROME_FEATURES)
 extern const base::Feature kAppleScriptExecuteJavaScriptMenuItem;
diff --git a/content/public/common/common_param_traits_macros.h b/content/public/common/common_param_traits_macros.h
index 242b062..72972fd 100644
--- a/content/public/common/common_param_traits_macros.h
+++ b/content/public/common/common_param_traits_macros.h
@@ -206,7 +206,7 @@
   IPC_STRUCT_TRAITS_MEMBER(device_scale_adjustment)
   IPC_STRUCT_TRAITS_MEMBER(force_enable_zoom)
   IPC_STRUCT_TRAITS_MEMBER(fullscreen_supported)
-  IPC_STRUCT_TRAITS_MEMBER(media_playback_gesture_whitelist_scope)
+  IPC_STRUCT_TRAITS_MEMBER(web_app_scope)
   IPC_STRUCT_TRAITS_MEMBER(default_video_poster_url)
   IPC_STRUCT_TRAITS_MEMBER(support_deprecated_target_density_dpi)
   IPC_STRUCT_TRAITS_MEMBER(use_legacy_background_size_shorthand_behavior)
diff --git a/content/public/common/web_preferences.h b/content/public/common/web_preferences.h
index 32cc528..579c086 100644
--- a/content/public/common/web_preferences.h
+++ b/content/public/common/web_preferences.h
@@ -231,7 +231,7 @@
   float device_scale_adjustment;
   bool force_enable_zoom;
   bool fullscreen_supported;
-  GURL media_playback_gesture_whitelist_scope;
+  GURL web_app_scope;
   GURL default_video_poster_url;
   bool support_deprecated_target_density_dpi;
   bool use_legacy_background_size_shorthand_behavior;
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 77b93bd..dd4a028 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -829,8 +829,7 @@
   settings->SetFullscreenSupported(prefs.fullscreen_supported);
   web_view->SetIgnoreViewportTagScaleLimits(prefs.force_enable_zoom);
   settings->SetAutoZoomFocusedNodeToLegibleScale(true);
-  settings->SetMediaPlaybackGestureWhitelistScope(blink::WebString::FromASCII(
-      prefs.media_playback_gesture_whitelist_scope.spec()));
+  settings->SetWebAppScope(WebString::FromASCII(prefs.web_app_scope.spec()));
   settings->SetDefaultVideoPosterURL(
       WebString::FromASCII(prefs.default_video_poster_url.spec()));
   settings->SetSupportDeprecatedTargetDensityDPI(
diff --git a/third_party/blink/public/web/web_settings.h b/third_party/blink/public/web/web_settings.h
index 777a62f3..2856333 100644
--- a/third_party/blink/public/web/web_settings.h
+++ b/third_party/blink/public/web/web_settings.h
@@ -185,7 +185,7 @@
   virtual void SetMaxTouchPoints(int) = 0;
   virtual void SetPictureInPictureEnabled(bool) = 0;
   virtual void SetDataSaverHoldbackWebApi(bool) = 0;
-  virtual void SetMediaPlaybackGestureWhitelistScope(const WebString&) = 0;
+  virtual void SetWebAppScope(const WebString&) = 0;
   virtual void SetPresentationRequiresUserGesture(bool) = 0;
   virtual void SetEmbeddedMediaExperienceEnabled(bool) = 0;
   virtual void SetImmersiveModeEnabled(bool) = 0;
diff --git a/third_party/blink/renderer/core/exported/web_settings_impl.cc b/third_party/blink/renderer/core/exported/web_settings_impl.cc
index 12d89ca..9eee26c 100644
--- a/third_party/blink/renderer/core/exported/web_settings_impl.cc
+++ b/third_party/blink/renderer/core/exported/web_settings_impl.cc
@@ -604,9 +604,8 @@
   settings_->SetDataSaverHoldbackWebApi(enabled);
 }
 
-void WebSettingsImpl::SetMediaPlaybackGestureWhitelistScope(
-    const WebString& scope) {
-  settings_->SetMediaPlaybackGestureWhitelistScope(scope);
+void WebSettingsImpl::SetWebAppScope(const WebString& scope) {
+  settings_->SetWebAppScope(scope);
 }
 
 void WebSettingsImpl::SetPresentationRequiresUserGesture(bool required) {
diff --git a/third_party/blink/renderer/core/exported/web_settings_impl.h b/third_party/blink/renderer/core/exported/web_settings_impl.h
index ea7a9fe..ebe2619 100644
--- a/third_party/blink/renderer/core/exported/web_settings_impl.h
+++ b/third_party/blink/renderer/core/exported/web_settings_impl.h
@@ -115,7 +115,7 @@
   void SetMaxTouchPoints(int) override;
   void SetPictureInPictureEnabled(bool) override;
   void SetDataSaverHoldbackWebApi(bool) override;
-  void SetMediaPlaybackGestureWhitelistScope(const WebString&) override;
+  void SetWebAppScope(const WebString&) override;
   void SetPresentationRequiresUserGesture(bool) override;
   void SetEmbeddedMediaExperienceEnabled(bool) override;
   void SetImmersiveModeEnabled(bool) override;
diff --git a/third_party/blink/renderer/core/frame/settings.json5 b/third_party/blink/renderer/core/frame/settings.json5
index 66057386..e6c29b1 100644
--- a/third_party/blink/renderer/core/frame/settings.json5
+++ b/third_party/blink/renderer/core/frame/settings.json5
@@ -225,7 +225,7 @@
     },
 
     {
-      name: "mediaPlaybackGestureWhitelistScope",
+      name: "webAppScope",
       type: "String",
     },
 
diff --git a/third_party/blink/renderer/core/html/media/autoplay_policy.cc b/third_party/blink/renderer/core/html/media/autoplay_policy.cc
index 5778a5a9..ac0f420 100644
--- a/third_party/blink/renderer/core/html/media/autoplay_policy.cc
+++ b/third_party/blink/renderer/core/html/media/autoplay_policy.cc
@@ -49,13 +49,12 @@
 bool IsDocumentWhitelisted(const Document& document) {
   DCHECK(document.GetSettings());
 
-  const String& whitelist_scope =
-      document.GetSettings()->GetMediaPlaybackGestureWhitelistScope();
-  if (whitelist_scope.IsNull() || whitelist_scope.IsEmpty())
+  const String& web_app_scope = document.GetSettings()->GetWebAppScope();
+  if (web_app_scope.IsNull() || web_app_scope.IsEmpty())
     return false;
 
-  DCHECK_EQ(KURL(whitelist_scope).GetString(), whitelist_scope);
-  return document.Url().GetString().StartsWith(whitelist_scope);
+  DCHECK_EQ(KURL(web_app_scope).GetString(), web_app_scope);
+  return document.Url().GetString().StartsWith(web_app_scope);
 }
 
 // Return true if and only if the document settings specifies media playback
diff --git a/third_party/blink/web_tests/media/autoplay-non-whitelisted-scope.html b/third_party/blink/web_tests/media/autoplay-non-whitelisted-scope.html
index 689c9c6..4dfdfdd 100644
--- a/third_party/blink/web_tests/media/autoplay-non-whitelisted-scope.html
+++ b/third_party/blink/web_tests/media/autoplay-non-whitelisted-scope.html
@@ -13,7 +13,7 @@
 }, "Prerequisites to running the rest of the tests");
 
 internals.settings.setAutoplayPolicy('user-gesture-required');
-internals.settings.setMediaPlaybackGestureWhitelistScope(
+internals.settings.setWebAppScope(
     document.URL.substring(0, document.URL.lastIndexOf('/') + 1) + "foo/");
 
 testRunner.setAutoplayAllowed(true);
diff --git a/third_party/blink/web_tests/media/autoplay-whitelisted-scope.html b/third_party/blink/web_tests/media/autoplay-whitelisted-scope.html
index 492cbf6..250a5d4 100644
--- a/third_party/blink/web_tests/media/autoplay-whitelisted-scope.html
+++ b/third_party/blink/web_tests/media/autoplay-whitelisted-scope.html
@@ -13,7 +13,7 @@
 }, "Prerequisites to running the rest of the tests");
 
 internals.settings.setAutoplayPolicy('user-gesture-required');
-internals.settings.setMediaPlaybackGestureWhitelistScope(
+internals.settings.setWebAppScope(
     document.URL.substring(0, document.URL.lastIndexOf('/') + 1)
     );