OLD | NEW |
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/browser/frame_host/frame_tree_node.h" | 5 #include "content/browser/frame_host/frame_tree_node.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
14 #include "base/profiler/scoped_tracker.h" | 14 #include "base/profiler/scoped_tracker.h" |
15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 16 #include "content/browser/frame_host/csp_context_impl.h" |
16 #include "content/browser/frame_host/frame_tree.h" | 17 #include "content/browser/frame_host/frame_tree.h" |
17 #include "content/browser/frame_host/navigation_request.h" | 18 #include "content/browser/frame_host/navigation_request.h" |
18 #include "content/browser/frame_host/navigator.h" | 19 #include "content/browser/frame_host/navigator.h" |
19 #include "content/browser/frame_host/render_frame_host_impl.h" | 20 #include "content/browser/frame_host/render_frame_host_impl.h" |
20 #include "content/browser/renderer_host/render_view_host_impl.h" | 21 #include "content/browser/renderer_host/render_view_host_impl.h" |
21 #include "content/common/frame_messages.h" | 22 #include "content/common/frame_messages.h" |
22 #include "content/common/site_isolation_policy.h" | 23 #include "content/common/site_isolation_policy.h" |
23 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
24 #include "content/public/common/browser_side_navigation_policy.h" | 25 #include "content/public/common/browser_side_navigation_policy.h" |
25 #include "third_party/WebKit/public/web/WebSandboxFlags.h" | 26 #include "third_party/WebKit/public/web/WebSandboxFlags.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 scope, | 111 scope, |
111 name, | 112 name, |
112 unique_name, | 113 unique_name, |
113 blink::WebSandboxFlags::None, | 114 blink::WebSandboxFlags::None, |
114 false /* should enforce strict mixed content checking */, | 115 false /* should enforce strict mixed content checking */, |
115 false /* is a potentially trustworthy unique origin */, | 116 false /* is a potentially trustworthy unique origin */, |
116 false /* has received a user gesture */), | 117 false /* has received a user gesture */), |
117 pending_sandbox_flags_(blink::WebSandboxFlags::None), | 118 pending_sandbox_flags_(blink::WebSandboxFlags::None), |
118 frame_owner_properties_(frame_owner_properties), | 119 frame_owner_properties_(frame_owner_properties), |
119 loading_progress_(kLoadingProgressNotStarted), | 120 loading_progress_(kLoadingProgressNotStarted), |
120 blame_context_(frame_tree_node_id_, parent) { | 121 blame_context_(frame_tree_node_id_, parent), |
| 122 csp_context_(new CSPContextImpl(this)) { |
121 std::pair<FrameTreeNodeIdMap::iterator, bool> result = | 123 std::pair<FrameTreeNodeIdMap::iterator, bool> result = |
122 g_frame_tree_node_id_map.Get().insert( | 124 g_frame_tree_node_id_map.Get().insert( |
123 std::make_pair(frame_tree_node_id_, this)); | 125 std::make_pair(frame_tree_node_id_, this)); |
124 CHECK(result.second); | 126 CHECK(result.second); |
125 | 127 |
126 RecordUniqueNameLength(unique_name.size()); | 128 RecordUniqueNameLength(unique_name.size()); |
127 | 129 |
128 // Note: this should always be done last in the constructor. | 130 // Note: this should always be done last in the constructor. |
129 blame_context_.Initialize(); | 131 blame_context_.Initialize(); |
130 } | 132 } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 bool is_potentially_trustworthy_unique_origin) { | 252 bool is_potentially_trustworthy_unique_origin) { |
251 if (!origin.IsSameOriginWith(replication_state_.origin) || | 253 if (!origin.IsSameOriginWith(replication_state_.origin) || |
252 replication_state_.has_potentially_trustworthy_unique_origin != | 254 replication_state_.has_potentially_trustworthy_unique_origin != |
253 is_potentially_trustworthy_unique_origin) { | 255 is_potentially_trustworthy_unique_origin) { |
254 render_manager_.OnDidUpdateOrigin(origin, | 256 render_manager_.OnDidUpdateOrigin(origin, |
255 is_potentially_trustworthy_unique_origin); | 257 is_potentially_trustworthy_unique_origin); |
256 } | 258 } |
257 replication_state_.origin = origin; | 259 replication_state_.origin = origin; |
258 replication_state_.has_potentially_trustworthy_unique_origin = | 260 replication_state_.has_potentially_trustworthy_unique_origin = |
259 is_potentially_trustworthy_unique_origin; | 261 is_potentially_trustworthy_unique_origin; |
| 262 csp_context_->SetSelf(replication_state_.origin); |
260 } | 263 } |
261 | 264 |
262 void FrameTreeNode::SetFrameName(const std::string& name, | 265 void FrameTreeNode::SetFrameName(const std::string& name, |
263 const std::string& unique_name) { | 266 const std::string& unique_name) { |
264 if (name == replication_state_.name) { | 267 if (name == replication_state_.name) { |
265 // |unique_name| shouldn't change unless |name| changes. | 268 // |unique_name| shouldn't change unless |name| changes. |
266 DCHECK_EQ(unique_name, replication_state_.unique_name); | 269 DCHECK_EQ(unique_name, replication_state_.unique_name); |
267 return; | 270 return; |
268 } | 271 } |
269 | 272 |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 } | 559 } |
557 return parent_->child_at(i + relative_offset); | 560 return parent_->child_at(i + relative_offset); |
558 } | 561 } |
559 } | 562 } |
560 | 563 |
561 NOTREACHED() << "FrameTreeNode not found in its parent's children."; | 564 NOTREACHED() << "FrameTreeNode not found in its parent's children."; |
562 return nullptr; | 565 return nullptr; |
563 } | 566 } |
564 | 567 |
565 } // namespace content | 568 } // namespace content |
OLD | NEW |