blob: 16fcbfb4c0b9cc0c94e720dafe1d78b78c379b88 [file] [log] [blame]
danakjc492bf82020-09-09 20:02:441// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CONTENT_BROWSER_RENDERER_HOST_FRAME_TREE_H_
6#define CONTENT_BROWSER_RENDERER_HOST_FRAME_TREE_H_
7
8#include <stdint.h>
9
10#include <iterator>
11#include <memory>
12#include <string>
13#include <unordered_map>
14
15#include "base/callback.h"
16#include "base/containers/queue.h"
Carlos Caballero101ac26b2021-03-24 11:54:0517#include "base/dcheck_is_on.h"
danakjc492bf82020-09-09 20:02:4418#include "base/gtest_prod_util.h"
19#include "base/macros.h"
20#include "content/browser/renderer_host/navigator.h"
21#include "content/browser/renderer_host/navigator_delegate.h"
22#include "content/browser/renderer_host/render_frame_host_manager.h"
23#include "content/common/content_export.h"
24#include "mojo/public/cpp/bindings/pending_receiver.h"
25#include "services/service_manager/public/mojom/interface_provider.mojom.h"
Kevin McNee43fe8292021-10-04 22:59:4126#include "third_party/blink/public/common/frame/frame_owner_element_type.h"
Chris Hamilton3ff6ed0e2021-02-19 03:54:0427#include "third_party/blink/public/common/tokens/tokens.h"
danakjc492bf82020-09-09 20:02:4428#include "third_party/blink/public/mojom/frame/frame_owner_properties.mojom-forward.h"
29
30namespace blink {
Lei Zhang4a867672021-07-19 06:30:1431namespace mojom {
32class BrowserInterfaceBroker;
33enum class TreeScopeType;
34} // namespace mojom
35
danakjc492bf82020-09-09 20:02:4436struct FramePolicy;
37} // namespace blink
38
39namespace content {
40
Carlos Caballero40b0efd2021-01-26 11:55:0041class BrowserContext;
Jeremy Roman2d8dfe132021-07-06 20:51:2642class PageDelegate;
Lei Zhang4a867672021-07-19 06:30:1443class PageImpl;
danakjc492bf82020-09-09 20:02:4444class RenderFrameHostDelegate;
45class RenderViewHostDelegate;
46class RenderViewHostImpl;
47class RenderFrameHostManager;
48class RenderWidgetHostDelegate;
Carlos Caballero40b0efd2021-01-26 11:55:0049class SiteInstance;
danakjc492bf82020-09-09 20:02:4450
51// Represents the frame tree for a page. With the exception of the main frame,
52// all FrameTreeNodes will be created/deleted in response to frame attach and
53// detach events in the DOM.
54//
55// The main frame's FrameTreeNode is special in that it is reused. This allows
56// it to serve as an anchor for state that needs to persist across top-level
57// page navigations.
58//
59// TODO(ajwong): Move NavigationController ownership to the main frame
60// FrameTreeNode. Possibly expose access to it from here.
61//
62// This object is only used on the UI thread.
63class CONTENT_EXPORT FrameTree {
64 public:
65 class NodeRange;
66
67 class CONTENT_EXPORT NodeIterator
68 : public std::iterator<std::forward_iterator_tag, FrameTreeNode> {
69 public:
70 NodeIterator(const NodeIterator& other);
71 ~NodeIterator();
72
73 NodeIterator& operator++();
Kevin McNee5f594382021-05-06 23:18:2374 // Advances the iterator and excludes the children of the current node
75 NodeIterator& AdvanceSkippingChildren();
danakjc492bf82020-09-09 20:02:4476
77 bool operator==(const NodeIterator& rhs) const;
78 bool operator!=(const NodeIterator& rhs) const { return !(*this == rhs); }
79
80 FrameTreeNode* operator*() { return current_node_; }
81
82 private:
Jayson Adams4db0bfe22021-07-15 19:24:0783 friend class FrameTreeTest;
danakjc492bf82020-09-09 20:02:4484 friend class NodeRange;
85
Kevin McNee5f594382021-05-06 23:18:2386 NodeIterator(const std::vector<FrameTreeNode*>& starting_nodes,
87 const FrameTreeNode* root_of_subtree_to_skip,
88 bool should_descend_into_inner_trees);
89
90 void AdvanceNode();
danakjc492bf82020-09-09 20:02:4491
92 FrameTreeNode* current_node_;
Kevin McNee5f594382021-05-06 23:18:2393 const FrameTreeNode* const root_of_subtree_to_skip_;
94 const bool should_descend_into_inner_trees_;
Jayson Adams4db0bfe22021-07-15 19:24:0795 base::circular_deque<FrameTreeNode*> queue_;
danakjc492bf82020-09-09 20:02:4496 };
97
98 class CONTENT_EXPORT NodeRange {
99 public:
Kevin McNee5f594382021-05-06 23:18:23100 NodeRange(const NodeRange&);
101 ~NodeRange();
102
danakjc492bf82020-09-09 20:02:44103 NodeIterator begin();
104 NodeIterator end();
105
106 private:
107 friend class FrameTree;
108
Kevin McNee5f594382021-05-06 23:18:23109 NodeRange(const std::vector<FrameTreeNode*>& starting_nodes,
110 const FrameTreeNode* root_of_subtree_to_skip,
111 bool should_descend_into_inner_trees);
danakjc492bf82020-09-09 20:02:44112
Kevin McNee5f594382021-05-06 23:18:23113 const std::vector<FrameTreeNode*> starting_nodes_;
114 const FrameTreeNode* const root_of_subtree_to_skip_;
115 const bool should_descend_into_inner_trees_;
danakjc492bf82020-09-09 20:02:44116 };
117
Carlos Caballero03262522021-02-05 14:49:58118 class CONTENT_EXPORT Delegate {
119 public:
120 // A RenderFrameHost in the specified |frame_tree_node| started loading a
121 // new document. This corresponds to browser UI starting to show a spinner
122 // or other visual indicator for loading. This method is only invoked if the
123 // FrameTree hadn't been previously loading. |to_different_document| will be
124 // true unless the load is a fragment navigation, or triggered by
125 // history.pushState/replaceState.
126 virtual void DidStartLoading(FrameTreeNode* frame_tree_node,
127 bool to_different_document) = 0;
128
Takashi Toyoshima74090df62021-03-09 14:34:57129 // This is called when all nodes in the FrameTree stopped loading. This
Carlos Caballero03262522021-02-05 14:49:58130 // corresponds to the browser UI stop showing a spinner or other visual
131 // indicator for loading.
132 virtual void DidStopLoading() = 0;
133
134 // The load progress was changed.
135 virtual void DidChangeLoadProgress() = 0;
Carlos Caballero6ff6ace2021-02-05 16:53:00136
137 // Returns true when the active RenderWidgetHostView should be hidden.
138 virtual bool IsHidden() = 0;
Sreeja Kamishettya21b4f62021-06-25 07:48:25139
Sreeja Kamishetty53468972021-07-13 11:53:32140 // Called when current Page of this frame tree changes to `page`.
141 virtual void NotifyPageChanged(PageImpl& page) = 0;
Dominic Farolinoedf44ee2021-07-20 23:50:59142
143 // If the FrameTree using this delegate is an inner/nested FrameTree, then
144 // there may be a FrameTreeNode in the outer FrameTree that is considered
145 // our outer delegate FrameTreeNode. This method returns the outer delegate
146 // FrameTreeNode ID if one exists. If we don't have a an outer delegate
147 // FrameTreeNode, this method returns
148 // FrameTreeNode::kFrameTreeNodeInvalidId.
149 virtual int GetOuterDelegateFrameTreeNodeId() = 0;
Carlos Caballero03262522021-02-05 14:49:58150 };
151
Sreeja Kamishetty74bacd522021-03-22 17:04:24152 // Type of FrameTree instance.
153 enum class Type {
154 // This FrameTree is the primary frame tree for the WebContents, whose main
155 // document URL is shown in the Omnibox.
156 kPrimary,
157
158 // This FrameTree is used to prerender a page in the background which is
159 // invisible to the user.
Dominic Farolino4bc10ee2021-08-31 00:37:36160 kPrerender,
161
162 // This FrameTree is used to host the contents of a <fencedframe> element.
163 // Even for <fencedframe>s hosted inside a prerendered page, the FrameTree
164 // associated with the fenced frame will be kFencedFrame, but the
165 // RenderFrameHosts inside of it will have their lifecycle state set to
166 // `RenderFrameHost::LifecycleState::kActive`.
167 //
168 // TODO(crbug.com/1232528, crbug.com/1244274): We should either:
169 // * Fully support nested FrameTrees inside prerendered pages, in which
170 // case all of the RenderFrameHosts inside the nested trees should have
171 // their lifecycle state set to kPrerendering, or...
172 // * Ban nested FrameTrees in prerendered pages, and therefore obsolete the
173 // above paragraph about <fencedframe>s hosted in prerendered pages.
174 kFencedFrame
Sreeja Kamishetty74bacd522021-03-22 17:04:24175 };
Sreeja Kamishetty837a10402021-04-23 12:41:59176
177 // A set of delegates are remembered here so that we can create
178 // RenderFrameHostManagers.
179 FrameTree(BrowserContext* browser_context,
180 Delegate* delegate,
181 NavigationControllerDelegate* navigation_controller_delegate,
182 NavigatorDelegate* navigator_delegate,
183 RenderFrameHostDelegate* render_frame_delegate,
184 RenderViewHostDelegate* render_view_delegate,
185 RenderWidgetHostDelegate* render_widget_delegate,
186 RenderFrameHostManager::Delegate* manager_delegate,
Jeremy Roman2d8dfe132021-07-06 20:51:26187 PageDelegate* page_delegate,
Sreeja Kamishetty837a10402021-04-23 12:41:59188 Type type);
Peter Boström828b9022021-09-21 02:28:43189
190 FrameTree(const FrameTree&) = delete;
191 FrameTree& operator=(const FrameTree&) = delete;
192
Sreeja Kamishetty837a10402021-04-23 12:41:59193 ~FrameTree();
Sreeja Kamishetty74bacd522021-03-22 17:04:24194
Carlos Caballero40b0efd2021-01-26 11:55:00195 // Initializes the main frame for this FrameTree. That is it creates the
196 // initial RenderFrameHost in the root node's RenderFrameHostManager. This
197 // method will call back into the delegates so it should only be called once
198 // they have completed their initialization.
199 // TODO(carlscab): It would be great if initialization could happened in the
200 // constructor so we do not leave objects in a half initialized state.
201 void Init(SiteInstance* main_frame_site_instance,
202 bool renderer_initiated_creation,
Sreeja Kamishetty837a10402021-04-23 12:41:59203 const std::string& main_frame_name);
204
205 Type type() const { return type_; }
Carlos Caballero40b0efd2021-01-26 11:55:00206
danakjc492bf82020-09-09 20:02:44207 FrameTreeNode* root() const { return root_; }
208
Sreeja Kamishetty74bacd522021-03-22 17:04:24209 bool is_prerendering() const { return type_ == FrameTree::Type::kPrerender; }
Sreeja Kamishetty46f762c2021-02-05 07:52:46210
Carlos Caballero03262522021-02-05 14:49:58211 Delegate* delegate() { return delegate_; }
212
Jeremy Roman2d8dfe132021-07-06 20:51:26213 // Delegates for various objects. These can be kept centrally on the
214 // FrameTree because they are expected to be the same for all frames on a
215 // given FrameTree.
danakjc492bf82020-09-09 20:02:44216 RenderFrameHostDelegate* render_frame_delegate() {
217 return render_frame_delegate_;
218 }
219 RenderViewHostDelegate* render_view_delegate() {
220 return render_view_delegate_;
221 }
222 RenderWidgetHostDelegate* render_widget_delegate() {
223 return render_widget_delegate_;
224 }
225 RenderFrameHostManager::Delegate* manager_delegate() {
226 return manager_delegate_;
227 }
Jeremy Roman2d8dfe132021-07-06 20:51:26228 PageDelegate* page_delegate() { return page_delegate_; }
Aaron Colwell78b4bde2021-03-16 16:16:09229
Albert J. Wong1b6dc962021-07-09 18:06:57230 using RenderViewHostMapId = base::IdType32<class RenderViewHostMap>;
Aaron Colwell78b4bde2021-03-16 16:16:09231 using RenderViewHostMap = std::unordered_map<RenderViewHostMapId,
232 RenderViewHostImpl*,
233 RenderViewHostMapId::Hasher>;
234 const RenderViewHostMap& render_view_hosts() const {
danakjc492bf82020-09-09 20:02:44235 return render_view_host_map_;
236 }
237
238 // Returns the FrameTreeNode with the given |frame_tree_node_id| if it is part
239 // of this FrameTree.
240 FrameTreeNode* FindByID(int frame_tree_node_id);
241
242 // Returns the FrameTreeNode with the given renderer-specific |routing_id|.
243 FrameTreeNode* FindByRoutingID(int process_id, int routing_id);
244
245 // Returns the first frame in this tree with the given |name|, or the main
246 // frame if |name| is empty.
247 // Note that this does NOT support pseudo-names like _self, _top, and _blank,
248 // nor searching other FrameTrees (unlike blink::WebView::findFrameByName).
249 FrameTreeNode* FindByName(const std::string& name);
250
251 // Returns a range to iterate over all FrameTreeNodes in the frame tree in
252 // breadth-first traversal order.
253 NodeRange Nodes();
254
255 // Returns a range to iterate over all FrameTreeNodes in a subtree of the
256 // frame tree, starting from |subtree_root|.
257 NodeRange SubtreeNodes(FrameTreeNode* subtree_root);
258
Kevin McNee5f594382021-05-06 23:18:23259 // Returns a range to iterate over all FrameTreeNodes in a subtree, starting
260 // from, but not including |parent|, as well as any FrameTreeNodes of inner
261 // frame trees.
262 static NodeRange SubtreeAndInnerTreeNodes(RenderFrameHostImpl* parent);
263
danakjc492bf82020-09-09 20:02:44264 // Adds a new child frame to the frame tree. |process_id| is required to
265 // disambiguate |new_routing_id|, and it must match the process of the
Kevin McNee43fe8292021-10-04 22:59:41266 // |parent| node. Otherwise no child is added and this method returns nullptr.
danakjc492bf82020-09-09 20:02:44267 // |interface_provider_receiver| is the receiver end of the InterfaceProvider
268 // interface through which the child RenderFrame can access Mojo services
269 // exposed by the corresponding RenderFrameHost. The caller takes care of
Antonio Sartoridb967c52021-01-20 09:54:30270 // sending the client end of the interface down to the
271 // RenderFrame. |policy_container_bind_params|, if not null, is used for
272 // binding Blink's policy container to the new RenderFrameHost's
273 // PolicyContainerHost. This is only needed if this frame is the result of the
274 // CreateChildFrame mojo call, which also delivers the
Kevin McNee43fe8292021-10-04 22:59:41275 // |policy_container_bind_params|. |is_dummy_frame_for_inner_tree| is true if
276 // the added frame is only to serve as a placeholder for an inner frame tree
277 // (e.g. fenced frames, portals) and will not have a live RenderFrame of its
278 // own.
danakjc492bf82020-09-09 20:02:44279 FrameTreeNode* AddFrame(
280 RenderFrameHostImpl* parent,
281 int process_id,
282 int new_routing_id,
danakj0bdfacd2021-01-20 19:27:18283 mojo::PendingAssociatedRemote<mojom::Frame> frame_remote,
danakjc492bf82020-09-09 20:02:44284 mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
285 browser_interface_broker_receiver,
Antonio Sartoridb967c52021-01-20 09:54:30286 blink::mojom::PolicyContainerBindParamsPtr policy_container_bind_params,
danakjc492bf82020-09-09 20:02:44287 blink::mojom::TreeScopeType scope,
288 const std::string& frame_name,
289 const std::string& frame_unique_name,
290 bool is_created_by_script,
Chris Hamilton3ff6ed0e2021-02-19 03:54:04291 const blink::LocalFrameToken& frame_token,
danakjc492bf82020-09-09 20:02:44292 const base::UnguessableToken& devtools_frame_token,
293 const blink::FramePolicy& frame_policy,
294 const blink::mojom::FrameOwnerProperties& frame_owner_properties,
295 bool was_discarded,
Kevin McNee43fe8292021-10-04 22:59:41296 blink::FrameOwnerElementType owner_type,
297 bool is_dummy_frame_for_inner_tree);
danakjc492bf82020-09-09 20:02:44298
299 // Removes a frame from the frame tree. |child|, its children, and objects
300 // owned by their RenderFrameHostManagers are immediately deleted. The root
301 // node cannot be removed this way.
302 void RemoveFrame(FrameTreeNode* child);
303
304 // This method walks the entire frame tree and creates a RenderFrameProxyHost
305 // for the given |site_instance| in each node except the |source| one --
306 // the source will have a RenderFrameHost. |source| may be null if there is
307 // no node navigating in this frame tree (such as when this is called
308 // for an opener's frame tree), in which case no nodes are skipped for
309 // RenderFrameProxyHost creation.
310 void CreateProxiesForSiteInstance(FrameTreeNode* source,
311 SiteInstance* site_instance);
312
313 // Convenience accessor for the main frame's RenderFrameHostImpl.
314 RenderFrameHostImpl* GetMainFrame() const;
315
316 // Returns the focused frame.
317 FrameTreeNode* GetFocusedFrame();
318
319 // Sets the focused frame to |node|. |source| identifies the SiteInstance
320 // that initiated this focus change. If this FrameTree has SiteInstances
321 // other than |source|, those SiteInstances will be notified about the new
322 // focused frame. Note that |source| may differ from |node|'s current
323 // SiteInstance (e.g., this happens for cross-process window.focus() calls).
324 void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source);
325
danakjc492bf82020-09-09 20:02:44326 // Creates a RenderViewHostImpl for a given |site_instance| in the tree.
327 //
328 // The RenderFrameHostImpls and the RenderFrameProxyHosts will share ownership
329 // of this object.
330 scoped_refptr<RenderViewHostImpl> CreateRenderViewHost(
331 SiteInstance* site_instance,
332 int32_t main_frame_routing_id,
danakj08eb51d2020-12-30 20:15:23333 bool swapped_out,
334 bool renderer_initiated_creation);
danakjc492bf82020-09-09 20:02:44335
336 // Returns the existing RenderViewHost for a new RenderFrameHost.
337 // There should always be such a RenderViewHost, because the main frame
338 // RenderFrameHost for each SiteInstance should be created before subframes.
339 scoped_refptr<RenderViewHostImpl> GetRenderViewHost(
340 SiteInstance* site_instance);
341
Aaron Colwell78b4bde2021-03-16 16:16:09342 // Returns the ID used for the RenderViewHost associated with |site_instance|.
343 // Note: Callers should not assume that there is a 1:1 mapping between
344 // SiteInstances and IDs returned by this function, since several
345 // SiteInstances may share a RenderViewHost.
346 RenderViewHostMapId GetRenderViewHostMapId(SiteInstance* site_instance) const;
347
danakjc492bf82020-09-09 20:02:44348 // Registers a RenderViewHost so that it can be reused by other frames
Aaron Colwell78b4bde2021-03-16 16:16:09349 // whose SiteInstance maps to the same RenderViewHostMapId.
danakjc492bf82020-09-09 20:02:44350 //
351 // This method does not take ownership of|rvh|.
352 //
353 // NOTE: This method CHECK fails if a RenderViewHost is already registered for
354 // |rvh|'s SiteInstance.
355 //
356 // ALSO NOTE: After calling RegisterRenderViewHost, UnregisterRenderViewHost
357 // *must* be called for |rvh| when it is destroyed or put into the
358 // BackForwardCache, to prevent FrameTree::CreateRenderViewHost from trying to
359 // reuse it.
Aaron Colwell78b4bde2021-03-16 16:16:09360 void RegisterRenderViewHost(RenderViewHostMapId id, RenderViewHostImpl* rvh);
danakjc492bf82020-09-09 20:02:44361
362 // Unregisters the RenderViewHostImpl that's available for reuse for a
Aaron Colwell78b4bde2021-03-16 16:16:09363 // particular RenderViewHostMapId. NOTE: This method CHECK fails if it is
364 // called for a |render_view_host| that is not currently set for reuse.
365 void UnregisterRenderViewHost(RenderViewHostMapId id,
Aaron Colwellc4bd7d62021-01-29 04:23:13366 RenderViewHostImpl* render_view_host);
danakjc492bf82020-09-09 20:02:44367
368 // This is called when the frame is about to be removed and started to run
369 // unload handlers.
370 void FrameUnloading(FrameTreeNode* frame);
371
372 // This is only meant to be called by FrameTreeNode. Triggers calling
373 // the listener installed by SetFrameRemoveListener.
374 void FrameRemoved(FrameTreeNode* frame);
375
Carlos Caballero03262522021-02-05 14:49:58376 void DidStartLoadingNode(FrameTreeNode& node,
377 bool to_different_document,
378 bool was_previously_loading);
379 void DidStopLoadingNode(FrameTreeNode& node);
Carlos Caballero03262522021-02-05 14:49:58380 void DidCancelLoading();
danakjc492bf82020-09-09 20:02:44381
Sreeja Kamishetty0be3b1b2021-08-12 17:04:15382 // Returns this FrameTree's total load progress. If the `root_` FrameTreeNode
383 // is navigating returns `blink::kInitialLoadProgress`.
384 double GetLoadProgress();
danakjc492bf82020-09-09 20:02:44385
386 // Returns true if at least one of the nodes in this FrameTree is loading.
387 bool IsLoading() const;
388
389 // Set page-level focus in all SiteInstances involved in rendering
390 // this FrameTree, not including the current main frame's
391 // SiteInstance. The focus update will be sent via the main frame's proxies
392 // in those SiteInstances.
393 void ReplicatePageFocus(bool is_focused);
394
395 // Updates page-level focus for this FrameTree in the subframe renderer
396 // identified by |instance|.
397 void SetPageFocus(SiteInstance* instance, bool is_focused);
398
399 // Walks the current frame tree and registers any origins matching |origin|,
400 // either the last committed origin of a RenderFrameHost or the origin
401 // associated with a NavigationRequest that has been assigned to a
402 // SiteInstance, as not-opted-in for origin isolation.
403 void RegisterExistingOriginToPreventOptInIsolation(
404 const url::Origin& previously_visited_origin,
405 NavigationRequest* navigation_request_to_exclude);
406
Carlos Caballero40b0efd2021-01-26 11:55:00407 NavigationControllerImpl& controller() { return navigator_.controller(); }
danakjc492bf82020-09-09 20:02:44408 Navigator& navigator() { return navigator_; }
409
Carlos Caballeroede6f8c2021-01-28 11:01:50410 // Another page accessed the initial empty main document, which means it
411 // is no longer safe to display a pending URL without risking a URL spoof.
412 void DidAccessInitialMainDocument();
413
414 bool has_accessed_initial_main_document() const {
415 return has_accessed_initial_main_document_;
416 }
417
418 void ResetHasAccessedInitialMainDocument() {
419 has_accessed_initial_main_document_ = false;
420 }
421
Carlos Caballero6ff6ace2021-02-05 16:53:00422 bool IsHidden() const { return delegate_->IsHidden(); }
423
Carlos Caballero03262522021-02-05 14:49:58424 // Stops all ongoing navigations in each of the nodes of this FrameTree.
425 void StopLoading();
426
Carlos Caballero101ac26b2021-03-24 11:54:05427 // Prepares this frame tree for destruction, cleaning up the internal state
428 // and firing the appropriate events like FrameDeleted.
429 // Must be called before FrameTree is destroyed.
430 void Shutdown();
431
Takashi Toyoshimaea534ef22021-07-21 03:27:59432 bool IsBeingDestroyed() const { return is_being_destroyed_; }
433
danakjc492bf82020-09-09 20:02:44434 private:
435 friend class FrameTreeTest;
436 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplBrowserTest, RemoveFocusedFrame);
437
438 // Returns a range to iterate over all FrameTreeNodes in the frame tree in
439 // breadth-first traversal order, skipping the subtree rooted at
440 // |node|, but including |node| itself.
441 NodeRange NodesExceptSubtree(FrameTreeNode* node);
442
Carlos Caballero03262522021-02-05 14:49:58443 Delegate* const delegate_;
444
danakjc492bf82020-09-09 20:02:44445 // These delegates are installed into all the RenderViewHosts and
446 // RenderFrameHosts that we create.
447 RenderFrameHostDelegate* render_frame_delegate_;
448 RenderViewHostDelegate* render_view_delegate_;
449 RenderWidgetHostDelegate* render_widget_delegate_;
450 RenderFrameHostManager::Delegate* manager_delegate_;
Jeremy Roman2d8dfe132021-07-06 20:51:26451 PageDelegate* page_delegate_;
danakjc492bf82020-09-09 20:02:44452
453 // The Navigator object responsible for managing navigations on this frame
Carlos Caballero40b0efd2021-01-26 11:55:00454 // tree. Each FrameTreeNode will default to using it for navigation tasks in
455 // the frame.
danakjc492bf82020-09-09 20:02:44456 Navigator navigator_;
457
Aaron Colwell78b4bde2021-03-16 16:16:09458 // Map of RenderViewHostMapId to RenderViewHost. This allows us to look up the
danakjc492bf82020-09-09 20:02:44459 // RenderViewHost for a given SiteInstance when creating RenderFrameHosts.
460 // Each RenderViewHost maintains a refcount and is deleted when there are no
461 // more RenderFrameHosts or RenderFrameProxyHosts using it.
Aaron Colwell78b4bde2021-03-16 16:16:09462 RenderViewHostMap render_view_host_map_;
danakjc492bf82020-09-09 20:02:44463
464 // This is an owned ptr to the root FrameTreeNode, which never changes over
465 // the lifetime of the FrameTree. It is not a scoped_ptr because we need the
466 // pointer to remain valid even while the FrameTreeNode is being destroyed,
467 // since it's common for a node to test whether it's the root node.
468 FrameTreeNode* root_;
469
470 int focused_frame_tree_node_id_;
471
danakjc492bf82020-09-09 20:02:44472 // Overall load progress.
473 double load_progress_;
474
Carlos Caballeroede6f8c2021-01-28 11:01:50475 // Whether the initial empty page has been accessed by another page, making it
476 // unsafe to show the pending URL. Usually false unless another window tries
477 // to modify the blank page. Always false after the first commit.
478 bool has_accessed_initial_main_document_ = false;
479
Sreeja Kamishetty837a10402021-04-23 12:41:59480 // Indicates type of frame tree.
481 const Type type_;
Sreeja Kamishetty74bacd522021-03-22 17:04:24482
Takashi Toyoshimaea534ef22021-07-21 03:27:59483 bool is_being_destroyed_ = false;
484
Carlos Caballero101ac26b2021-03-24 11:54:05485#if DCHECK_IS_ON()
486 // Whether Shutdown() was called.
487 bool was_shut_down_ = false;
488#endif
danakjc492bf82020-09-09 20:02:44489};
490
491} // namespace content
492
493#endif // CONTENT_BROWSER_RENDERER_HOST_FRAME_TREE_H_