Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 2612793002: Implement ContentSecurityPolicy on the browser-side. (Closed)
Patch Set: Rebase from master. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "content/child/v8_value_converter_impl.h" 46 #include "content/child/v8_value_converter_impl.h"
47 #include "content/child/web_url_loader_impl.h" 47 #include "content/child/web_url_loader_impl.h"
48 #include "content/child/web_url_request_util.h" 48 #include "content/child/web_url_request_util.h"
49 #include "content/child/webmessageportchannel_impl.h" 49 #include "content/child/webmessageportchannel_impl.h"
50 #include "content/child/weburlresponse_extradata_impl.h" 50 #include "content/child/weburlresponse_extradata_impl.h"
51 #include "content/common/accessibility_messages.h" 51 #include "content/common/accessibility_messages.h"
52 #include "content/common/associated_interface_provider_impl.h" 52 #include "content/common/associated_interface_provider_impl.h"
53 #include "content/common/associated_interfaces.mojom.h" 53 #include "content/common/associated_interfaces.mojom.h"
54 #include "content/common/clipboard_messages.h" 54 #include "content/common/clipboard_messages.h"
55 #include "content/common/content_constants_internal.h" 55 #include "content/common/content_constants_internal.h"
56 #include "content/common/content_security_policy/csp_context.h"
56 #include "content/common/content_security_policy_header.h" 57 #include "content/common/content_security_policy_header.h"
57 #include "content/common/download/mhtml_save_status.h" 58 #include "content/common/download/mhtml_save_status.h"
58 #include "content/common/edit_command.h" 59 #include "content/common/edit_command.h"
59 #include "content/common/frame_messages.h" 60 #include "content/common/frame_messages.h"
60 #include "content/common/frame_owner_properties.h" 61 #include "content/common/frame_owner_properties.h"
61 #include "content/common/frame_replication_state.h" 62 #include "content/common/frame_replication_state.h"
62 #include "content/common/input_messages.h" 63 #include "content/common/input_messages.h"
63 #include "content/common/navigation_params.h" 64 #include "content/common/navigation_params.h"
64 #include "content/common/page_messages.h" 65 #include "content/common/page_messages.h"
65 #include "content/common/savable_subframe.h" 66 #include "content/common/savable_subframe.h"
(...skipping 22 matching lines...) Expand all
88 #include "content/public/renderer/content_renderer_client.h" 89 #include "content/public/renderer/content_renderer_client.h"
89 #include "content/public/renderer/context_menu_client.h" 90 #include "content/public/renderer/context_menu_client.h"
90 #include "content/public/renderer/document_state.h" 91 #include "content/public/renderer/document_state.h"
91 #include "content/public/renderer/navigation_state.h" 92 #include "content/public/renderer/navigation_state.h"
92 #include "content/public/renderer/render_frame_observer.h" 93 #include "content/public/renderer/render_frame_observer.h"
93 #include "content/public/renderer/renderer_ppapi_host.h" 94 #include "content/public/renderer/renderer_ppapi_host.h"
94 #include "content/renderer/accessibility/render_accessibility_impl.h" 95 #include "content/renderer/accessibility/render_accessibility_impl.h"
95 #include "content/renderer/browser_plugin/browser_plugin.h" 96 #include "content/renderer/browser_plugin/browser_plugin.h"
96 #include "content/renderer/browser_plugin/browser_plugin_manager.h" 97 #include "content/renderer/browser_plugin/browser_plugin_manager.h"
97 #include "content/renderer/child_frame_compositing_helper.h" 98 #include "content/renderer/child_frame_compositing_helper.h"
99 #include "content/renderer/content_security_policy_util.h"
98 #include "content/renderer/context_menu_params_builder.h" 100 #include "content/renderer/context_menu_params_builder.h"
99 #include "content/renderer/devtools/devtools_agent.h" 101 #include "content/renderer/devtools/devtools_agent.h"
100 #include "content/renderer/dom_automation_controller.h" 102 #include "content/renderer/dom_automation_controller.h"
101 #include "content/renderer/effective_connection_type_helper.h" 103 #include "content/renderer/effective_connection_type_helper.h"
102 #include "content/renderer/external_popup_menu.h" 104 #include "content/renderer/external_popup_menu.h"
103 #include "content/renderer/frame_owner_properties.h" 105 #include "content/renderer/frame_owner_properties.h"
104 #include "content/renderer/gpu/gpu_benchmarking_extension.h" 106 #include "content/renderer/gpu/gpu_benchmarking_extension.h"
105 #include "content/renderer/history_entry.h" 107 #include "content/renderer/history_entry.h"
106 #include "content/renderer/history_serialization.h" 108 #include "content/renderer/history_serialization.h"
107 #include "content/renderer/image_downloader/image_downloader_impl.h" 109 #include "content/renderer/image_downloader/image_downloader_impl.h"
(...skipping 3093 matching lines...) Expand 10 before | Expand all | Expand 10 after
3201 3203
3202 void RenderFrameImpl::didSetFeaturePolicyHeader( 3204 void RenderFrameImpl::didSetFeaturePolicyHeader(
3203 const blink::WebParsedFeaturePolicyHeader& parsed_header) { 3205 const blink::WebParsedFeaturePolicyHeader& parsed_header) {
3204 Send(new FrameHostMsg_DidSetFeaturePolicyHeader( 3206 Send(new FrameHostMsg_DidSetFeaturePolicyHeader(
3205 routing_id_, FeaturePolicyHeaderFromWeb(parsed_header))); 3207 routing_id_, FeaturePolicyHeaderFromWeb(parsed_header)));
3206 } 3208 }
3207 3209
3208 void RenderFrameImpl::didAddContentSecurityPolicy( 3210 void RenderFrameImpl::didAddContentSecurityPolicy(
3209 const blink::WebString& header_value, 3211 const blink::WebString& header_value,
3210 blink::WebContentSecurityPolicyType type, 3212 blink::WebContentSecurityPolicyType type,
3211 blink::WebContentSecurityPolicySource source) { 3213 blink::WebContentSecurityPolicySource source,
3212 if (!SiteIsolationPolicy::AreCrossProcessFramesPossible()) 3214 const std::vector<blink::WebContentSecurityPolicyPolicy>& policies) {
3213 return;
3214
3215 ContentSecurityPolicyHeader header; 3215 ContentSecurityPolicyHeader header;
3216 header.header_value = header_value.utf8(); 3216 header.header_value = header_value.utf8();
3217 header.type = type; 3217 header.type = type;
3218 header.source = source; 3218 header.source = source;
3219 Send(new FrameHostMsg_DidAddContentSecurityPolicy(routing_id_, header)); 3219
3220 std::vector<ContentSecurityPolicy> content_policies;
3221 for (const auto& policy : policies)
3222 content_policies.push_back(BuildContentSecurityPolicy(policy));
3223
3224 Send(new FrameHostMsg_DidAddContentSecurityPolicy(routing_id_, header,
3225 content_policies));
3220 } 3226 }
3221 3227
3222 void RenderFrameImpl::didChangeFrameOwnerProperties( 3228 void RenderFrameImpl::didChangeFrameOwnerProperties(
3223 blink::WebFrame* child_frame, 3229 blink::WebFrame* child_frame,
3224 const blink::WebFrameOwnerProperties& frame_owner_properties) { 3230 const blink::WebFrameOwnerProperties& frame_owner_properties) {
3225 Send(new FrameHostMsg_DidChangeFrameOwnerProperties( 3231 Send(new FrameHostMsg_DidChangeFrameOwnerProperties(
3226 routing_id_, GetRoutingIdForFrameOrProxy(child_frame), 3232 routing_id_, GetRoutingIdForFrameOrProxy(child_frame),
3227 ConvertWebFrameOwnerPropertiesToFrameOwnerProperties( 3233 ConvertWebFrameOwnerPropertiesToFrameOwnerProperties(
3228 frame_owner_properties))); 3234 frame_owner_properties)));
3229 } 3235 }
(...skipping 3625 matching lines...) Expand 10 before | Expand all | Expand 10 after
6855 // event target. Potentially a Pepper plugin will receive the event. 6861 // event target. Potentially a Pepper plugin will receive the event.
6856 // In order to tell whether a plugin gets the last mouse event and which it 6862 // In order to tell whether a plugin gets the last mouse event and which it
6857 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6863 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6858 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6864 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6859 // |pepper_last_mouse_event_target_|. 6865 // |pepper_last_mouse_event_target_|.
6860 pepper_last_mouse_event_target_ = nullptr; 6866 pepper_last_mouse_event_target_ = nullptr;
6861 #endif 6867 #endif
6862 } 6868 }
6863 6869
6864 } // namespace content 6870 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698