| 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_NODE_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ |
| 6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
| 14 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 14 #include "content/browser/frame_host/render_frame_host_manager.h" | 15 #include "content/browser/frame_host/render_frame_host_manager.h" |
| 15 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 16 #include "url/gurl.h" | 17 #include "url/gurl.h" |
| 17 | 18 |
| 18 namespace content { | 19 namespace content { |
| 19 | 20 |
| 20 class Navigator; | 21 class Navigator; |
| 21 class RenderFrameHostImpl; | 22 class RenderFrameHostImpl; |
| 22 | 23 |
| 23 // When a page contains iframes, its renderer process maintains a tree structure | 24 // When a page contains iframes, its renderer process maintains a tree structure |
| 24 // of those frames. We are mirroring this tree in the browser process. This | 25 // of those frames. We are mirroring this tree in the browser process. This |
| 25 // class represents a node in this tree and is a wrapper for all objects that | 26 // class represents a node in this tree and is a wrapper for all objects that |
| 26 // are frame-specific (as opposed to page-specific). | 27 // are frame-specific (as opposed to page-specific). |
| 27 class CONTENT_EXPORT FrameTreeNode { | 28 class CONTENT_EXPORT FrameTreeNode { |
| 28 public: | 29 public: |
| 29 static const int64 kInvalidFrameId; | 30 static const int64 kInvalidFrameId; |
| 30 | 31 |
| 31 FrameTreeNode(Navigator* navigator, | 32 FrameTreeNode(Navigator* navigator, |
| 32 RenderFrameHostDelegate* render_frame_delegate, | 33 RenderFrameHostDelegate* render_frame_delegate, |
| 33 RenderViewHostDelegate* render_view_delegate, | 34 RenderViewHostDelegate* render_view_delegate, |
| 34 RenderWidgetHostDelegate* render_widget_delegate, | 35 RenderWidgetHostDelegate* render_widget_delegate, |
| 35 RenderFrameHostManager::Delegate* manager_delegate, | 36 RenderFrameHostManager::Delegate* manager_delegate, |
| 36 int64 frame_id, | 37 int64 frame_id, |
| 37 const std::string& name, | 38 const std::string& name); |
| 38 scoped_ptr<RenderFrameHostImpl> render_frame_host); | |
| 39 | 39 |
| 40 ~FrameTreeNode(); | 40 ~FrameTreeNode(); |
| 41 | 41 |
| 42 void AddChild(scoped_ptr<FrameTreeNode> child); | 42 void AddChild(scoped_ptr<FrameTreeNode> child); |
| 43 void RemoveChild(FrameTreeNode* child); | 43 void RemoveChild(FrameTreeNode* child); |
| 44 | 44 |
| 45 // TODO(nasko): This method should be removed once RenderFrameHosts are |
| 46 // created by RenderFrameHostManager. |
| 47 void set_render_frame_host( |
| 48 RenderFrameHostImpl* render_frame_host, |
| 49 bool owns_render_frame_host) { |
| 50 render_frame_host_ = render_frame_host; |
| 51 owns_render_frame_host_ = owns_render_frame_host; |
| 52 } |
| 53 |
| 45 // Transitional API allowing the RenderFrameHost of a FrameTreeNode | 54 // Transitional API allowing the RenderFrameHost of a FrameTreeNode |
| 46 // representing the main frame to be provided by someone else. After | 55 // representing the main frame to be provided by someone else. After |
| 47 // this is called, the FrameTreeNode no longer owns its RenderFrameHost. | 56 // this is called, the FrameTreeNode no longer owns its RenderFrameHost. |
| 48 // | 57 // |
| 49 // This should only be used for the main frame (aka root) in a frame tree. | 58 // This should only be used for the main frame (aka root) in a frame tree. |
| 50 // | 59 // |
| 51 // TODO(ajwong): Remove this method once the main frame RenderFrameHostImpl is | 60 // TODO(ajwong): Remove this method once the main frame RenderFrameHostImpl is |
| 52 // no longer owned by the RenderViewHostImpl. | 61 // no longer owned by the RenderViewHostImpl. |
| 53 void ResetForMainFrame(RenderFrameHostImpl* new_render_frame_host); | 62 void ResetForMainFrame(RenderFrameHostImpl* new_render_frame_host); |
| 54 | 63 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // TODO(creis): Remove this when we can store subframe URLs in the | 160 // TODO(creis): Remove this when we can store subframe URLs in the |
| 152 // NavigationController. | 161 // NavigationController. |
| 153 GURL current_url_; | 162 GURL current_url_; |
| 154 | 163 |
| 155 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); | 164 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); |
| 156 }; | 165 }; |
| 157 | 166 |
| 158 } // namespace content | 167 } // namespace content |
| 159 | 168 |
| 160 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ | 169 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ |
| OLD | NEW |