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/render_frame_host_impl.h" | 14 #include "content/browser/frame_host/render_frame_host_impl.h" |
15 #include "content/browser/frame_host/render_frame_host_manager.h" | 15 #include "content/browser/frame_host/render_frame_host_manager.h" |
16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
17 #include "content/common/frame_replication_state.h" | 17 #include "content/common/frame_replication_state.h" |
18 #include "url/gurl.h" | 18 #include "url/gurl.h" |
19 #include "url/origin.h" | 19 #include "url/origin.h" |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 | 22 |
23 class FrameTree; | 23 class FrameTree; |
24 class Navigator; | 24 class Navigator; |
25 class RenderFrameHostImpl; | 25 class RenderFrameHostImpl; |
26 | 26 |
27 // These values indicate the loading progress status. | |
28 // The minimum progress vlaue matches what Blink's ProgressTracker has | |
clamy
2015/02/16 14:20:59
nit: s/vlaue/value
Also I don't think that a line
Fabrice (no longer in Chrome)
2015/02/20 12:58:58
Done.
| |
29 // traditionally used for a minimum progress value. | |
30 const double kNotStartedLoadingProgress = 0.0; | |
clamy
2015/02/16 14:20:59
So I've found an example of const values in the co
Fabrice (no longer in Chrome)
2015/02/20 12:58:58
Done.
| |
31 const double kMinimumLoadingProgress = 0.1; | |
32 const double kDoneLoadingProgress = 1.0; | |
33 | |
27 // When a page contains iframes, its renderer process maintains a tree structure | 34 // 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 | 35 // 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 | 36 // class represents a node in this tree and is a wrapper for all objects that |
30 // are frame-specific (as opposed to page-specific). | 37 // are frame-specific (as opposed to page-specific). |
31 class CONTENT_EXPORT FrameTreeNode { | 38 class CONTENT_EXPORT FrameTreeNode { |
32 public: | 39 public: |
33 | 40 |
34 FrameTreeNode(FrameTree* frame_tree, | 41 FrameTreeNode(FrameTree* frame_tree, |
35 Navigator* navigator, | 42 Navigator* navigator, |
36 RenderFrameHostDelegate* render_frame_delegate, | 43 RenderFrameHostDelegate* render_frame_delegate, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 return replication_state_.origin.IsSameAs(node.replication_state_.origin); | 108 return replication_state_.origin.IsSameAs(node.replication_state_.origin); |
102 } | 109 } |
103 | 110 |
104 const FrameReplicationState& current_replication_state() const { | 111 const FrameReplicationState& current_replication_state() const { |
105 return replication_state_; | 112 return replication_state_; |
106 } | 113 } |
107 | 114 |
108 void set_is_loading(bool is_loading) { | 115 void set_is_loading(bool is_loading) { |
109 is_loading_ = is_loading; | 116 is_loading_ = is_loading; |
110 } | 117 } |
118 | |
111 bool is_loading() const { | 119 bool is_loading() const { |
112 return is_loading_; | 120 return is_loading_; |
113 } | 121 } |
114 | 122 |
123 void set_loading_progress(double loading_progress) { | |
124 loading_progress_ = loading_progress; | |
125 } | |
126 | |
127 double get_loading_progress() const { return loading_progress_; } | |
128 | |
115 RenderFrameHostImpl* current_frame_host() const { | 129 RenderFrameHostImpl* current_frame_host() const { |
116 return render_manager_.current_frame_host(); | 130 return render_manager_.current_frame_host(); |
117 } | 131 } |
118 | 132 |
119 bool IsDescendantOf(FrameTreeNode* other) const; | 133 bool IsDescendantOf(FrameTreeNode* other) const; |
120 | 134 |
121 private: | 135 private: |
122 void set_parent(FrameTreeNode* parent) { parent_ = parent; } | 136 void set_parent(FrameTreeNode* parent) { parent_ = parent; } |
123 | 137 |
124 // The next available browser-global FrameTreeNode ID. | 138 // The next available browser-global FrameTreeNode ID. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 | 174 |
161 // Boolean value indicating whether the frame is in the process of loading | 175 // Boolean value indicating whether the frame is in the process of loading |
162 // a document or not. In cross-process transfer navigation the DidStartLoading | 176 // a document or not. In cross-process transfer navigation the DidStartLoading |
163 // message is received from both existing RenderFrame and from the pending | 177 // message is received from both existing RenderFrame and from the pending |
164 // RenderFrame. However, there will be only one DidStopLoading message sent by | 178 // RenderFrame. However, there will be only one DidStopLoading message sent by |
165 // the pending-which-becomes-current RenderFrame. Since both renderers belong | 179 // 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 | 180 // 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. | 181 // RenderFrameHost or using a counter to balance the events out. |
168 bool is_loading_; | 182 bool is_loading_; |
169 | 183 |
184 // Double value representing the frame's completion progress (from 0 to 1). | |
185 double loading_progress_; | |
186 | |
170 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); | 187 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); |
171 }; | 188 }; |
172 | 189 |
173 } // namespace content | 190 } // namespace content |
174 | 191 |
175 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ | 192 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ |
OLD | NEW |