Move content::WebPreferences struct to Blink
As the first step to convert ViewMsg_UpdateWebPreferences,
we need to move WebPreferences from //content to
//third_party/blink because the IPC message passes WebPreferences
struct.
So, this CL moves WebPreferences to
//third_party/blink/public/common/web_preferences as
a pre-work.
Additionally, this CL wraps all enums and WebPreferences
with web_pref namespace to avoid duplicating the existing
enum types in bliink.
AX-Relnotes: N/A
Bug: 1097943
Change-Id: I35b3dbd45a8bc4bc36a55d7f185d3247fd0b1714
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2397670
Commit-Queue: Gyuyoung Kim <[email protected]>
Reviewed-by: Dave Tapuska <[email protected]>
Reviewed-by: Andrey Kosyakov <[email protected]>
Reviewed-by: Matthew Jones <[email protected]>
Reviewed-by: Elly Fong-Jones <[email protected]>
Reviewed-by: Fabrice de Gans-Riberi <[email protected]>
Reviewed-by: Sean Topping <[email protected]>
Reviewed-by: Kentaro Hara <[email protected]>
Reviewed-by: Bo <[email protected]>
Reviewed-by: Kinuko Yasuda <[email protected]>
Cr-Commit-Position: refs/heads/master@{#806042}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 88d4426..bfb76eb0 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -150,7 +150,6 @@
#include "content/public/common/result_codes.h"
#include "content/public/common/url_utils.h"
#include "content/public/common/use_zoom_for_dsf_policy.h"
-#include "content/public/common/web_preferences.h"
#include "media/base/media_switches.h"
#include "media/base/user_input_monitor.h"
#include "net/base/url_util.h"
@@ -168,6 +167,7 @@
#include "third_party/blink/public/common/mime_util/mime_util.h"
#include "third_party/blink/public/common/page/page_zoom.h"
#include "third_party/blink/public/common/security/security_style.h"
+#include "third_party/blink/public/common/web_preferences/web_preferences.h"
#include "third_party/blink/public/mojom/frame/frame.mojom.h"
#include "third_party/blink/public/mojom/frame/fullscreen.mojom.h"
#include "third_party/blink/public/mojom/loader/pause_subresource_loading_handle.mojom.h"
@@ -2383,10 +2383,10 @@
});
}
-const WebPreferences WebContentsImpl::ComputeWebPreferences() {
+const blink::web_pref::WebPreferences WebContentsImpl::ComputeWebPreferences() {
OPTIONAL_TRACE_EVENT0("browser", "WebContentsImpl::ComputeWebPreferences");
- WebPreferences prefs;
+ blink::web_pref::WebPreferences prefs;
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
@@ -2441,13 +2441,16 @@
std::string autoplay_policy = media::GetEffectiveAutoplayPolicy(command_line);
if (autoplay_policy == switches::autoplay::kNoUserGestureRequiredPolicy) {
- prefs.autoplay_policy = AutoplayPolicy::kNoUserGestureRequired;
+ prefs.autoplay_policy =
+ blink::web_pref::AutoplayPolicy::kNoUserGestureRequired;
} else if (autoplay_policy ==
switches::autoplay::kUserGestureRequiredPolicy) {
- prefs.autoplay_policy = AutoplayPolicy::kUserGestureRequired;
+ prefs.autoplay_policy =
+ blink::web_pref::AutoplayPolicy::kUserGestureRequired;
} else if (autoplay_policy ==
switches::autoplay::kDocumentUserActivationRequiredPolicy) {
- prefs.autoplay_policy = AutoplayPolicy::kDocumentUserActivationRequired;
+ prefs.autoplay_policy =
+ blink::web_pref::AutoplayPolicy::kDocumentUserActivationRequired;
} else {
NOTREACHED();
}
@@ -2535,7 +2538,7 @@
void WebContentsImpl::SetSlowWebPreferences(
const base::CommandLine& command_line,
- WebPreferences* prefs) {
+ blink::web_pref::WebPreferences* prefs) {
OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::SetSlowWebPreferences");
if (web_preferences_.get()) {
@@ -5742,7 +5745,8 @@
});
}
-const WebPreferences& WebContentsImpl::GetOrCreateWebPreferences() {
+const blink::web_pref::WebPreferences&
+WebContentsImpl::GetOrCreateWebPreferences() {
OPTIONAL_TRACE_EVENT0("content",
"WebContentsImpl::GetOrCreateWebPreferences");
// Compute WebPreferences based on the current state if it's null.
@@ -5755,9 +5759,10 @@
return web_preferences_.get();
}
-void WebContentsImpl::SetWebPreferences(const WebPreferences& prefs) {
+void WebContentsImpl::SetWebPreferences(
+ const blink::web_pref::WebPreferences& prefs) {
OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::SetWebPreferences");
- web_preferences_ = std::make_unique<WebPreferences>(prefs);
+ web_preferences_ = std::make_unique<blink::web_pref::WebPreferences>(prefs);
// Get all the RenderViewHosts (except the ones for currently back-forward
// cached pages), and make them send the current WebPreferences
// to the renderer. WebPreferences updates for back-forward cached pages will