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 // These values indicate the loading progress status. The minimum progress | |
34 // value matches what Blink's ProgressTracker has traditionally used for a | |
35 // minimum progress value. | |
36 static const double kLoadingProgressNotStarted; | |
37 static const double kLoadingProgressMinimum; | |
38 static const double kLoadingProgressDone; | |
33 | 39 |
34 FrameTreeNode(FrameTree* frame_tree, | 40 FrameTreeNode(FrameTree* frame_tree, |
35 Navigator* navigator, | 41 Navigator* navigator, |
36 RenderFrameHostDelegate* render_frame_delegate, | 42 RenderFrameHostDelegate* render_frame_delegate, |
37 RenderViewHostDelegate* render_view_delegate, | 43 RenderViewHostDelegate* render_view_delegate, |
38 RenderWidgetHostDelegate* render_widget_delegate, | 44 RenderWidgetHostDelegate* render_widget_delegate, |
39 RenderFrameHostManager::Delegate* manager_delegate, | 45 RenderFrameHostManager::Delegate* manager_delegate, |
40 const std::string& name); | 46 const std::string& name); |
41 | 47 |
42 ~FrameTreeNode(); | 48 ~FrameTreeNode(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 return replication_state_.origin.IsSameAs(node.replication_state_.origin); | 107 return replication_state_.origin.IsSameAs(node.replication_state_.origin); |
102 } | 108 } |
103 | 109 |
104 const FrameReplicationState& current_replication_state() const { | 110 const FrameReplicationState& current_replication_state() const { |
105 return replication_state_; | 111 return replication_state_; |
106 } | 112 } |
107 | 113 |
108 void set_is_loading(bool is_loading) { | 114 void set_is_loading(bool is_loading) { |
109 is_loading_ = is_loading; | 115 is_loading_ = is_loading; |
110 } | 116 } |
117 | |
111 bool is_loading() const { | 118 bool is_loading() const { |
112 return is_loading_; | 119 return is_loading_; |
113 } | 120 } |
114 | 121 |
122 void set_loading_progress(double loading_progress) { | |
123 loading_progress_ = loading_progress; | |
124 } | |
125 | |
126 double loading_progress() const { return loading_progress_; } | |
127 | |
128 void set_pending_frame_host(RenderFrameHostImpl* rfh) { | |
129 pending_frame_host_ = rfh; | |
130 } | |
131 | |
132 RenderFrameHostImpl* pending_frame_host() const { | |
133 return pending_frame_host_; | |
134 } | |
135 | |
115 RenderFrameHostImpl* current_frame_host() const { | 136 RenderFrameHostImpl* current_frame_host() const { |
116 return render_manager_.current_frame_host(); | 137 return render_manager_.current_frame_host(); |
117 } | 138 } |
118 | 139 |
119 bool IsDescendantOf(FrameTreeNode* other) const; | 140 bool IsDescendantOf(FrameTreeNode* other) const; |
120 | 141 |
121 private: | 142 private: |
122 void set_parent(FrameTreeNode* parent) { parent_ = parent; } | 143 void set_parent(FrameTreeNode* parent) { parent_ = parent; } |
123 | 144 |
124 // The next available browser-global FrameTreeNode ID. | 145 // The next available browser-global FrameTreeNode ID. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 | 181 |
161 // Boolean value indicating whether the frame is in the process of loading | 182 // Boolean value indicating whether the frame is in the process of loading |
162 // a document or not. In cross-process transfer navigation the DidStartLoading | 183 // a document or not. In cross-process transfer navigation the DidStartLoading |
163 // message is received from both existing RenderFrame and from the pending | 184 // message is received from both existing RenderFrame and from the pending |
164 // RenderFrame. However, there will be only one DidStopLoading message sent by | 185 // RenderFrame. However, there will be only one DidStopLoading message sent by |
165 // the pending-which-becomes-current RenderFrame. Since both renderers belong | 186 // the pending-which-becomes-current RenderFrame. Since both renderers belong |
166 // to the FrameTreeNode, it is better to ask it about the loading status than | 187 // to the FrameTreeNode, it is better to ask it about the loading status than |
167 // RenderFrameHost or using a counter to balance the events out. | 188 // RenderFrameHost or using a counter to balance the events out. |
168 bool is_loading_; | 189 bool is_loading_; |
169 | 190 |
191 // Double value representing the frame's completion progress (from 0 to 1). | |
nasko
2015/02/23 16:54:43
nit: s/completion/loading/
Fabrice (no longer in Chrome)
2015/02/23 20:02:06
Done.
| |
192 double loading_progress_; | |
193 | |
194 // Pending RenderFameHostImpl whose load is being tracked. | |
195 RenderFrameHostImpl* pending_frame_host_; | |
196 | |
170 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); | 197 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); |
171 }; | 198 }; |
172 | 199 |
173 } // namespace content | 200 } // namespace content |
174 | 201 |
175 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ | 202 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ |
OLD | NEW |