namespace {
+typedef blink::WebDocument::WebContentSecurityPolicyHeaderType SecurityPolicyHeaderType;
+
+COMPILE_ASSERT(
+ int(SecurityPolicyHeaderType::WebContentSecurityPolicyHeaderTypeReport) ==
+ int(tizen_webview::TW_CSP_REPORT_ONLY), mismatching_enums);
+COMPILE_ASSERT(
+ int(SecurityPolicyHeaderType::WebContentSecurityPolicyHeaderTypeEnforce) ==
+ int(tizen_webview::TW_CSP_ENFORCE_POLICY), mismatching_enums);
+
+SecurityPolicyHeaderType ToSecurityPolicyHeaderType(
+ tizen_webview::ContentSecurityPolicyType type) {
+ return static_cast<SecurityPolicyHeaderType>(type);
+}
+
bool GetGRBAValuesFromString(const std::string& input, int* r, int* g, int* b, int* a)
{
bool parsing_status = false;
tizen_webview::ContentSecurityPolicyType type = TW_CSP_DEFAULT_POLICY;
Send(new EwkHostMsg_GetContentSecurityPolicy(render_view()->GetRoutingID(), &policy, &type));
-#if !defined(EWK_BRINGUP)
// Since, Webkit supports some more types and we cast ewk type to Webkit type.
// We allow only ewk types.
- if (type == TW_CSP_REPORT_ONLY || type == TW_CSP_ENFORCE_POLICY)
- frame->document().setContentSecurityPolicyUsingHeader(blink::WebString::fromUTF8(policy), type);
-#endif
+ if (type == TW_CSP_REPORT_ONLY || type == TW_CSP_ENFORCE_POLICY) {
+ frame->document().setContentSecurityPolicyUsingHeader(
+ blink::WebString::fromUTF8(policy), ToSecurityPolicyHeaderType(type));
+ }
}
void RenderViewObserverEfl::OnSetContentSecurityPolicy(const std::string& policy, tizen_webview::ContentSecurityPolicyType header_type)
{
-#if !defined(EWK_BRINGUP)
blink::WebView* view = render_view()->GetWebView();
DCHECK(view);
blink::WebDocument document = view->mainFrame()->document();
- document.setContentSecurityPolicyUsingHeader(blink::WebString::fromUTF8(policy), header_type);
-#endif
+ document.setContentSecurityPolicyUsingHeader(blink::WebString::fromUTF8(policy),
+ ToSecurityPolicyHeaderType(header_type));
}
void RenderViewObserverEfl::OnScale(double scale_factor, int x, int y)
}
void WebContentsDelegateEfl::SetContentSecurityPolicy(const std::string& policy, tizen_webview::ContentSecurityPolicyType header_type) {
- // Might makes sense as it only uses existing functionality already exposed for javascript. Needs extra api at blink side.
- // Not necessary for eflwebview bringup.
-#if !defined(EWK_BRINGUP)
if (document_created_) {
RenderViewHost* rvh = web_contents_.GetRenderViewHost();
rvh->Send(new EwkViewMsg_SetCSP(rvh->GetRoutingID(), policy, header_type));
DCHECK(!pending_content_security_policy_.get());
pending_content_security_policy_.reset(new ContentSecurityPolicy(policy, header_type));
}
-#endif
}
void WebContentsDelegateEfl::ShowPopupMenu(RenderFrameHost* render_frame_host,