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 #ifndef CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ | 5 #ifndef CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ |
6 #define CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ | 6 #define CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ |
7 | 7 |
8 #include "content/common/content_export.h" | 8 #include "content/common/content_export.h" |
9 #include "url/origin.h" | 9 #include "url/origin.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 enum class WebTreeScopeType; | 12 enum class WebTreeScopeType; |
13 enum class WebSandboxFlags; | 13 enum class WebSandboxFlags; |
14 } | 14 } |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 // This structure holds information that needs to be replicated between a | 18 // This structure holds information that needs to be replicated between a |
19 // RenderFrame and any of its associated RenderFrameProxies. | 19 // RenderFrame and any of its associated RenderFrameProxies. |
20 struct CONTENT_EXPORT FrameReplicationState { | 20 struct CONTENT_EXPORT FrameReplicationState { |
21 FrameReplicationState(); | 21 FrameReplicationState(); |
22 FrameReplicationState(blink::WebTreeScopeType scope, | 22 FrameReplicationState(blink::WebTreeScopeType scope, |
23 const std::string& name, | 23 const std::string& name, |
| 24 const std::string& unique_name, |
24 blink::WebSandboxFlags sandbox_flags, | 25 blink::WebSandboxFlags sandbox_flags, |
25 bool should_enforce_strict_mixed_content_checking); | 26 bool should_enforce_strict_mixed_content_checking); |
26 ~FrameReplicationState(); | 27 ~FrameReplicationState(); |
27 | 28 |
28 // Current origin of the frame. This field is updated whenever a frame | 29 // Current origin of the frame. This field is updated whenever a frame |
29 // navigation commits. | 30 // navigation commits. |
30 // | 31 // |
31 // TODO(alexmos): For now, |origin| updates are immediately sent to all frame | 32 // TODO(alexmos): For now, |origin| updates are immediately sent to all frame |
32 // proxies when in --site-per-process mode. This isn't ideal, since Blink | 33 // proxies when in --site-per-process mode. This isn't ideal, since Blink |
33 // typically needs a proxy's origin only when performing security checks on | 34 // typically needs a proxy's origin only when performing security checks on |
(...skipping 10 matching lines...) Expand all Loading... |
44 // | 45 // |
45 // When a parent frame updates an <iframe>'s sandbox attribute via | 46 // When a parent frame updates an <iframe>'s sandbox attribute via |
46 // JavaScript, |sandbox_flags| are updated only after the child frame commits | 47 // JavaScript, |sandbox_flags| are updated only after the child frame commits |
47 // a navigation that makes the updated flags take effect. This is also the | 48 // a navigation that makes the updated flags take effect. This is also the |
48 // point at which updates are sent to proxies (see | 49 // point at which updates are sent to proxies (see |
49 // CommitPendingSandboxFlags()). The proxies need updated flags so that they | 50 // CommitPendingSandboxFlags()). The proxies need updated flags so that they |
50 // can be inherited properly if a proxy ever becomes a parent of a local | 51 // can be inherited properly if a proxy ever becomes a parent of a local |
51 // frame. | 52 // frame. |
52 blink::WebSandboxFlags sandbox_flags; | 53 blink::WebSandboxFlags sandbox_flags; |
53 | 54 |
54 // The assigned name of the frame. This name can be empty, unlike the unique | 55 // The assigned name of the frame (see WebFrame::assignedName()). |
55 // name generated internally in the DOM tree. | |
56 // | 56 // |
57 // |name| is set when a new child frame is created using the value of the | 57 // |name| is set when a new child frame is created using the value of the |
58 // <iframe> element's "name" attribute (see | 58 // <iframe> element's "name" attribute (see |
59 // RenderFrameHostImpl::OnCreateChildFrame), and it is updated dynamically | 59 // RenderFrameHostImpl::OnCreateChildFrame), and it is updated dynamically |
60 // whenever a frame sets its window.name. | 60 // whenever a frame sets its window.name. |
61 // | 61 // |
62 // |name| updates are immediately sent to all frame proxies (when in | 62 // |name| updates are immediately sent to all frame proxies (when in |
63 // --site-per-process mode), so that other frames can look up or navigate a | 63 // --site-per-process mode), so that other frames can look up or navigate a |
64 // frame using its updated name (e.g., using window.open(url, frame_name)). | 64 // frame using its updated name (e.g., using window.open(url, frame_name)). |
65 std::string name; | 65 std::string name; |
66 | 66 |
| 67 // Unique name of the frame (see WebFrame::uniqueName()). |
| 68 // |
| 69 // |unique_name| is used in heuristics that try to identify the same frame |
| 70 // across different, unrelated navigations (i.e. to refer to the frame |
| 71 // when going back/forward in session history OR when refering to the frame |
| 72 // in layout tests results). |
| 73 // |
| 74 // |unique_name| needs to be replicated to ensure that unique name for a given |
| 75 // frame is the same across all renderers - without replication a renderer |
| 76 // might arrive at a different value when recalculating the unique name from |
| 77 // scratch. |
| 78 std::string unique_name; |
| 79 |
67 // Whether the frame is in a document tree or a shadow tree, per the Shadow | 80 // Whether the frame is in a document tree or a shadow tree, per the Shadow |
68 // DOM spec: https://w3c.github.io/webcomponents/spec/shadow/ | 81 // DOM spec: https://w3c.github.io/webcomponents/spec/shadow/ |
69 // Note: This should really be const, as it can never change once a frame is | 82 // Note: This should really be const, as it can never change once a frame is |
70 // created. However, making it const makes it a pain to embed into IPC message | 83 // created. However, making it const makes it a pain to embed into IPC message |
71 // params: having a const member implicitly deletes the copy assignment | 84 // params: having a const member implicitly deletes the copy assignment |
72 // operator. | 85 // operator. |
73 blink::WebTreeScopeType scope; | 86 blink::WebTreeScopeType scope; |
74 | 87 |
75 // True if a frame's current document should strictly block all mixed | 88 // True if a frame's current document should strictly block all mixed |
76 // content. Updates are immediately sent to all frame proxies when | 89 // content. Updates are immediately sent to all frame proxies when |
77 // frames live in different processes. | 90 // frames live in different processes. |
78 bool should_enforce_strict_mixed_content_checking; | 91 bool should_enforce_strict_mixed_content_checking; |
79 | 92 |
80 // TODO(alexmos): Eventually, this structure can also hold other state that | 93 // TODO(alexmos): Eventually, this structure can also hold other state that |
81 // needs to be replicated, such as frame sizing info. | 94 // needs to be replicated, such as frame sizing info. |
82 }; | 95 }; |
83 | 96 |
84 } // namespace content | 97 } // namespace content |
85 | 98 |
86 #endif // CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ | 99 #endif // CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ |
OLD | NEW |