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" |
(...skipping 12 matching lines...) Expand all Loading... |
23 class FrameTree; | 23 class FrameTree; |
24 class Navigator; | 24 class Navigator; |
25 class RenderFrameHostImpl; | 25 class RenderFrameHostImpl; |
26 | 26 |
27 // When a page contains iframes, its renderer process maintains a tree structure | 27 // When a page contains iframes, its renderer process maintains a tree structure |
28 // of those frames. We are mirroring this tree in the browser process. This | 28 // of those frames. We are mirroring this tree in the browser process. This |
29 // class represents a node in this tree and is a wrapper for all objects that | 29 // class represents a node in this tree and is a wrapper for all objects that |
30 // are frame-specific (as opposed to page-specific). | 30 // are frame-specific (as opposed to page-specific). |
31 class CONTENT_EXPORT FrameTreeNode { | 31 class CONTENT_EXPORT FrameTreeNode { |
32 public: | 32 public: |
| 33 |
33 FrameTreeNode(FrameTree* frame_tree, | 34 FrameTreeNode(FrameTree* frame_tree, |
34 Navigator* navigator, | 35 Navigator* navigator, |
35 RenderFrameHostDelegate* render_frame_delegate, | 36 RenderFrameHostDelegate* render_frame_delegate, |
36 RenderViewHostDelegate* render_view_delegate, | 37 RenderViewHostDelegate* render_view_delegate, |
37 RenderWidgetHostDelegate* render_widget_delegate, | 38 RenderWidgetHostDelegate* render_widget_delegate, |
38 RenderFrameHostManager::Delegate* manager_delegate, | 39 RenderFrameHostManager::Delegate* manager_delegate, |
39 const std::string& name); | 40 const std::string& name); |
40 | 41 |
41 ~FrameTreeNode(); | 42 ~FrameTreeNode(); |
42 | 43 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 bool CommitPendingSandboxFlags(); | 104 bool CommitPendingSandboxFlags(); |
104 | 105 |
105 bool HasSameOrigin(const FrameTreeNode& node) const { | 106 bool HasSameOrigin(const FrameTreeNode& node) const { |
106 return replication_state_.origin.IsSameAs(node.replication_state_.origin); | 107 return replication_state_.origin.IsSameAs(node.replication_state_.origin); |
107 } | 108 } |
108 | 109 |
109 const FrameReplicationState& current_replication_state() const { | 110 const FrameReplicationState& current_replication_state() const { |
110 return replication_state_; | 111 return replication_state_; |
111 } | 112 } |
112 | 113 |
| 114 void set_is_loading(bool is_loading) { |
| 115 is_loading_ = is_loading; |
| 116 } |
| 117 bool is_loading() const { |
| 118 return is_loading_; |
| 119 } |
| 120 |
113 RenderFrameHostImpl* current_frame_host() const { | 121 RenderFrameHostImpl* current_frame_host() const { |
114 return render_manager_.current_frame_host(); | 122 return render_manager_.current_frame_host(); |
115 } | 123 } |
116 | 124 |
117 bool IsDescendantOf(FrameTreeNode* other) const; | 125 bool IsDescendantOf(FrameTreeNode* other) const; |
118 | 126 |
119 // Returns true if this frame is in a loading state. | |
120 bool IsLoading() const; | |
121 | |
122 // Returns the loading progress of this frame. | |
123 double GetLoadingProgress() const; | |
124 | |
125 private: | 127 private: |
126 void set_parent(FrameTreeNode* parent) { parent_ = parent; } | 128 void set_parent(FrameTreeNode* parent) { parent_ = parent; } |
127 | 129 |
128 // The next available browser-global FrameTreeNode ID. | 130 // The next available browser-global FrameTreeNode ID. |
129 static int64 next_frame_tree_node_id_; | 131 static int64 next_frame_tree_node_id_; |
130 | 132 |
131 // The FrameTree that owns us. | 133 // The FrameTree that owns us. |
132 FrameTree* frame_tree_; // not owned. | 134 FrameTree* frame_tree_; // not owned. |
133 | 135 |
134 // The Navigator object responsible for managing navigations at this node | 136 // The Navigator object responsible for managing navigations at this node |
135 // of the frame tree. | 137 // of the frame tree. |
136 scoped_refptr<Navigator> navigator_; | 138 scoped_refptr<Navigator> navigator_; |
137 | 139 |
138 // Manages creation and swapping of RenderFrameHosts for this frame. This | 140 // Manages creation and swapping of RenderFrameHosts for this frame. This |
139 // must be declared before |children_| so that it gets deleted after them. | 141 // must be declared before |children_| so that it gets deleted after them. |
140 // That's currently necessary so that RenderFrameHostImpl's destructor can | 142 // That's currently necessary so that RenderFrameHostImpl's destructor can |
141 // call GetProcess. | 143 // call GetProcess. |
142 RenderFrameHostManager render_manager_; | 144 RenderFrameHostManager render_manager_; |
143 | 145 |
144 // A browser-global identifier for the frame in the page, which stays stable | 146 // A browser-global identifier for the frame in the page, which stays stable |
145 // even if the frame does a cross-process navigation. | 147 // even if the frame does a cross-process navigation. |
146 const int64 frame_tree_node_id_; | 148 const int64 frame_tree_node_id_; |
147 | 149 |
148 // The parent node of this frame. NULL if this node is the root or if it has | 150 // The parent node of this frame. NULL if this node is the root or if it has |
149 // not yet been attached to the frame tree. | 151 // not yet been attached to the frame tree. |
150 FrameTreeNode* parent_; | 152 FrameTreeNode* parent_; |
(...skipping 14 matching lines...) Expand all Loading... |
165 // Track the effective sandbox flags for this frame. When a parent frame | 167 // Track the effective sandbox flags for this frame. When a parent frame |
166 // dynamically updates sandbox flags for a child frame, the child's updated | 168 // dynamically updates sandbox flags for a child frame, the child's updated |
167 // sandbox flags are stored in replication_state_.sandbox_flags. However, the | 169 // sandbox flags are stored in replication_state_.sandbox_flags. However, the |
168 // update only takes effect on the next frame navigation, so the effective | 170 // update only takes effect on the next frame navigation, so the effective |
169 // sandbox flags are tracked separately here. When enforcing sandbox flags | 171 // sandbox flags are tracked separately here. When enforcing sandbox flags |
170 // directives in the browser process, |effective_sandbox_flags_| should be | 172 // directives in the browser process, |effective_sandbox_flags_| should be |
171 // used. |effective_sandbox_flags_| is updated with any pending sandbox | 173 // used. |effective_sandbox_flags_| is updated with any pending sandbox |
172 // flags when a navigation for this frame commits. | 174 // flags when a navigation for this frame commits. |
173 SandboxFlags effective_sandbox_flags_; | 175 SandboxFlags effective_sandbox_flags_; |
174 | 176 |
| 177 // Boolean value indicating whether the frame is in the process of loading |
| 178 // a document or not. In cross-process transfer navigation the DidStartLoading |
| 179 // message is received from both existing RenderFrame and from the pending |
| 180 // RenderFrame. However, there will be only one DidStopLoading message sent by |
| 181 // the pending-which-becomes-current RenderFrame. Since both renderers belong |
| 182 // to the FrameTreeNode, it is better to ask it about the loading status than |
| 183 // RenderFrameHost or using a counter to balance the events out. |
| 184 bool is_loading_; |
| 185 |
175 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); | 186 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); |
176 }; | 187 }; |
177 | 188 |
178 } // namespace content | 189 } // namespace content |
179 | 190 |
180 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ | 191 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ |
OLD | NEW |