| 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 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ |
| 6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/gtest_prod_util.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 16 #include "content/browser/frame_host/frame_tree_node_blame_context.h" | 17 #include "content/browser/frame_host/frame_tree_node_blame_context.h" |
| 17 #include "content/browser/frame_host/render_frame_host_impl.h" | 18 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 18 #include "content/browser/frame_host/render_frame_host_manager.h" | 19 #include "content/browser/frame_host/render_frame_host_manager.h" |
| 19 #include "content/common/content_export.h" | 20 #include "content/common/content_export.h" |
| 20 #include "content/common/frame_owner_properties.h" | 21 #include "content/common/frame_owner_properties.h" |
| 21 #include "content/common/frame_replication_state.h" | 22 #include "content/common/frame_replication_state.h" |
| 22 #include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h" | 23 #include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h" |
| 23 #include "url/gurl.h" | 24 #include "url/gurl.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 blink::WebSandboxFlags pending_sandbox_flags() const { | 200 blink::WebSandboxFlags pending_sandbox_flags() const { |
| 200 return pending_sandbox_flags_; | 201 return pending_sandbox_flags_; |
| 201 } | 202 } |
| 202 | 203 |
| 203 // Update this frame's sandbox flags. This is used when a parent frame | 204 // Update this frame's sandbox flags. This is used when a parent frame |
| 204 // updates sandbox flags in the <iframe> element for this frame. These flags | 205 // updates sandbox flags in the <iframe> element for this frame. These flags |
| 205 // won't take effect until next navigation. If this frame's parent is itself | 206 // won't take effect until next navigation. If this frame's parent is itself |
| 206 // sandboxed, the parent's sandbox flags are combined with |sandbox_flags|. | 207 // sandboxed, the parent's sandbox flags are combined with |sandbox_flags|. |
| 207 void SetPendingSandboxFlags(blink::WebSandboxFlags sandbox_flags); | 208 void SetPendingSandboxFlags(blink::WebSandboxFlags sandbox_flags); |
| 208 | 209 |
| 209 // Set any pending sandbox flags as active, and return true if the sandbox | 210 // Returns the currently active container policy for this frame, which is set |
| 210 // flags were changed. | 211 // by the iframe allowfullscreen, allowpaymentrequest, and allow attributes, |
| 211 bool CommitPendingSandboxFlags(); | 212 // along with the origin of the iframe's src attribute (which may be different |
| 213 // from the URL of the document currently loaded into the frame). This does |
| 214 // not include policy changes that have been made by updating the containing |
| 215 // iframe element attributes since the frame was last navigated. |
| 216 const ParsedFeaturePolicyHeader& effective_container_policy() const { |
| 217 return replication_state_.container_policy; |
| 218 } |
| 219 |
| 220 // Update this frame's container policy. This is used when a parent frame |
| 221 // updates feature-policy attributes in the <iframe> element for this frame. |
| 222 // These attributes include allow, allowfullscreen, allowpaymentrequest, and |
| 223 // src. Updates to the container policy will not take effect until next |
| 224 // navigation. |
| 225 // This method must only be called on a subframe; changing the container |
| 226 // policy on the main frame is not allowed. |
| 227 void SetPendingContainerPolicy( |
| 228 const ParsedFeaturePolicyHeader& container_policy); |
| 229 |
| 230 // Set any pending sandbox flags and container policy as active, and return |
| 231 // true if either was changed. |
| 232 bool CommitPendingFramePolicy(); |
| 212 | 233 |
| 213 const FrameOwnerProperties& frame_owner_properties() { | 234 const FrameOwnerProperties& frame_owner_properties() { |
| 214 return frame_owner_properties_; | 235 return frame_owner_properties_; |
| 215 } | 236 } |
| 216 | 237 |
| 217 void set_frame_owner_properties( | 238 void set_frame_owner_properties( |
| 218 const FrameOwnerProperties& frame_owner_properties) { | 239 const FrameOwnerProperties& frame_owner_properties) { |
| 219 frame_owner_properties_ = frame_owner_properties; | 240 frame_owner_properties_ = frame_owner_properties; |
| 220 } | 241 } |
| 221 | 242 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 // cancelled the navigation. This should stop any load happening in the | 328 // cancelled the navigation. This should stop any load happening in the |
| 308 // FrameTreeNode. | 329 // FrameTreeNode. |
| 309 void BeforeUnloadCanceled(); | 330 void BeforeUnloadCanceled(); |
| 310 | 331 |
| 311 // Returns the BlameContext associated with this node. | 332 // Returns the BlameContext associated with this node. |
| 312 FrameTreeNodeBlameContext& blame_context() { return blame_context_; } | 333 FrameTreeNodeBlameContext& blame_context() { return blame_context_; } |
| 313 | 334 |
| 314 void OnSetHasReceivedUserGesture(); | 335 void OnSetHasReceivedUserGesture(); |
| 315 | 336 |
| 316 private: | 337 private: |
| 338 FRIEND_TEST_ALL_PREFIXES(SitePerProcessFeaturePolicyBrowserTest, |
| 339 ContainerPolicyDynamic); |
| 340 FRIEND_TEST_ALL_PREFIXES(SitePerProcessFeaturePolicyBrowserTest, |
| 341 ContainerPolicySandboxDynamic); |
| 342 |
| 317 class OpenerDestroyedObserver; | 343 class OpenerDestroyedObserver; |
| 318 | 344 |
| 319 FrameTreeNode* GetSibling(int relative_offset) const; | 345 FrameTreeNode* GetSibling(int relative_offset) const; |
| 320 | 346 |
| 321 // The next available browser-global FrameTreeNode ID. | 347 // The next available browser-global FrameTreeNode ID. |
| 322 static int next_frame_tree_node_id_; | 348 static int next_frame_tree_node_id_; |
| 323 | 349 |
| 324 // The FrameTree that owns us. | 350 // The FrameTree that owns us. |
| 325 FrameTree* frame_tree_; // not owned. | 351 FrameTree* frame_tree_; // not owned. |
| 326 | 352 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 // proxies for this frame. | 398 // proxies for this frame. |
| 373 FrameReplicationState replication_state_; | 399 FrameReplicationState replication_state_; |
| 374 | 400 |
| 375 // Track the pending sandbox flags for this frame. When a parent frame | 401 // Track the pending sandbox flags for this frame. When a parent frame |
| 376 // dynamically updates sandbox flags in the <iframe> element for a child | 402 // dynamically updates sandbox flags in the <iframe> element for a child |
| 377 // frame, these updated flags are stored here and are transferred into | 403 // frame, these updated flags are stored here and are transferred into |
| 378 // replication_state_.sandbox_flags when they take effect on the next frame | 404 // replication_state_.sandbox_flags when they take effect on the next frame |
| 379 // navigation. | 405 // navigation. |
| 380 blink::WebSandboxFlags pending_sandbox_flags_; | 406 blink::WebSandboxFlags pending_sandbox_flags_; |
| 381 | 407 |
| 408 // Tracks the computed container policy for this frame. When the iframe |
| 409 // allowfullscreen, allowpaymentrequest, allow or src attributes are changed, |
| 410 // the updated policy for the frame is stored here, and transferred into |
| 411 // replication_state_.container_policy on the next frame navigation. |
| 412 ParsedFeaturePolicyHeader pending_container_policy_; |
| 413 |
| 382 // Tracks the scrolling and margin properties for this frame. These | 414 // Tracks the scrolling and margin properties for this frame. These |
| 383 // properties affect the child renderer but are stored on its parent's | 415 // properties affect the child renderer but are stored on its parent's |
| 384 // frame element. When this frame's parent dynamically updates these | 416 // frame element. When this frame's parent dynamically updates these |
| 385 // properties, we update them here too. | 417 // properties, we update them here too. |
| 386 // | 418 // |
| 387 // Note that dynamic updates only take effect on the next frame navigation. | 419 // Note that dynamic updates only take effect on the next frame navigation. |
| 388 FrameOwnerProperties frame_owner_properties_; | 420 FrameOwnerProperties frame_owner_properties_; |
| 389 | 421 |
| 390 // Used to track this node's loading progress (from 0 to 1). | 422 // Used to track this node's loading progress (from 0 to 1). |
| 391 double loading_progress_; | 423 double loading_progress_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 404 // browser process activities to this node (when possible). It is unrelated | 436 // browser process activities to this node (when possible). It is unrelated |
| 405 // to the core logic of FrameTreeNode. | 437 // to the core logic of FrameTreeNode. |
| 406 FrameTreeNodeBlameContext blame_context_; | 438 FrameTreeNodeBlameContext blame_context_; |
| 407 | 439 |
| 408 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); | 440 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); |
| 409 }; | 441 }; |
| 410 | 442 |
| 411 } // namespace content | 443 } // namespace content |
| 412 | 444 |
| 413 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ | 445 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ |
| OLD | NEW |