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 | |
clamy
2015/03/24 14:52:23
Is this TODO still relevant?
Fabrice (no longer in Chrome)
2015/03/24 16:28:50
No it isn't, unless we want to add interface metho
| |
37 // IPCs are moved from WebContentsImpl to RenderFrameHost. | |
38 static const double kLoadingProgressNotStarted; | |
39 static const double kLoadingProgressMinimum; | |
40 static const double kLoadingProgressDone; | |
41 | |
33 // Returns the FrameTreeNode with the given global |frame_tree_node_id|, | 42 // Returns the FrameTreeNode with the given global |frame_tree_node_id|, |
34 // regardless of which FrameTree it is in. | 43 // regardless of which FrameTree it is in. |
35 static FrameTreeNode* GloballyFindByID(int64 frame_tree_node_id); | 44 static FrameTreeNode* GloballyFindByID(int64 frame_tree_node_id); |
36 | 45 |
37 FrameTreeNode(FrameTree* frame_tree, | 46 FrameTreeNode(FrameTree* frame_tree, |
38 Navigator* navigator, | 47 Navigator* navigator, |
39 RenderFrameHostDelegate* render_frame_delegate, | 48 RenderFrameHostDelegate* render_frame_delegate, |
40 RenderViewHostDelegate* render_view_delegate, | 49 RenderViewHostDelegate* render_view_delegate, |
41 RenderWidgetHostDelegate* render_widget_delegate, | 50 RenderWidgetHostDelegate* render_widget_delegate, |
42 RenderFrameHostManager::Delegate* manager_delegate, | 51 RenderFrameHostManager::Delegate* manager_delegate, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 const FrameReplicationState& current_replication_state() const { | 124 const FrameReplicationState& current_replication_state() const { |
116 return replication_state_; | 125 return replication_state_; |
117 } | 126 } |
118 | 127 |
119 RenderFrameHostImpl* current_frame_host() const { | 128 RenderFrameHostImpl* current_frame_host() const { |
120 return render_manager_.current_frame_host(); | 129 return render_manager_.current_frame_host(); |
121 } | 130 } |
122 | 131 |
123 bool IsDescendantOf(FrameTreeNode* other) const; | 132 bool IsDescendantOf(FrameTreeNode* other) const; |
124 | 133 |
125 // Returns true if this frame is in a loading state. | 134 // Returns true if this node is in a loading state. |
126 bool IsLoading() const; | 135 bool IsLoading() const; |
127 | 136 |
128 // Returns the loading progress of this frame. | 137 // Sets this node's loading progress (from 0 to 1). |
129 double GetLoadingProgress() const; | 138 void set_loading_progress(double loading_progress) { |
139 loading_progress_ = loading_progress; | |
140 } | |
141 | |
142 // Returns this node's loading progress. | |
143 double loading_progress() const { return loading_progress_; } | |
130 | 144 |
131 private: | 145 private: |
132 void set_parent(FrameTreeNode* parent) { parent_ = parent; } | 146 void set_parent(FrameTreeNode* parent) { parent_ = parent; } |
133 | 147 |
134 // The next available browser-global FrameTreeNode ID. | 148 // The next available browser-global FrameTreeNode ID. |
135 static int64 next_frame_tree_node_id_; | 149 static int64 next_frame_tree_node_id_; |
136 | 150 |
137 // The FrameTree that owns us. | 151 // The FrameTree that owns us. |
138 FrameTree* frame_tree_; // not owned. | 152 FrameTree* frame_tree_; // not owned. |
139 | 153 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 // Track the effective sandbox flags for this frame. When a parent frame | 185 // Track the effective sandbox flags for this frame. When a parent frame |
172 // dynamically updates sandbox flags for a child frame, the child's updated | 186 // dynamically updates sandbox flags for a child frame, the child's updated |
173 // sandbox flags are stored in replication_state_.sandbox_flags. However, the | 187 // sandbox flags are stored in replication_state_.sandbox_flags. However, the |
174 // update only takes effect on the next frame navigation, so the effective | 188 // update only takes effect on the next frame navigation, so the effective |
175 // sandbox flags are tracked separately here. When enforcing sandbox flags | 189 // sandbox flags are tracked separately here. When enforcing sandbox flags |
176 // directives in the browser process, |effective_sandbox_flags_| should be | 190 // directives in the browser process, |effective_sandbox_flags_| should be |
177 // used. |effective_sandbox_flags_| is updated with any pending sandbox | 191 // used. |effective_sandbox_flags_| is updated with any pending sandbox |
178 // flags when a navigation for this frame commits. | 192 // flags when a navigation for this frame commits. |
179 SandboxFlags effective_sandbox_flags_; | 193 SandboxFlags effective_sandbox_flags_; |
180 | 194 |
195 // Used to track this node's loading progress (from 0 to 1). | |
196 double loading_progress_; | |
197 | |
181 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); | 198 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); |
182 }; | 199 }; |
183 | 200 |
184 } // namespace content | 201 } // namespace content |
185 | 202 |
186 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ | 203 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ |
OLD | NEW |