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