[Android WebView] Fix webview perf bot switchover to use org.chromium.webview_shell...
[chromium-blink-merge.git] / content / common / frame_replication_state.h
blobdfdbefdc4d8720e67e9743ebb1fcdc6924f08790
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_COMMON_FRAME_REPLICATION_STATE_H_
6 #define CONTENT_COMMON_FRAME_REPLICATION_STATE_H_
8 #include "content/common/content_export.h"
9 #include "url/origin.h"
11 namespace blink {
12 enum class WebTreeScopeType;
13 enum class WebSandboxFlags;
16 namespace content {
18 // This structure holds information that needs to be replicated between a
19 // RenderFrame and any of its associated RenderFrameProxies.
20 struct CONTENT_EXPORT FrameReplicationState {
21 FrameReplicationState();
22 FrameReplicationState(blink::WebTreeScopeType scope,
23 const std::string& name,
24 blink::WebSandboxFlags sandbox_flags);
25 ~FrameReplicationState();
27 // Current serialized security origin of the frame. Unique origins are
28 // represented as the string "null" per RFC 6454. This field is updated
29 // whenever a frame navigation commits.
31 // 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 // typically needs a proxy's origin only when performing security checks on
34 // the ancestors of a local frame. So, as a future improvement, we could
35 // delay sending origin updates to proxies until they have a local descendant
36 // (if ever). This would reduce leaking a user's browsing history into a
37 // compromized renderer.
38 url::Origin origin;
40 // Current sandbox flags of the frame. |sandbox_flags| are initialized for
41 // new child frames using the value of the <iframe> element's "sandbox"
42 // attribute. They are updated dynamically whenever a parent frame updates an
43 // <iframe>'s sandbox attribute via JavaScript.
45 // Updates to |sandbox_flags| are sent to proxies, but only after a
46 // subsequent navigation of the (sandboxed) frame, since the flags only take
47 // effect on navigation (see also FrameTreeNode::effective_sandbox_flags_).
48 // The proxies need updated flags so that they can be inherited properly if a
49 // proxy ever becomes a parent of a local frame.
50 blink::WebSandboxFlags sandbox_flags;
52 // The assigned name of the frame. This name can be empty, unlike the unique
53 // name generated internally in the DOM tree.
55 // |name| is set when a new child frame is created using the value of the
56 // <iframe> element's "name" attribute (see
57 // RenderFrameHostImpl::OnCreateChildFrame), and it is updated dynamically
58 // whenever a frame sets its window.name.
60 // |name| updates are immediately sent to all frame proxies (when in
61 // --site-per-process mode), so that other frames can look up or navigate a
62 // frame using its updated name (e.g., using window.open(url, frame_name)).
63 std::string name;
65 // Whether the frame is in a document tree or a shadow tree, per the Shadow
66 // DOM spec: https://w3c.github.io/webcomponents/spec/shadow/
67 // Note: This should really be const, as it can never change once a frame is
68 // created. However, making it const makes it a pain to embed into IPC message
69 // params: having a const member implicitly deletes the copy assignment
70 // operator.
71 blink::WebTreeScopeType scope;
73 // TODO(alexmos): Eventually, this structure can also hold other state that
74 // needs to be replicated, such as frame sizing info.
77 } // namespace content
79 #endif // CONTENT_COMMON_FRAME_REPLICATION_STATE_H_