| 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 RenderProcessHost; | 19 class RenderProcessHost; |
| 20 class RenderViewHostDelegate; | 20 class RenderViewHostDelegate; |
| 21 class RenderViewHostImpl; | 21 class RenderViewHostImpl; |
| 22 class RenderViewHostManager; | 22 class RenderFrameHostManager; |
| 23 class RenderWidgetHostDelegate; | 23 class RenderWidgetHostDelegate; |
| 24 | 24 |
| 25 // 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, |
| 26 // 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 |
| 27 // detach events in the DOM. | 27 // detach events in the DOM. |
| 28 // | 28 // |
| 29 // 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 |
| 30 // 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 |
| 31 // page navigations. | 31 // page navigations. |
| 32 // | 32 // |
| 33 // TODO(ajwong): Move NavigationController ownership to the main frame | 33 // TODO(ajwong): Move NavigationController ownership to the main frame |
| 34 // FrameTreeNode. Possibly expose access to it from here. | 34 // FrameTreeNode. Possibly expose access to it from here. |
| 35 // | 35 // |
| 36 // TODO(ajwong): Currently this class only contains FrameTreeNodes for | 36 // TODO(ajwong): Currently this class only contains FrameTreeNodes for |
| 37 // subframes if the --site-per-process flag is enabled. | 37 // subframes if the --site-per-process flag is enabled. |
| 38 // | 38 // |
| 39 // This object is only used on the UI thread. | 39 // This object is only used on the UI thread. |
| 40 class CONTENT_EXPORT FrameTree { | 40 class CONTENT_EXPORT FrameTree { |
| 41 public: | 41 public: |
| 42 // Each FrameTreeNode will default to using the given |navigator| for | 42 // Each FrameTreeNode will default to using the given |navigator| for |
| 43 // navigation tasks in the frame. | 43 // navigation tasks in the frame. |
| 44 // A set of delegates are remembered here so that we can create | 44 // A set of delegates are remembered here so that we can create |
| 45 // RenderViewHostManagers. | 45 // RenderFrameHostManagers. |
| 46 // TODO(creis): This set of delegates will change as we move things to | 46 // TODO(creis): This set of delegates will change as we move things to |
| 47 // Navigator. | 47 // Navigator. |
| 48 FrameTree(Navigator* navigator, | 48 FrameTree(Navigator* navigator, |
| 49 RenderViewHostDelegate* render_view_delegate, | 49 RenderViewHostDelegate* render_view_delegate, |
| 50 RenderWidgetHostDelegate* render_widget_delegate, | 50 RenderWidgetHostDelegate* render_widget_delegate, |
| 51 RenderViewHostManager::Delegate* manager_delegate); | 51 RenderFrameHostManager::Delegate* manager_delegate); |
| 52 ~FrameTree(); | 52 ~FrameTree(); |
| 53 | 53 |
| 54 // Returns the FrameTreeNode with the given |frame_tree_node_id|. | 54 // Returns the FrameTreeNode with the given |frame_tree_node_id|. |
| 55 FrameTreeNode* FindByID(int64 frame_tree_node_id); | 55 FrameTreeNode* FindByID(int64 frame_tree_node_id); |
| 56 | 56 |
| 57 // 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 |
| 58 // false, terminates the iteration immediately. Returning false is useful | 58 // false, terminates the iteration immediately. Returning false is useful |
| 59 // if |on_node| is just doing a search over the tree. | 59 // if |on_node| is just doing a search over the tree. |
| 60 void ForEach(const base::Callback<bool(FrameTreeNode*)>& on_node) const; | 60 void ForEach(const base::Callback<bool(FrameTreeNode*)>& on_node) const; |
| 61 | 61 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 scoped_ptr<FrameTreeNode> CreateNode(int64 frame_id, | 113 scoped_ptr<FrameTreeNode> CreateNode(int64 frame_id, |
| 114 const std::string& frame_name, | 114 const std::string& frame_name, |
| 115 int render_frame_host_id, | 115 int render_frame_host_id, |
| 116 Navigator* navigator, | 116 Navigator* navigator, |
| 117 RenderProcessHost* render_process_host); | 117 RenderProcessHost* render_process_host); |
| 118 | 118 |
| 119 // These delegates are installed into all the RenderViewHosts and | 119 // These delegates are installed into all the RenderViewHosts and |
| 120 // RenderFrameHosts that we create. | 120 // RenderFrameHosts that we create. |
| 121 RenderViewHostDelegate* render_view_delegate_; | 121 RenderViewHostDelegate* render_view_delegate_; |
| 122 RenderWidgetHostDelegate* render_widget_delegate_; | 122 RenderWidgetHostDelegate* render_widget_delegate_; |
| 123 RenderViewHostManager::Delegate* manager_delegate_; | 123 RenderFrameHostManager::Delegate* manager_delegate_; |
| 124 | 124 |
| 125 scoped_ptr<FrameTreeNode> root_; | 125 scoped_ptr<FrameTreeNode> root_; |
| 126 | 126 |
| 127 base::Callback<void(RenderViewHostImpl*, int64)> on_frame_removed_; | 127 base::Callback<void(RenderViewHostImpl*, int64)> on_frame_removed_; |
| 128 | 128 |
| 129 DISALLOW_COPY_AND_ASSIGN(FrameTree); | 129 DISALLOW_COPY_AND_ASSIGN(FrameTree); |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 } // namespace content | 132 } // namespace content |
| 133 | 133 |
| 134 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ | 134 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ |
| OLD | NEW |