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

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

Issue 983973002: Revert of Refactor the loading tracking logic in WebContentsImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed patch conflict 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
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
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
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_
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