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 NavigationRequest; | |
25 class Navigator; | 24 class Navigator; |
26 class RenderFrameHostImpl; | 25 class RenderFrameHostImpl; |
27 | 26 |
28 // 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 |
29 // 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 |
30 // 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 |
31 // are frame-specific (as opposed to page-specific). | 30 // are frame-specific (as opposed to page-specific). |
32 class CONTENT_EXPORT FrameTreeNode { | 31 class CONTENT_EXPORT FrameTreeNode { |
33 public: | 32 public: |
34 // These values indicate the loading progress status. The minimum progress | 33 // These values indicate the loading progress status. The minimum progress |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 bool IsLoading() const; | 135 bool IsLoading() const; |
137 | 136 |
138 // Sets this node's loading progress (from 0 to 1). | 137 // Sets this node's loading progress (from 0 to 1). |
139 void set_loading_progress(double loading_progress) { | 138 void set_loading_progress(double loading_progress) { |
140 loading_progress_ = loading_progress; | 139 loading_progress_ = loading_progress; |
141 } | 140 } |
142 | 141 |
143 // Returns this node's loading progress. | 142 // Returns this node's loading progress. |
144 double loading_progress() const { return loading_progress_; } | 143 double loading_progress() const { return loading_progress_; } |
145 | 144 |
146 NavigationRequest* navigation_request() { return navigation_request_.get(); } | |
147 | |
148 // PlzNavigate | |
149 // Takes ownership of |navigation_request| and makes it the current | |
150 // NavigationRequest of this frame. This corresponds to the start of a new | |
151 // navigation. If there was an ongoing navigation request before calling this | |
152 // function, it is canceled. |navigation_request| should not be null. | |
153 void SetNavigationRequest(scoped_ptr<NavigationRequest> navigation_request); | |
154 | |
155 // PlzNavigate | |
156 // Resets the current navigation request. |is_commit| is true if the reset is | |
157 // due to the commit of the navigation. | |
158 void ResetNavigationRequest(bool is_commit); | |
159 | |
160 private: | 145 private: |
161 void set_parent(FrameTreeNode* parent) { parent_ = parent; } | 146 void set_parent(FrameTreeNode* parent) { parent_ = parent; } |
162 | 147 |
163 // The next available browser-global FrameTreeNode ID. | 148 // The next available browser-global FrameTreeNode ID. |
164 static int64 next_frame_tree_node_id_; | 149 static int64 next_frame_tree_node_id_; |
165 | 150 |
166 // The FrameTree that owns us. | 151 // The FrameTree that owns us. |
167 FrameTree* frame_tree_; // not owned. | 152 FrameTree* frame_tree_; // not owned. |
168 | 153 |
169 // The Navigator object responsible for managing navigations at this node | 154 // The Navigator object responsible for managing navigations at this node |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // 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 |
204 // sandbox flags are tracked separately here. When enforcing sandbox flags | 189 // sandbox flags are tracked separately here. When enforcing sandbox flags |
205 // directives in the browser process, |effective_sandbox_flags_| should be | 190 // directives in the browser process, |effective_sandbox_flags_| should be |
206 // used. |effective_sandbox_flags_| is updated with any pending sandbox | 191 // used. |effective_sandbox_flags_| is updated with any pending sandbox |
207 // flags when a navigation for this frame commits. | 192 // flags when a navigation for this frame commits. |
208 SandboxFlags effective_sandbox_flags_; | 193 SandboxFlags effective_sandbox_flags_; |
209 | 194 |
210 // Used to track this node's loading progress (from 0 to 1). | 195 // Used to track this node's loading progress (from 0 to 1). |
211 double loading_progress_; | 196 double loading_progress_; |
212 | 197 |
213 // PlzNavigate | |
214 // Owns an ongoing NavigationRequest until it is ready to commit. It will then | |
215 // be reset and a RenderFrameHost will be responsible for the navigation. | |
216 scoped_ptr<NavigationRequest> navigation_request_; | |
217 | |
218 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); | 198 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); |
219 }; | 199 }; |
220 | 200 |
221 } // namespace content | 201 } // namespace content |
222 | 202 |
223 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ | 203 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ |
OLD | NEW |