UpdateBrowserControlsState(cc.mojom.BrowserControlsState constraints,
cc.mojom.BrowserControlsState current,
bool animate);
+
+ // Applies CSP policies set from ewk api or wrt config.xml.
+ [EnableIf=is_efl]
+ SetContentSecurityPolicyUsingHeader(
+ string policy,
+ network.mojom.ContentSecurityPolicyType header_type,
+ url.mojom.Url base_url);
};
// Implemented in Browser, this interface defines local-main-frame-specific
// the Agent that is assigned for the ExecutionContext. Changing
// an ExecutionContext's agent in the middle of an object lifecycle
// is not permitted.
+#if BUILDFLAG(IS_TIZEN)
+ GetSecurityContext().SetSandboxFlags(mask);
+#endif
// Since Workers and Worklets don't share agents (each one is unique)
// we allow them to apply new sandbox flags on top of the current ones.
GetPage()->GetVisualViewport().SetScale(scale_factor);
}
+#if BUILDFLAG(IS_EFL)
+void LocalFrame::SetContentSecurityPolicyUsingHeader(
+ const String& policy,
+ network::mojom::ContentSecurityPolicyType header_type,
+ const KURL& base_url) {
+ ExecutionContext* context = GetDocument()->GetExecutionContext();
+ if (!context)
+ return;
+
+ context->GetContentSecurityPolicy()->AddPolicies(ParseContentSecurityPolicies(
+ policy, header_type,
+ network::mojom::blink::ContentSecurityPolicySource::kHTTP, base_url));
+}
+#endif
+
void LocalFrame::ClosePageForTesting() {
mojo_handler_->ClosePageForTesting();
}
class SingleThreadTaskRunner;
}
+#if BUILDFLAG(IS_EFL)
+namespace network {
+namespace mojom {
+enum class ContentSecurityPolicyType : int32_t;
+}
+} // namespace network
+#endif
+
namespace gfx {
class Point;
class Range;
void SetScaleFactor(float scale);
void ClosePageForTesting();
void SetInitialFocus(bool reverse);
+#if BUILDFLAG(IS_EFL)
+ void SetContentSecurityPolicyUsingHeader(
+ const String& policy,
+ network::mojom::ContentSecurityPolicyType header_type,
+ const KURL& base_url);
+#endif
#if BUILDFLAG(IS_MAC)
void GetCharacterIndexAtPoint(const gfx::Point& point);
current, animate);
}
+#if BUILDFLAG(IS_EFL)
+void LocalFrameMojoHandler::SetContentSecurityPolicyUsingHeader(
+ const String& policy,
+ network::mojom::ContentSecurityPolicyType header_type,
+ const KURL& base_url) {
+ frame_->SetContentSecurityPolicyUsingHeader(policy, header_type, base_url);
+}
+#endif
+
void LocalFrameMojoHandler::DispatchBeforeUnload(
bool is_reload,
mojom::blink::LocalFrame::BeforeUnloadCallback callback) {
void UpdateBrowserControlsState(cc::BrowserControlsState constraints,
cc::BrowserControlsState current,
bool animate) override;
+#if BUILDFLAG(IS_EFL)
+ void SetContentSecurityPolicyUsingHeader(
+ const String& policy,
+ network::mojom::ContentSecurityPolicyType header_type,
+ const KURL& base_url) override;
+#endif
// mojom::blink::HighPriorityLocalFrame implementation:
void DispatchBeforeUnload(
Hit_Test_Params,
int64_t /* request id */)
-IPC_MESSAGE_ROUTED2(EwkViewMsg_SetCSP,
- std::string, /* policy */
- Ewk_CSP_Header_Type /* header type */)
-
-IPC_SYNC_MESSAGE_ROUTED0_2(EwkHostMsg_GetContentSecurityPolicy,
- std::string, /* policy */
- Ewk_CSP_Header_Type /* header type */)
+IPC_MESSAGE_ROUTED0(EwkHostMsg_DidCreateDocumentElement)
IPC_MESSAGE_ROUTED1(EwkHostMsg_DidPrintPagesToPdf,
DidPrintPagesParams /* pdf document parameters */)
Send(new EwkHostMsg_FormSubmit(render_frame()->GetRoutingID(), url));
}
+void RenderFrameObserverEfl::DidCreateDocumentElement() {
+ if (!render_frame()->IsMainFrame())
+ return;
+
+ Send(new EwkHostMsg_DidCreateDocumentElement(render_frame()->GetRoutingID()));
+}
+
void RenderFrameObserverEfl::DidCreateScriptContext(
v8::Local<v8::Context> context,
int world_id) {
int world_id) override;
void DidUpdateMainFrameLayout() override;
+ void DidCreateDocumentElement() override;
+
private:
void OnSelectPopupMenuItems(bool canceled,
const std::vector<int>& selected_indices);
namespace content {
+namespace {
+typedef network::mojom::ContentSecurityPolicyType SecurityPolicyType;
+
+static_assert(static_cast<int>(SecurityPolicyType::kReport) ==
+ static_cast<int>(EWK_REPORT_ONLY),
+ "mismatching enums : EWK_REPORT_ONLY");
+static_assert(static_cast<int>(SecurityPolicyType::kEnforce) ==
+ static_cast<int>(EWK_ENFORCE_POLICY),
+ "mismatching enums : EWK_ENFORCE_POLICY");
+
+SecurityPolicyType ToSecurityPolicyType(Ewk_CSP_Header_Type type) {
+ return static_cast<SecurityPolicyType>(type);
+}
+} // namespace
+
static bool IsMainFrame(RenderFrameHost* render_frame_host) {
return !render_frame_host->GetParent();
}
const std::string& policy,
Ewk_CSP_Header_Type header_type) {
if (document_created_) {
-#if !defined(EWK_BRINGUP) // FIXME: m94 bringup
- RenderViewHost* rvh = web_contents_.GetRenderViewHost();
- rvh->Send(new EwkViewMsg_SetCSP(rvh->GetRoutingID(), policy, header_type));
-#endif
+ WebContentsImpl* wci = static_cast<WebContentsImpl*>(&web_contents_);
+ wci->GetPrimaryMainFrame()
+ ->GetAssociatedLocalMainFrame()
+ ->SetContentSecurityPolicyUsingHeader(
+ policy, ToSecurityPolicyType(header_type), wci->GetURL());
} else {
DCHECK(!pending_content_security_policy_.get());
pending_content_security_policy_.reset(
RenderFrameHost* render_frame_host) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(WebContentsObserverEfl, message)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(EwkHostMsg_GetContentSecurityPolicy,
- OnGetContentSecurityPolicy)
+ IPC_MESSAGE_HANDLER(EwkHostMsg_DidCreateDocumentElement,
+ OnDidCreateDocumentElement)
IPC_MESSAGE_HANDLER(EwkHostMsg_DidPrintPagesToPdf,
OnPrintedMetafileReceived)
IPC_MESSAGE_HANDLER(EwkHostMsg_WrtMessage, OnWrtPluginMessage)
#endif
}
-void WebContentsObserverEfl::OnGetContentSecurityPolicy(
- IPC::Message* reply_msg) {
+void WebContentsObserverEfl::OnDidCreateDocumentElement() {
document_created_ = true;
- if (!pending_content_security_policy_.get()) {
- EwkHostMsg_GetContentSecurityPolicy::WriteReplyParams(
- reply_msg, std::string(), EWK_DEFAULT_POLICY);
- } else {
- EwkHostMsg_GetContentSecurityPolicy::WriteReplyParams(
- reply_msg, pending_content_security_policy_->policy,
- pending_content_security_policy_->header_type);
- pending_content_security_policy_.reset();
- }
- Send(reply_msg);
+ if (!pending_content_security_policy_.get())
+ return;
+
+ Ewk_CSP_Header_Type type = pending_content_security_policy_->header_type;
+ if (type == EWK_REPORT_ONLY || type == EWK_ENFORCE_POLICY)
+ SetContentSecurityPolicy(pending_content_security_policy_->policy, type);
}
void WebContentsObserverEfl::OnPrintedMetafileReceived(
RenderFrameHost* render_frame_host) override;
// IPC message handlers:
- void OnGetContentSecurityPolicy(IPC::Message* reply_msg);
+ void OnDidCreateDocumentElement();
void OnPrintedMetafileReceived(const DidPrintPagesParams& params);
void OnWrtPluginMessage(const Ewk_Wrt_Message_Data& data);
void OnWrtPluginSyncMessage(const Ewk_Wrt_Message_Data& data,