OLD | NEW |
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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
| 14 #include "content/browser/frame_host/frame_navigation_entry.h" |
14 #include "content/browser/frame_host/render_frame_host_impl.h" | 15 #include "content/browser/frame_host/render_frame_host_impl.h" |
15 #include "content/browser/frame_host/render_frame_host_manager.h" | 16 #include "content/browser/frame_host/render_frame_host_manager.h" |
16 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
17 #include "content/common/frame_replication_state.h" | 18 #include "content/common/frame_replication_state.h" |
18 #include "url/gurl.h" | 19 #include "url/gurl.h" |
19 #include "url/origin.h" | 20 #include "url/origin.h" |
20 | 21 |
21 namespace content { | 22 namespace content { |
22 | 23 |
23 class FrameTree; | 24 class FrameTree; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 size_t child_count() const { | 78 size_t child_count() const { |
78 return children_.size(); | 79 return children_.size(); |
79 } | 80 } |
80 | 81 |
81 FrameTreeNode* parent() const { return parent_; } | 82 FrameTreeNode* parent() const { return parent_; } |
82 | 83 |
83 FrameTreeNode* child_at(size_t index) const { | 84 FrameTreeNode* child_at(size_t index) const { |
84 return children_[index]; | 85 return children_[index]; |
85 } | 86 } |
86 | 87 |
87 const GURL& current_url() const { | 88 FrameNavigationEntry* last_committed_frame_entry() { |
88 return current_url_; | 89 return last_committed_frame_entry_.get(); |
89 } | 90 } |
90 | 91 |
91 void set_current_url(const GURL& url) { | 92 void set_last_committed_frame_entry(FrameNavigationEntry* entry) { |
92 current_url_ = url; | 93 last_committed_frame_entry_ = entry; |
| 94 } |
| 95 |
| 96 // TODO(creis): Rename to last_committed_url(). |
| 97 const GURL& current_url() const { |
| 98 if (last_committed_frame_entry_) |
| 99 return last_committed_frame_entry_->url(); |
| 100 return GURL::EmptyGURL(); |
93 } | 101 } |
94 | 102 |
95 void set_current_origin(const url::Origin& origin) { | 103 void set_current_origin(const url::Origin& origin) { |
96 replication_state_.origin = origin; | 104 replication_state_.origin = origin; |
97 } | 105 } |
98 | 106 |
99 void SetFrameName(const std::string& name); | 107 void SetFrameName(const std::string& name); |
100 | 108 |
101 SandboxFlags effective_sandbox_flags() { return effective_sandbox_flags_; } | 109 SandboxFlags effective_sandbox_flags() { return effective_sandbox_flags_; } |
102 | 110 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // even if the frame does a cross-process navigation. | 159 // even if the frame does a cross-process navigation. |
152 const int64 frame_tree_node_id_; | 160 const int64 frame_tree_node_id_; |
153 | 161 |
154 // The parent node of this frame. NULL if this node is the root or if it has | 162 // The parent node of this frame. NULL if this node is the root or if it has |
155 // not yet been attached to the frame tree. | 163 // not yet been attached to the frame tree. |
156 FrameTreeNode* parent_; | 164 FrameTreeNode* parent_; |
157 | 165 |
158 // The immediate children of this specific frame. | 166 // The immediate children of this specific frame. |
159 ScopedVector<FrameTreeNode> children_; | 167 ScopedVector<FrameTreeNode> children_; |
160 | 168 |
161 // Track the current frame's last committed URL, so we can estimate the | 169 // Track the current frame's last committed FrameNavigationEntry, which lets |
162 // process impact of out-of-process iframes. | 170 // other callers know what the last committed URL is. |
163 // TODO(creis): Remove this when we can store subframe URLs in the | 171 scoped_refptr<FrameNavigationEntry> last_committed_frame_entry_; |
164 // NavigationController. | |
165 GURL current_url_; | |
166 | 172 |
167 // Track information that needs to be replicated to processes that have | 173 // Track information that needs to be replicated to processes that have |
168 // proxies for this frame. | 174 // proxies for this frame. |
169 FrameReplicationState replication_state_; | 175 FrameReplicationState replication_state_; |
170 | 176 |
171 // Track the effective sandbox flags for this frame. When a parent frame | 177 // Track the effective sandbox flags for this frame. When a parent frame |
172 // dynamically updates sandbox flags for a child frame, the child's updated | 178 // dynamically updates sandbox flags for a child frame, the child's updated |
173 // sandbox flags are stored in replication_state_.sandbox_flags. However, the | 179 // sandbox flags are stored in replication_state_.sandbox_flags. However, the |
174 // update only takes effect on the next frame navigation, so the effective | 180 // update only takes effect on the next frame navigation, so the effective |
175 // sandbox flags are tracked separately here. When enforcing sandbox flags | 181 // sandbox flags are tracked separately here. When enforcing sandbox flags |
176 // directives in the browser process, |effective_sandbox_flags_| should be | 182 // directives in the browser process, |effective_sandbox_flags_| should be |
177 // used. |effective_sandbox_flags_| is updated with any pending sandbox | 183 // used. |effective_sandbox_flags_| is updated with any pending sandbox |
178 // flags when a navigation for this frame commits. | 184 // flags when a navigation for this frame commits. |
179 SandboxFlags effective_sandbox_flags_; | 185 SandboxFlags effective_sandbox_flags_; |
180 | 186 |
181 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); | 187 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); |
182 }; | 188 }; |
183 | 189 |
184 } // namespace content | 190 } // namespace content |
185 | 191 |
186 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ | 192 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ |
OLD | NEW |