Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Side by Side Diff: content/browser/frame_host/frame_tree.h

Issue 72233002: Move RenderViewHostManager from WebContents to FrameTreeNode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/frame_host/frame_tree.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_
6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "content/browser/frame_host/frame_tree_node.h" 12 #include "content/browser/frame_host/frame_tree_node.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 14
15 namespace content { 15 namespace content {
16 16
17 class FrameTreeNode; 17 class FrameTreeNode;
18 class Navigator; 18 class Navigator;
19 class RenderProcessHost; 19 class RenderProcessHost;
20 class RenderViewHostDelegate;
20 class RenderViewHostImpl; 21 class RenderViewHostImpl;
22 class RenderViewHostManager;
23 class RenderWidgetHostDelegate;
21 24
22 // Represents the frame tree for a page. With the exception of the main frame, 25 // Represents the frame tree for a page. With the exception of the main frame,
23 // all FrameTreeNodes will be created/deleted in response to frame attach and 26 // all FrameTreeNodes will be created/deleted in response to frame attach and
24 // detach events in the DOM. 27 // detach events in the DOM.
25 // 28 //
26 // The main frame's FrameTreeNode is special in that it is reused. This allows 29 // The main frame's FrameTreeNode is special in that it is reused. This allows
27 // it to serve as an anchor for state that needs to persist across top-level 30 // it to serve as an anchor for state that needs to persist across top-level
28 // page navigations. 31 // page navigations.
29 // 32 //
30 // TODO(ajwong): Move NavigationController ownership to the main frame 33 // TODO(ajwong): Move NavigationController ownership to the main frame
31 // FrameTreeNode. Possibly expose access to it from here. 34 // FrameTreeNode. Possibly expose access to it from here.
32 // 35 //
33 // TODO(ajwong): Currently this class only contains FrameTreeNodes for 36 // TODO(ajwong): Currently this class only contains FrameTreeNodes for
34 // subframes if the --site-per-process flag is enabled. 37 // subframes if the --site-per-process flag is enabled.
35 // 38 //
36 // This object is only used on the UI thread. 39 // This object is only used on the UI thread.
37 class CONTENT_EXPORT FrameTree { 40 class CONTENT_EXPORT FrameTree {
38 public: 41 public:
39 // Each FrameTreeNode will default to using the given |navigator| for 42 // Each FrameTreeNode will default to using the given |navigator| for
40 // navigation tasks in the frame. 43 // navigation tasks in the frame.
41 FrameTree(Navigator* navigator); 44 // A set of delegates are remembered here so that we can create
45 // RenderViewHostManagers.
46 // TODO(creis): This set of delegates will change as we move things to
47 // Navigator.
48 FrameTree(Navigator* navigator,
49 RenderViewHostDelegate* render_view_delegate,
50 RenderWidgetHostDelegate* render_widget_delegate,
51 RenderViewHostManager::Delegate* manager_delegate);
42 ~FrameTree(); 52 ~FrameTree();
43 53
44 // Returns the FrameTreeNode with the given |frame_tree_node_id|. 54 // Returns the FrameTreeNode with the given |frame_tree_node_id|.
45 FrameTreeNode* FindByID(int64 frame_tree_node_id); 55 FrameTreeNode* FindByID(int64 frame_tree_node_id);
46 56
47 // Executes |on_node| on each node in the frame tree. If |on_node| returns 57 // Executes |on_node| on each node in the frame tree. If |on_node| returns
48 // false, terminates the iteration immediately. Returning false is useful 58 // false, terminates the iteration immediately. Returning false is useful
49 // if |on_node| is just doing a search over the tree. 59 // if |on_node| is just doing a search over the tree.
50 void ForEach(const base::Callback<bool(FrameTreeNode*)>& on_node) const; 60 void ForEach(const base::Callback<bool(FrameTreeNode*)>& on_node) const;
51 61
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // Convenience accessor for the main frame's RenderFrameHostImpl. 95 // Convenience accessor for the main frame's RenderFrameHostImpl.
86 RenderFrameHostImpl* GetMainFrame() const; 96 RenderFrameHostImpl* GetMainFrame() const;
87 97
88 // Allows a client to listen for frame removal. The listener should expect 98 // Allows a client to listen for frame removal. The listener should expect
89 // to receive the RenderViewHostImpl containing the frame and the renderer- 99 // to receive the RenderViewHostImpl containing the frame and the renderer-
90 // specific frame ID of the removed frame. 100 // specific frame ID of the removed frame.
91 // TODO(creis): These parameters will later change to be the RenderFrameHost. 101 // TODO(creis): These parameters will later change to be the RenderFrameHost.
92 void SetFrameRemoveListener( 102 void SetFrameRemoveListener(
93 const base::Callback<void(RenderViewHostImpl*, int64)>& on_frame_removed); 103 const base::Callback<void(RenderViewHostImpl*, int64)>& on_frame_removed);
94 104
95 FrameTreeNode* GetRootForTesting() { return root_.get(); } 105 FrameTreeNode* root() const { return root_.get(); }
96 106
97 private: 107 private:
98 // Returns the FrameTreeNode with the given renderer-specific |frame_id|. 108 // Returns the FrameTreeNode with the given renderer-specific |frame_id|.
99 // For internal use only. 109 // For internal use only.
100 // TODO(creis): Replace this with a version that takes in a routing ID. 110 // TODO(creis): Replace this with a version that takes in a routing ID.
101 FrameTreeNode* FindByFrameID(int64 frame_id); 111 FrameTreeNode* FindByFrameID(int64 frame_id);
102 112
103 scoped_ptr<FrameTreeNode> CreateNode(int64 frame_id, 113 scoped_ptr<FrameTreeNode> CreateNode(int64 frame_id,
104 const std::string& frame_name, 114 const std::string& frame_name,
105 int render_frame_host_id, 115 int render_frame_host_id,
106 Navigator* navigator, 116 Navigator* navigator,
107 RenderProcessHost* render_process_host); 117 RenderProcessHost* render_process_host);
108 118
119 // These delegates are installed into all the RenderViewHosts and
120 // RenderFrameHosts that we create.
121 RenderViewHostDelegate* render_view_delegate_;
122 RenderWidgetHostDelegate* render_widget_delegate_;
123 RenderViewHostManager::Delegate* manager_delegate_;
124
109 scoped_ptr<FrameTreeNode> root_; 125 scoped_ptr<FrameTreeNode> root_;
110 126
111 base::Callback<void(RenderViewHostImpl*, int64)> on_frame_removed_; 127 base::Callback<void(RenderViewHostImpl*, int64)> on_frame_removed_;
112 128
113 DISALLOW_COPY_AND_ASSIGN(FrameTree); 129 DISALLOW_COPY_AND_ASSIGN(FrameTree);
114 }; 130 };
115 131
116 } // namespace content 132 } // namespace content
117 133
118 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ 134 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/frame_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698