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

Side by Side Diff: content/browser/frame_host/frame_tree_node.h

Issue 2797813002: Replicate feature policy container policies. (Closed)
Patch Set: Update pending container policy more often; add test Created 3 years, 8 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 #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>
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 blink::WebSandboxFlags pending_sandbox_flags() const { 199 blink::WebSandboxFlags pending_sandbox_flags() const {
200 return pending_sandbox_flags_; 200 return pending_sandbox_flags_;
201 } 201 }
202 202
203 // Update this frame's sandbox flags. This is used when a parent frame 203 // 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 204 // 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 205 // 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|. 206 // sandboxed, the parent's sandbox flags are combined with |sandbox_flags|.
207 void SetPendingSandboxFlags(blink::WebSandboxFlags sandbox_flags); 207 void SetPendingSandboxFlags(blink::WebSandboxFlags sandbox_flags);
208 208
209 // Set any pending sandbox flags as active, and return true if the sandbox 209 // Returns the currently active container policy for this frame, which is set
210 // flags were changed. 210 // by the iframe allowfullscreen, allowpaymentrequest, and allow attributes,
211 bool CommitPendingSandboxFlags(); 211 // along with the origin of the iframe's src attribute (which may be different
212 // from the URL of the document currently loaded into the frame). This does
213 // not include policy changes that have been made by updating the containing
214 // iframe element attributes since the frame was last navigated.
215 const ParsedFeaturePolicyHeader& effective_container_policy() const {
216 return replication_state_.container_policy;
217 }
218
219 const ParsedFeaturePolicyHeader& PendingContainerPolicyForTests() const {
220 return pending_container_policy_;
alexmos 2017/04/14 23:42:45 You could also use FRIEND_TEST_ALL_PREFIXES and ch
iclelland 2017/04/15 03:36:06 Now that's a handy macro, thanks!
221 }
222
223 // Update this frame's container policy. This is used when a parent frame
224 // updates feature-policy attributes in the <iframe> element for this frame.
225 // These attributes include allow, allowfullscreen, allowpaymentrequest, and
226 // src. Updates to the container policy will not take effect until next
227 // navigation.
228 // This method must only be called on a subframe; changing the container
229 // policy on the main frame is not allowed.
230 void SetPendingContainerPolicy(
231 const ParsedFeaturePolicyHeader& container_policy);
232
233 // Set any pending sandbox flags and container policy as active, and return
234 // true if either was changed.
235 bool CommitPendingFramePolicy();
212 236
213 const FrameOwnerProperties& frame_owner_properties() { 237 const FrameOwnerProperties& frame_owner_properties() {
214 return frame_owner_properties_; 238 return frame_owner_properties_;
215 } 239 }
216 240
217 void set_frame_owner_properties( 241 void set_frame_owner_properties(
218 const FrameOwnerProperties& frame_owner_properties) { 242 const FrameOwnerProperties& frame_owner_properties) {
219 frame_owner_properties_ = frame_owner_properties; 243 frame_owner_properties_ = frame_owner_properties;
220 } 244 }
221 245
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 // proxies for this frame. 396 // proxies for this frame.
373 FrameReplicationState replication_state_; 397 FrameReplicationState replication_state_;
374 398
375 // Track the pending sandbox flags for this frame. When a parent frame 399 // Track the pending sandbox flags for this frame. When a parent frame
376 // dynamically updates sandbox flags in the <iframe> element for a child 400 // dynamically updates sandbox flags in the <iframe> element for a child
377 // frame, these updated flags are stored here and are transferred into 401 // frame, these updated flags are stored here and are transferred into
378 // replication_state_.sandbox_flags when they take effect on the next frame 402 // replication_state_.sandbox_flags when they take effect on the next frame
379 // navigation. 403 // navigation.
380 blink::WebSandboxFlags pending_sandbox_flags_; 404 blink::WebSandboxFlags pending_sandbox_flags_;
381 405
406 // Tracks the computed container policy for this frame. When the iframe
407 // allowfullscreen, allowpaymentrequest, allow or src attributes are changed,
408 // the updated policy for the frame is stored here, and transferred into
409 // replication_state_.container_policy on the next frame navigation.
410 ParsedFeaturePolicyHeader pending_container_policy_;
411
382 // Tracks the scrolling and margin properties for this frame. These 412 // Tracks the scrolling and margin properties for this frame. These
383 // properties affect the child renderer but are stored on its parent's 413 // properties affect the child renderer but are stored on its parent's
384 // frame element. When this frame's parent dynamically updates these 414 // frame element. When this frame's parent dynamically updates these
385 // properties, we update them here too. 415 // properties, we update them here too.
386 // 416 //
387 // Note that dynamic updates only take effect on the next frame navigation. 417 // Note that dynamic updates only take effect on the next frame navigation.
388 FrameOwnerProperties frame_owner_properties_; 418 FrameOwnerProperties frame_owner_properties_;
389 419
390 // Used to track this node's loading progress (from 0 to 1). 420 // Used to track this node's loading progress (from 0 to 1).
391 double loading_progress_; 421 double loading_progress_;
(...skipping 12 matching lines...) Expand all
404 // browser process activities to this node (when possible). It is unrelated 434 // browser process activities to this node (when possible). It is unrelated
405 // to the core logic of FrameTreeNode. 435 // to the core logic of FrameTreeNode.
406 FrameTreeNodeBlameContext blame_context_; 436 FrameTreeNodeBlameContext blame_context_;
407 437
408 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); 438 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode);
409 }; 439 };
410 440
411 } // namespace content 441 } // namespace content
412 442
413 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ 443 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698