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 // TODO(fdegans): Move these values to the implementation when the relevant | |
37 // IPCs are moved from WebContentsImpl to RenderFrameHost. | |
38 static const double kLoadingProgressNotStarted; | |
39 static const double kLoadingProgressMinimum; | |
40 static const double kLoadingProgressDone; | |
41 | |
42 // Returns the FrameTreeNode with the given global |frame_tree_node_id|, | 33 // Returns the FrameTreeNode with the given global |frame_tree_node_id|, |
43 // regardless of which FrameTree it is in. | 34 // regardless of which FrameTree it is in. |
44 static FrameTreeNode* GloballyFindByID(int64 frame_tree_node_id); | 35 static FrameTreeNode* GloballyFindByID(int64 frame_tree_node_id); |
45 | 36 |
46 FrameTreeNode(FrameTree* frame_tree, | 37 FrameTreeNode(FrameTree* frame_tree, |
47 Navigator* navigator, | 38 Navigator* navigator, |
48 RenderFrameHostDelegate* render_frame_delegate, | 39 RenderFrameHostDelegate* render_frame_delegate, |
49 RenderViewHostDelegate* render_view_delegate, | 40 RenderViewHostDelegate* render_view_delegate, |
50 RenderWidgetHostDelegate* render_widget_delegate, | 41 RenderWidgetHostDelegate* render_widget_delegate, |
51 RenderFrameHostManager::Delegate* manager_delegate, | 42 RenderFrameHostManager::Delegate* manager_delegate, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 118 |
128 RenderFrameHostImpl* current_frame_host() const { | 119 RenderFrameHostImpl* current_frame_host() const { |
129 return render_manager_.current_frame_host(); | 120 return render_manager_.current_frame_host(); |
130 } | 121 } |
131 | 122 |
132 bool IsDescendantOf(FrameTreeNode* other) const; | 123 bool IsDescendantOf(FrameTreeNode* other) const; |
133 | 124 |
134 // Returns true if this node is in a loading state. | 125 // Returns true if this node is in a loading state. |
135 bool IsLoading() const; | 126 bool IsLoading() const; |
136 | 127 |
137 // Sets this node's loading progress (from 0 to 1). | |
138 void set_loading_progress(double loading_progress) { | |
139 loading_progress_ = loading_progress; | |
140 } | |
141 | |
142 // Returns this node's loading progress. | 128 // Returns this node's loading progress. |
143 double loading_progress() const { return loading_progress_; } | 129 double loading_progress() const { return loading_progress_; } |
144 | 130 |
| 131 // Returns true if this node has started loading. |
| 132 bool HasStartedLoading() const; |
| 133 |
| 134 // Resets this node's loading progress. |
| 135 void ResetLoadingProgress(); |
| 136 |
| 137 // A RenderFrame in this node started loading. |
| 138 // |to_different_document| will be true unless the load is a fragment |
| 139 // navigation, or triggered by history.pushState/replaceState. |
| 140 void DidStartLoading(bool to_different_document); |
| 141 |
| 142 // A RenderFrame in this node stopped loading. |
| 143 void DidStopLoading(); |
| 144 |
| 145 // The load progress for a RenderFrame in this node was updated to |
| 146 // |load_progress|. |
| 147 void DidChangeLoadProgress(double load_progress); |
| 148 |
145 private: | 149 private: |
146 void set_parent(FrameTreeNode* parent) { parent_ = parent; } | 150 void set_parent(FrameTreeNode* parent) { parent_ = parent; } |
147 | 151 |
148 // The next available browser-global FrameTreeNode ID. | 152 // The next available browser-global FrameTreeNode ID. |
149 static int64 next_frame_tree_node_id_; | 153 static int64 next_frame_tree_node_id_; |
150 | 154 |
151 // The FrameTree that owns us. | 155 // The FrameTree that owns us. |
152 FrameTree* frame_tree_; // not owned. | 156 FrameTree* frame_tree_; // not owned. |
153 | 157 |
154 // The Navigator object responsible for managing navigations at this node | 158 // The Navigator object responsible for managing navigations at this node |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 198 |
195 // Used to track this node's loading progress (from 0 to 1). | 199 // Used to track this node's loading progress (from 0 to 1). |
196 double loading_progress_; | 200 double loading_progress_; |
197 | 201 |
198 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); | 202 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); |
199 }; | 203 }; |
200 | 204 |
201 } // namespace content | 205 } // namespace content |
202 | 206 |
203 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ | 207 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ |
OLD | NEW |