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 |
(...skipping 30 matching lines...) Expand all Loading... |
41 return static_cast<SandboxFlags>(~static_cast<int>(flags)); | 41 return static_cast<SandboxFlags>(~static_cast<int>(flags)); |
42 } | 42 } |
43 | 43 |
44 // This structure holds information that needs to be replicated between a | 44 // This structure holds information that needs to be replicated between a |
45 // RenderFrame and any of its associated RenderFrameProxies. | 45 // RenderFrame and any of its associated RenderFrameProxies. |
46 struct CONTENT_EXPORT FrameReplicationState { | 46 struct CONTENT_EXPORT FrameReplicationState { |
47 FrameReplicationState(); | 47 FrameReplicationState(); |
48 FrameReplicationState(const std::string& name); | 48 FrameReplicationState(const std::string& name); |
49 ~FrameReplicationState(); | 49 ~FrameReplicationState(); |
50 | 50 |
51 // Current serialized security origin of the frame. Unique origins are | 51 // Current serialized security origin of the frame. Unique origins are |
52 // represented as the string "null" per RFC 6454. | 52 // represented as the string "null" per RFC 6454. This field is updated |
| 53 // whenever a frame navigation commits. |
| 54 // |
| 55 // TODO(alexmos): For now, |origin| updates are immediately sent to all frame |
| 56 // proxies when in --site-per-process mode. This isn't ideal, since Blink |
| 57 // typically needs a proxy's origin only when performing security checks on |
| 58 // the ancestors of a local frame. So, as a future improvement, we could |
| 59 // delay sending origin updates to proxies until they have a local descendant |
| 60 // (if ever). This would reduce leaking a user's browsing history into a |
| 61 // compromized renderer. |
53 url::Origin origin; | 62 url::Origin origin; |
54 | 63 |
55 // Current sandbox flags of the frame. | 64 // Current sandbox flags of the frame. |sandbox_flags| are initialized for |
| 65 // new child frames using the value of the <iframe> element's "sandbox" |
| 66 // attribute. They are updated dynamically whenever a parent frame updates an |
| 67 // <iframe>'s sandbox attribute via JavaScript. |
| 68 // |
| 69 // Updates to |sandbox_flags| are sent to proxies, but only after a |
| 70 // subsequent navigation of the (sandboxed) frame, since the flags only take |
| 71 // effect on navigation (see also FrameTreeNode::effective_sandbox_flags_). |
| 72 // The proxies need updated flags so that they can be inherited properly if a |
| 73 // proxy ever becomes a parent of a local frame. |
56 SandboxFlags sandbox_flags; | 74 SandboxFlags sandbox_flags; |
57 | 75 |
58 // The assigned name of the frame. This name can be empty, unlike the unique | 76 // The assigned name of the frame. This name can be empty, unlike the unique |
59 // name generated internally in the DOM tree. | 77 // name generated internally in the DOM tree. |
| 78 // |
| 79 // |name| is set when a new child frame is created using the value of the |
| 80 // <iframe> element's "name" attribute (see |
| 81 // RenderFrameHostImpl::OnCreateChildFrame), and it is updated dynamically |
| 82 // whenever a frame sets its window.name. |
| 83 // |
| 84 // |name| updates are immediately sent to all frame proxies (when in |
| 85 // --site-per-process mode), so that other frames can look up or navigate a |
| 86 // frame using its updated name (e.g., using window.open(url, frame_name)). |
60 std::string name; | 87 std::string name; |
61 | 88 |
62 // TODO(alexmos): Eventually, this structure can also hold other state that | 89 // TODO(alexmos): Eventually, this structure can also hold other state that |
63 // needs to be replicated, such as frame sizing info. | 90 // needs to be replicated, such as frame sizing info. |
64 }; | 91 }; |
65 | 92 |
66 } // namespace content | 93 } // namespace content |
67 | 94 |
68 #endif // CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ | 95 #endif // CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ |
OLD | NEW |