From 0d9de7deaf30848be304379f5227996adf5a62fb Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Wed, 9 Jan 2019 12:13:49 -0800 Subject: [PATCH] blink::WebReferrerPolicy -> network::mojom::ReferrerPolicy https://chromium-review.googlesource.com/c/chromium/src/+/1212345 --- atom/browser/api/atom_api_web_contents.cc | 5 ++- .../native_mate_converters/blink_converter.cc | 43 ++++++++++--------- .../native_mate_converters/blink_converter.h | 6 +-- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 4fe1091f466..3b2d75f4357 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -1188,8 +1188,9 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) { if (!options.Get("httpReferrer", ¶ms.referrer)) { GURL http_referrer; if (options.Get("httpReferrer", &http_referrer)) - params.referrer = content::Referrer(http_referrer.GetAsReferrer(), - blink::kWebReferrerPolicyDefault); + params.referrer = + content::Referrer(http_referrer.GetAsReferrer(), + network::mojom::ReferrerPolicy::kDefault); } std::string user_agent; diff --git a/atom/common/native_mate_converters/blink_converter.cc b/atom/common/native_mate_converters/blink_converter.cc index 17469bac61b..5bee5df33f5 100644 --- a/atom/common/native_mate_converters/blink_converter.cc +++ b/atom/common/native_mate_converters/blink_converter.cc @@ -473,25 +473,26 @@ v8::Local Converter::ToV8( } // static -v8::Local Converter::ToV8( +v8::Local Converter::ToV8( v8::Isolate* isolate, - const blink::WebReferrerPolicy& in) { + const network::mojom::ReferrerPolicy& in) { switch (in) { - case blink::kWebReferrerPolicyDefault: + case network::mojom::ReferrerPolicy::kDefault: return mate::StringToV8(isolate, "default"); - case blink::kWebReferrerPolicyAlways: + case network::mojom::ReferrerPolicy::kAlways: return mate::StringToV8(isolate, "unsafe-url"); - case blink::kWebReferrerPolicyNoReferrerWhenDowngrade: + case network::mojom::ReferrerPolicy::kNoReferrerWhenDowngrade: return mate::StringToV8(isolate, "no-referrer-when-downgrade"); - case blink::kWebReferrerPolicyNever: + case network::mojom::ReferrerPolicy::kNever: return mate::StringToV8(isolate, "no-referrer"); - case blink::kWebReferrerPolicyOrigin: + case network::mojom::ReferrerPolicy::kOrigin: return mate::StringToV8(isolate, "origin"); - case blink::kWebReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin: + case network::mojom::ReferrerPolicy:: + kNoReferrerWhenDowngradeOriginWhenCrossOrigin: return mate::StringToV8(isolate, "strict-origin-when-cross-origin"); - case blink::kWebReferrerPolicySameOrigin: + case network::mojom::ReferrerPolicy::kSameOrigin: return mate::StringToV8(isolate, "same-origin"); - case blink::kWebReferrerPolicyStrictOrigin: + case network::mojom::ReferrerPolicy::kStrictOrigin: return mate::StringToV8(isolate, "strict-origin"); default: return mate::StringToV8(isolate, "no-referrer"); @@ -499,28 +500,28 @@ v8::Local Converter::ToV8( } // static -bool Converter::FromV8( +bool Converter::FromV8( v8::Isolate* isolate, v8::Handle val, - blink::WebReferrerPolicy* out) { + network::mojom::ReferrerPolicy* out) { std::string policy = base::ToLowerASCII(gin::V8ToString(isolate, val)); if (policy == "default") - *out = blink::kWebReferrerPolicyDefault; + *out = network::mojom::ReferrerPolicy::kDefault; else if (policy == "unsafe-url") - *out = blink::kWebReferrerPolicyAlways; + *out = network::mojom::ReferrerPolicy::kAlways; else if (policy == "no-referrer-when-downgrade") - *out = blink::kWebReferrerPolicyNoReferrerWhenDowngrade; + *out = network::mojom::ReferrerPolicy::kNoReferrerWhenDowngrade; else if (policy == "no-referrer") - *out = blink::kWebReferrerPolicyNever; + *out = network::mojom::ReferrerPolicy::kNever; else if (policy == "origin") - *out = blink::kWebReferrerPolicyOrigin; + *out = network::mojom::ReferrerPolicy::kOrigin; else if (policy == "strict-origin-when-cross-origin") - *out = - blink::kWebReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin; + *out = network::mojom::ReferrerPolicy:: + kNoReferrerWhenDowngradeOriginWhenCrossOrigin; else if (policy == "same-origin") - *out = blink::kWebReferrerPolicySameOrigin; + *out = network::mojom::ReferrerPolicy::kSameOrigin; else if (policy == "strict-origin") - *out = blink::kWebReferrerPolicyStrictOrigin; + *out = network::mojom::ReferrerPolicy::kStrictOrigin; else return false; return true; diff --git a/atom/common/native_mate_converters/blink_converter.h b/atom/common/native_mate_converters/blink_converter.h index bc00089414e..ad31a7a7cb4 100644 --- a/atom/common/native_mate_converters/blink_converter.h +++ b/atom/common/native_mate_converters/blink_converter.h @@ -123,12 +123,12 @@ struct Converter { }; template <> -struct Converter { +struct Converter { static v8::Local ToV8(v8::Isolate* isolate, - const blink::WebReferrerPolicy& in); + const network::mojom::ReferrerPolicy& in); static bool FromV8(v8::Isolate* isolate, v8::Local val, - blink::WebReferrerPolicy* out); + network::mojom::ReferrerPolicy* out); }; v8::Local EditFlagsToV8(v8::Isolate* isolate, int editFlags);