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

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: Initial patch 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
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. TODO(creis): This set of delegates will change as
nasko 2013/11/14 08:23:38 nit: TODO on a new line?
Charlie Reis 2013/11/14 19:01:16 Done.
46 // we move things to Navigator.
47 FrameTree(Navigator* navigator,
48 RenderViewHostDelegate* render_view_delegate,
49 RenderWidgetHostDelegate* render_widget_delegate,
50 RenderViewHostManager::Delegate* manager_delegate);
42 ~FrameTree(); 51 ~FrameTree();
43 52
44 // Returns the FrameTreeNode with the given |frame_tree_node_id|. 53 // Returns the FrameTreeNode with the given |frame_tree_node_id|.
45 FrameTreeNode* FindByID(int64 frame_tree_node_id); 54 FrameTreeNode* FindByID(int64 frame_tree_node_id);
46 55
47 // Executes |on_node| on each node in the frame tree. If |on_node| returns 56 // Executes |on_node| on each node in the frame tree. If |on_node| returns
48 // false, terminates the iteration immediately. Returning false is useful 57 // false, terminates the iteration immediately. Returning false is useful
49 // if |on_node| is just doing a search over the tree. 58 // if |on_node| is just doing a search over the tree.
50 void ForEach(const base::Callback<bool(FrameTreeNode*)>& on_node) const; 59 void ForEach(const base::Callback<bool(FrameTreeNode*)>& on_node) const;
51 60
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // Convenience accessor for the main frame's RenderFrameHostImpl. 94 // Convenience accessor for the main frame's RenderFrameHostImpl.
86 RenderFrameHostImpl* GetMainFrame() const; 95 RenderFrameHostImpl* GetMainFrame() const;
87 96
88 // Allows a client to listen for frame removal. The listener should expect 97 // Allows a client to listen for frame removal. The listener should expect
89 // to receive the RenderViewHostImpl containing the frame and the renderer- 98 // to receive the RenderViewHostImpl containing the frame and the renderer-
90 // specific frame ID of the removed frame. 99 // specific frame ID of the removed frame.
91 // TODO(creis): These parameters will later change to be the RenderFrameHost. 100 // TODO(creis): These parameters will later change to be the RenderFrameHost.
92 void SetFrameRemoveListener( 101 void SetFrameRemoveListener(
93 const base::Callback<void(RenderViewHostImpl*, int64)>& on_frame_removed); 102 const base::Callback<void(RenderViewHostImpl*, int64)>& on_frame_removed);
94 103
95 FrameTreeNode* GetRootForTesting() { return root_.get(); } 104 FrameTreeNode* root() const { return root_.get(); }
96 105
97 private: 106 private:
98 // Returns the FrameTreeNode with the given renderer-specific |frame_id|. 107 // Returns the FrameTreeNode with the given renderer-specific |frame_id|.
99 // For internal use only. 108 // For internal use only.
100 // TODO(creis): Replace this with a version that takes in a routing ID. 109 // TODO(creis): Replace this with a version that takes in a routing ID.
101 FrameTreeNode* FindByFrameID(int64 frame_id); 110 FrameTreeNode* FindByFrameID(int64 frame_id);
102 111
103 scoped_ptr<FrameTreeNode> CreateNode(int64 frame_id, 112 scoped_ptr<FrameTreeNode> CreateNode(int64 frame_id,
104 const std::string& frame_name, 113 const std::string& frame_name,
105 int render_frame_host_id, 114 int render_frame_host_id,
106 Navigator* navigator, 115 Navigator* navigator,
107 RenderProcessHost* render_process_host); 116 RenderProcessHost* render_process_host);
108 117
118 // These delegates are installed into all the RenderViewHosts and
119 // RenderFrameHosts that we create.
120 RenderViewHostDelegate* render_view_delegate_;
121 RenderWidgetHostDelegate* render_widget_delegate_;
122 RenderViewHostManager::Delegate* manager_delegate_;
123
109 scoped_ptr<FrameTreeNode> root_; 124 scoped_ptr<FrameTreeNode> root_;
110 125
111 base::Callback<void(RenderViewHostImpl*, int64)> on_frame_removed_; 126 base::Callback<void(RenderViewHostImpl*, int64)> on_frame_removed_;
112 127
113 DISALLOW_COPY_AND_ASSIGN(FrameTree); 128 DISALLOW_COPY_AND_ASSIGN(FrameTree);
114 }; 129 };
115 130
116 } // namespace content 131 } // namespace content
117 132
118 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ 133 #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') | content/browser/frame_host/frame_tree_node.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698