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_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 RenderFrameHostDelegate; | 19 class RenderFrameHostDelegate; |
20 class RenderProcessHost; | 20 class RenderProcessHost; |
21 class RenderViewHostDelegate; | 21 class RenderViewHostDelegate; |
22 class RenderViewHostImpl; | 22 class RenderViewHostImpl; |
23 class RenderFrameHostManager; | 23 class RenderFrameHostManager; |
24 class RenderWidgetHostDelegate; | 24 class RenderWidgetHostDelegate; |
| 25 struct NavigationBeforeCommitInfo; |
25 | 26 |
26 // Represents the frame tree for a page. With the exception of the main frame, | 27 // Represents the frame tree for a page. With the exception of the main frame, |
27 // all FrameTreeNodes will be created/deleted in response to frame attach and | 28 // all FrameTreeNodes will be created/deleted in response to frame attach and |
28 // detach events in the DOM. | 29 // detach events in the DOM. |
29 // | 30 // |
30 // The main frame's FrameTreeNode is special in that it is reused. This allows | 31 // The main frame's FrameTreeNode is special in that it is reused. This allows |
31 // it to serve as an anchor for state that needs to persist across top-level | 32 // it to serve as an anchor for state that needs to persist across top-level |
32 // page navigations. | 33 // page navigations. |
33 // | 34 // |
34 // TODO(ajwong): Move NavigationController ownership to the main frame | 35 // TODO(ajwong): Move NavigationController ownership to the main frame |
35 // FrameTreeNode. Possibly expose access to it from here. | 36 // FrameTreeNode. Possibly expose access to it from here. |
36 // | 37 // |
37 // This object is only used on the UI thread. | 38 // This object is only used on the UI thread. |
38 class CONTENT_EXPORT FrameTree { | 39 class CONTENT_EXPORT FrameTree { |
39 public: | 40 public: |
40 // Each FrameTreeNode will default to using the given |navigator| for | 41 // Each FrameTreeNode will default to using the given |navigator| for |
41 // navigation tasks in the frame. | 42 // navigation tasks in the frame. |
42 // A set of delegates are remembered here so that we can create | 43 // A set of delegates are remembered here so that we can create |
43 // RenderFrameHostManagers. | 44 // RenderFrameHostManagers. |
44 // TODO(creis): This set of delegates will change as we move things to | 45 // TODO(creis): This set of delegates will change as we move things to |
45 // Navigator. | 46 // Navigator. |
46 FrameTree(Navigator* navigator, | 47 FrameTree(Navigator* navigator, |
47 RenderFrameHostDelegate* render_frame_delegate, | 48 RenderFrameHostDelegate* render_frame_delegate, |
48 RenderViewHostDelegate* render_view_delegate, | 49 RenderViewHostDelegate* render_view_delegate, |
49 RenderWidgetHostDelegate* render_widget_delegate, | 50 RenderWidgetHostDelegate* render_widget_delegate, |
50 RenderFrameHostManager::Delegate* manager_delegate); | 51 RenderFrameHostManager::Delegate* manager_delegate); |
51 ~FrameTree(); | 52 ~FrameTree(); |
52 | 53 |
| 54 // PlzNavigate |
| 55 // Signal the node with id |frame_tree_node_id| that a navigation request is |
| 56 // ready to commit. |
| 57 static void CommitNavigationInNode(int64 frame_tree_node_id, |
| 58 const NavigationBeforeCommitInfo& info); |
| 59 |
| 60 |
53 FrameTreeNode* root() const { return root_.get(); } | 61 FrameTreeNode* root() const { return root_.get(); } |
54 | 62 |
55 // Returns the FrameTreeNode with the given |frame_tree_node_id|. | 63 // Returns the FrameTreeNode with the given |frame_tree_node_id|. |
56 FrameTreeNode* FindByID(int64 frame_tree_node_id); | 64 FrameTreeNode* FindByID(int64 frame_tree_node_id); |
57 | 65 |
58 // Returns the FrameTreeNode with the given renderer-specific |routing_id|. | 66 // Returns the FrameTreeNode with the given renderer-specific |routing_id|. |
59 FrameTreeNode* FindByRoutingID(int routing_id, int process_id); | 67 FrameTreeNode* FindByRoutingID(int routing_id, int process_id); |
60 | 68 |
61 // Executes |on_node| on each node in the frame tree. If |on_node| returns | 69 // Executes |on_node| on each node in the frame tree. If |on_node| returns |
62 // false, terminates the iteration immediately. Returning false is useful | 70 // false, terminates the iteration immediately. Returning false is useful |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 int64 focused_frame_tree_node_id_; | 168 int64 focused_frame_tree_node_id_; |
161 | 169 |
162 base::Callback<void(RenderFrameHost*)> on_frame_removed_; | 170 base::Callback<void(RenderFrameHost*)> on_frame_removed_; |
163 | 171 |
164 DISALLOW_COPY_AND_ASSIGN(FrameTree); | 172 DISALLOW_COPY_AND_ASSIGN(FrameTree); |
165 }; | 173 }; |
166 | 174 |
167 } // namespace content | 175 } // namespace content |
168 | 176 |
169 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ | 177 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ |
OLD | NEW |