OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_proxy.h" | 5 #include "content/renderer/render_frame_proxy.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 // Facilitates lookup of RenderFrameProxy by routing_id. | 43 // Facilitates lookup of RenderFrameProxy by routing_id. |
44 typedef std::map<int, RenderFrameProxy*> RoutingIDProxyMap; | 44 typedef std::map<int, RenderFrameProxy*> RoutingIDProxyMap; |
45 static base::LazyInstance<RoutingIDProxyMap> g_routing_id_proxy_map = | 45 static base::LazyInstance<RoutingIDProxyMap> g_routing_id_proxy_map = |
46 LAZY_INSTANCE_INITIALIZER; | 46 LAZY_INSTANCE_INITIALIZER; |
47 | 47 |
48 // Facilitates lookup of RenderFrameProxy by WebFrame. | 48 // Facilitates lookup of RenderFrameProxy by WebFrame. |
49 typedef std::map<blink::WebFrame*, RenderFrameProxy*> FrameMap; | 49 typedef std::map<blink::WebFrame*, RenderFrameProxy*> FrameMap; |
50 base::LazyInstance<FrameMap> g_frame_map = LAZY_INSTANCE_INITIALIZER; | 50 base::LazyInstance<FrameMap> g_frame_map = LAZY_INSTANCE_INITIALIZER; |
51 | 51 |
52 blink::WebParsedFeaturePolicy ToWebParsedFeaturePolicy( | 52 blink::WebParsedFeaturePolicyHeader ToWebParsedFeaturePolicyHeader( |
53 const ParsedFeaturePolicy& parsed_whitelists) { | 53 const ParsedFeaturePolicyHeader& parsed_header) { |
54 std::vector<blink::WebFeaturePolicy::ParsedWhitelist> result; | 54 std::vector<blink::WebParsedFeaturePolicyDeclaration> result; |
55 for (const FeaturePolicyParsedWhitelist& whitelist : parsed_whitelists) { | 55 for (const ParsedFeaturePolicyDeclaration& declaration : parsed_header) { |
56 blink::WebFeaturePolicy::ParsedWhitelist web_whitelist; | 56 blink::WebParsedFeaturePolicyDeclaration web_declaration; |
57 web_whitelist.featureName = | 57 web_declaration.featureName = |
58 blink::WebString::fromUTF8(whitelist.feature_name); | 58 blink::WebString::fromUTF8(declaration.feature_name); |
59 web_whitelist.matchesAllOrigins = whitelist.matches_all_origins; | 59 web_declaration.matchesAllOrigins = declaration.matches_all_origins; |
60 std::vector<blink::WebSecurityOrigin> web_origins; | 60 std::vector<blink::WebSecurityOrigin> web_origins; |
61 for (const url::Origin& origin : whitelist.origins) | 61 for (const url::Origin& origin : declaration.origins) |
62 web_origins.push_back(origin); | 62 web_origins.push_back(origin); |
63 web_whitelist.origins = web_origins; | 63 web_declaration.origins = web_origins; |
64 result.push_back(web_whitelist); | 64 result.push_back(web_declaration); |
65 } | 65 } |
66 return result; | 66 return result; |
67 } | 67 } |
68 | 68 |
69 } // namespace | 69 } // namespace |
70 | 70 |
71 // static | 71 // static |
72 RenderFrameProxy* RenderFrameProxy::CreateProxyToReplaceFrame( | 72 RenderFrameProxy* RenderFrameProxy::CreateProxyToReplaceFrame( |
73 RenderFrameImpl* frame_to_replace, | 73 RenderFrameImpl* frame_to_replace, |
74 int routing_id, | 74 int routing_id, |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 void RenderFrameProxy::SetReplicatedState(const FrameReplicationState& state) { | 234 void RenderFrameProxy::SetReplicatedState(const FrameReplicationState& state) { |
235 DCHECK(web_frame_); | 235 DCHECK(web_frame_); |
236 web_frame_->setReplicatedOrigin(state.origin); | 236 web_frame_->setReplicatedOrigin(state.origin); |
237 web_frame_->setReplicatedSandboxFlags(state.sandbox_flags); | 237 web_frame_->setReplicatedSandboxFlags(state.sandbox_flags); |
238 web_frame_->setReplicatedName(blink::WebString::fromUTF8(state.name), | 238 web_frame_->setReplicatedName(blink::WebString::fromUTF8(state.name), |
239 blink::WebString::fromUTF8(state.unique_name)); | 239 blink::WebString::fromUTF8(state.unique_name)); |
240 web_frame_->setReplicatedInsecureRequestPolicy(state.insecure_request_policy); | 240 web_frame_->setReplicatedInsecureRequestPolicy(state.insecure_request_policy); |
241 web_frame_->setReplicatedPotentiallyTrustworthyUniqueOrigin( | 241 web_frame_->setReplicatedPotentiallyTrustworthyUniqueOrigin( |
242 state.has_potentially_trustworthy_unique_origin); | 242 state.has_potentially_trustworthy_unique_origin); |
243 web_frame_->setReplicatedFeaturePolicyHeader( | 243 web_frame_->setReplicatedFeaturePolicyHeader( |
244 ToWebParsedFeaturePolicy(state.feature_policy_header)); | 244 ToWebParsedFeaturePolicyHeader(state.feature_policy_header)); |
245 if (state.has_received_user_gesture) | 245 if (state.has_received_user_gesture) |
246 web_frame_->setHasReceivedUserGesture(); | 246 web_frame_->setHasReceivedUserGesture(); |
247 | 247 |
248 web_frame_->resetReplicatedContentSecurityPolicy(); | 248 web_frame_->resetReplicatedContentSecurityPolicy(); |
249 for (const auto& header : state.accumulated_csp_headers) | 249 for (const auto& header : state.accumulated_csp_headers) |
250 OnAddContentSecurityPolicy(header); | 250 OnAddContentSecurityPolicy(header); |
251 } | 251 } |
252 | 252 |
253 // Update the proxy's SecurityContext and FrameOwner with new sandbox flags | 253 // Update the proxy's SecurityContext and FrameOwner with new sandbox flags |
254 // that were set by its parent in another process. | 254 // that were set by its parent in another process. |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 blink::WebLocalFrame* source) { | 541 blink::WebLocalFrame* source) { |
542 int source_routing_id = RenderFrameImpl::FromWebFrame(source)->GetRoutingID(); | 542 int source_routing_id = RenderFrameImpl::FromWebFrame(source)->GetRoutingID(); |
543 Send(new FrameHostMsg_AdvanceFocus(routing_id_, type, source_routing_id)); | 543 Send(new FrameHostMsg_AdvanceFocus(routing_id_, type, source_routing_id)); |
544 } | 544 } |
545 | 545 |
546 void RenderFrameProxy::frameFocused() { | 546 void RenderFrameProxy::frameFocused() { |
547 Send(new FrameHostMsg_FrameFocused(routing_id_)); | 547 Send(new FrameHostMsg_FrameFocused(routing_id_)); |
548 } | 548 } |
549 | 549 |
550 } // namespace | 550 } // namespace |
OLD | NEW |