| 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 { |
| 12 enum class WebTreeScopeType; |
| 13 } |
| 14 |
| 11 namespace content { | 15 namespace content { |
| 12 | 16 |
| 13 // Sandboxing flags for iframes. These flags are set via an iframe's "sandbox" | 17 // Sandboxing flags for iframes. These flags are set via an iframe's "sandbox" |
| 14 // attribute in the renderer process and forwarded to the browser process, | 18 // attribute in the renderer process and forwarded to the browser process, |
| 15 // which replicates them to other processes as needed. For a list of sandbox | 19 // which replicates them to other processes as needed. For a list of sandbox |
| 16 // flags, see | 20 // flags, see |
| 17 // http://www.whatwg.org/specs/web-apps/current-work/#attr-iframe-sandbox | 21 // http://www.whatwg.org/specs/web-apps/current-work/#attr-iframe-sandbox |
| 18 // Must be kept in sync with blink::WebSandboxFlags. Enforced in | 22 // Must be kept in sync with blink::WebSandboxFlags. Enforced in |
| 19 // render_frame_impl.cc. | 23 // render_frame_impl.cc. |
| 20 enum class SandboxFlags : int { | 24 enum class SandboxFlags : int { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 38 } | 42 } |
| 39 | 43 |
| 40 inline SandboxFlags operator~(SandboxFlags flags) { | 44 inline SandboxFlags operator~(SandboxFlags flags) { |
| 41 return static_cast<SandboxFlags>(~static_cast<int>(flags)); | 45 return static_cast<SandboxFlags>(~static_cast<int>(flags)); |
| 42 } | 46 } |
| 43 | 47 |
| 44 // This structure holds information that needs to be replicated between a | 48 // This structure holds information that needs to be replicated between a |
| 45 // RenderFrame and any of its associated RenderFrameProxies. | 49 // RenderFrame and any of its associated RenderFrameProxies. |
| 46 struct CONTENT_EXPORT FrameReplicationState { | 50 struct CONTENT_EXPORT FrameReplicationState { |
| 47 FrameReplicationState(); | 51 FrameReplicationState(); |
| 48 FrameReplicationState(const std::string& name, SandboxFlags sandbox_flags); | 52 FrameReplicationState(blink::WebTreeScopeType scope, |
| 53 const std::string& name, |
| 54 SandboxFlags sandbox_flags); |
| 49 ~FrameReplicationState(); | 55 ~FrameReplicationState(); |
| 50 | 56 |
| 51 // Current serialized security origin of the frame. Unique origins are | 57 // Current serialized security origin of the frame. Unique origins are |
| 52 // represented as the string "null" per RFC 6454. This field is updated | 58 // represented as the string "null" per RFC 6454. This field is updated |
| 53 // whenever a frame navigation commits. | 59 // whenever a frame navigation commits. |
| 54 // | 60 // |
| 55 // TODO(alexmos): For now, |origin| updates are immediately sent to all frame | 61 // 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 | 62 // 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 | 63 // 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 | 64 // the ancestors of a local frame. So, as a future improvement, we could |
| (...skipping 20 matching lines...) Expand all Loading... |
| 79 // |name| is set when a new child frame is created using the value of the | 85 // |name| is set when a new child frame is created using the value of the |
| 80 // <iframe> element's "name" attribute (see | 86 // <iframe> element's "name" attribute (see |
| 81 // RenderFrameHostImpl::OnCreateChildFrame), and it is updated dynamically | 87 // RenderFrameHostImpl::OnCreateChildFrame), and it is updated dynamically |
| 82 // whenever a frame sets its window.name. | 88 // whenever a frame sets its window.name. |
| 83 // | 89 // |
| 84 // |name| updates are immediately sent to all frame proxies (when in | 90 // |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 | 91 // --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)). | 92 // frame using its updated name (e.g., using window.open(url, frame_name)). |
| 87 std::string name; | 93 std::string name; |
| 88 | 94 |
| 95 // Whether the frame is in a document tree or a shadow tree, per the Shadow |
| 96 // DOM spec: https://w3c.github.io/webcomponents/spec/shadow/ |
| 97 // Note: This should really be const, as it can never change once a frame is |
| 98 // created. However, making it const makes it a pain to embed into IPC message |
| 99 // params: having a const member implicitly deletes the copy assignment |
| 100 // operator. |
| 101 blink::WebTreeScopeType scope; |
| 102 |
| 89 // TODO(alexmos): Eventually, this structure can also hold other state that | 103 // TODO(alexmos): Eventually, this structure can also hold other state that |
| 90 // needs to be replicated, such as frame sizing info. | 104 // needs to be replicated, such as frame sizing info. |
| 91 }; | 105 }; |
| 92 | 106 |
| 93 } // namespace content | 107 } // namespace content |
| 94 | 108 |
| 95 #endif // CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ | 109 #endif // CONTENT_COMMON_FRAME_REPLICATION_STATE_H_ |
| OLD | NEW |