Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: content/browser/frame_host/frame_tree_node.h

Issue 989473003: Reland of Refactor the loading tracking logic in WebContentsImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert change + nits Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/frame_host/frame_tree_node.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
34 FrameTreeNode(FrameTree* frame_tree, 33 FrameTreeNode(FrameTree* frame_tree,
35 Navigator* navigator, 34 Navigator* navigator,
36 RenderFrameHostDelegate* render_frame_delegate, 35 RenderFrameHostDelegate* render_frame_delegate,
37 RenderViewHostDelegate* render_view_delegate, 36 RenderViewHostDelegate* render_view_delegate,
38 RenderWidgetHostDelegate* render_widget_delegate, 37 RenderWidgetHostDelegate* render_widget_delegate,
39 RenderFrameHostManager::Delegate* manager_delegate, 38 RenderFrameHostManager::Delegate* manager_delegate,
40 const std::string& name); 39 const std::string& name);
41 40
42 ~FrameTreeNode(); 41 ~FrameTreeNode();
43 42
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 bool CommitPendingSandboxFlags(); 105 bool CommitPendingSandboxFlags();
107 106
108 bool HasSameOrigin(const FrameTreeNode& node) const { 107 bool HasSameOrigin(const FrameTreeNode& node) const {
109 return replication_state_.origin.IsSameAs(node.replication_state_.origin); 108 return replication_state_.origin.IsSameAs(node.replication_state_.origin);
110 } 109 }
111 110
112 const FrameReplicationState& current_replication_state() const { 111 const FrameReplicationState& current_replication_state() const {
113 return replication_state_; 112 return replication_state_;
114 } 113 }
115 114
116 void set_is_loading(bool is_loading) {
117 is_loading_ = is_loading;
118 }
119 bool is_loading() const {
120 return is_loading_;
121 }
122
123 RenderFrameHostImpl* current_frame_host() const { 115 RenderFrameHostImpl* current_frame_host() const {
124 return render_manager_.current_frame_host(); 116 return render_manager_.current_frame_host();
125 } 117 }
126 118
127 bool IsDescendantOf(FrameTreeNode* other) const; 119 bool IsDescendantOf(FrameTreeNode* other) const;
128 120
121 // Returns true if this frame is in a loading state.
122 bool IsLoading() const;
123
124 // Returns the loading progress of this frame.
125 double GetLoadingProgress() const;
126
129 private: 127 private:
130 void set_parent(FrameTreeNode* parent) { parent_ = parent; } 128 void set_parent(FrameTreeNode* parent) { parent_ = parent; }
131 129
132 // The next available browser-global FrameTreeNode ID. 130 // The next available browser-global FrameTreeNode ID.
133 static int64 next_frame_tree_node_id_; 131 static int64 next_frame_tree_node_id_;
134 132
135 // The FrameTree that owns us. 133 // The FrameTree that owns us.
136 FrameTree* frame_tree_; // not owned. 134 FrameTree* frame_tree_; // not owned.
137 135
138 // The Navigator object responsible for managing navigations at this node 136 // The Navigator object responsible for managing navigations at this node
139 // of the frame tree. 137 // of the frame tree.
140 scoped_refptr<Navigator> navigator_; 138 scoped_refptr<Navigator> navigator_;
141 139
142 // Manages creation and swapping of RenderFrameHosts for this frame. This 140 // Manages creation and swapping of RenderFrameHosts for this frame. This
143 // 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.
144 // That's currently necessary so that RenderFrameHostImpl's destructor can 142 // That's currently necessary so that RenderFrameHostImpl's destructor can
145 // call GetProcess. 143 // call GetProcess.
146 RenderFrameHostManager render_manager_; 144 RenderFrameHostManager render_manager_;
147 145
148 // 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
149 // even if the frame does a cross-process navigation. 147 // even if the frame does a cross-process navigation.
150 const int64 frame_tree_node_id_; 148 const int64 frame_tree_node_id_;
151 149
152 // 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
153 // not yet been attached to the frame tree. 151 // not yet been attached to the frame tree.
154 FrameTreeNode* parent_; 152 FrameTreeNode* parent_;
(...skipping 14 matching lines...) Expand all
169 // 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
170 // 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
171 // sandbox flags are stored in replication_state_.sandbox_flags. However, the 169 // sandbox flags are stored in replication_state_.sandbox_flags. However, the
172 // 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
173 // sandbox flags are tracked separately here. When enforcing sandbox flags 171 // sandbox flags are tracked separately here. When enforcing sandbox flags
174 // directives in the browser process, |effective_sandbox_flags_| should be 172 // directives in the browser process, |effective_sandbox_flags_| should be
175 // used. |effective_sandbox_flags_| is updated with any pending sandbox 173 // used. |effective_sandbox_flags_| is updated with any pending sandbox
176 // flags when a navigation for this frame commits. 174 // flags when a navigation for this frame commits.
177 SandboxFlags effective_sandbox_flags_; 175 SandboxFlags effective_sandbox_flags_;
178 176
179 // Boolean value indicating whether the frame is in the process of loading
180 // a document or not. In cross-process transfer navigation the DidStartLoading
181 // message is received from both existing RenderFrame and from the pending
182 // RenderFrame. However, there will be only one DidStopLoading message sent by
183 // the pending-which-becomes-current RenderFrame. Since both renderers belong
184 // to the FrameTreeNode, it is better to ask it about the loading status than
185 // RenderFrameHost or using a counter to balance the events out.
186 bool is_loading_;
187
188 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); 177 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode);
189 }; 178 };
190 179
191 } // namespace content 180 } // namespace content
192 181
193 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ 182 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/frame_tree_node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698