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_view_host_manager.h" | 15 #include "content/browser/frame_host/render_view_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 RenderViewHostDelegate* render_view_delegate, | 33 RenderViewHostDelegate* render_view_delegate, |
33 RenderWidgetHostDelegate* render_widget_delegate, | 34 RenderWidgetHostDelegate* render_widget_delegate, |
34 RenderViewHostManager::Delegate* manager_delegate, | 35 RenderViewHostManager::Delegate* manager_delegate, |
35 int64 frame_id, | 36 int64 frame_id, |
36 const std::string& name, | 37 const std::string& name); |
37 scoped_ptr<RenderFrameHostImpl> render_frame_host); | |
38 | 38 |
39 ~FrameTreeNode(); | 39 ~FrameTreeNode(); |
40 | 40 |
41 void AddChild(scoped_ptr<FrameTreeNode> child); | 41 void AddChild(scoped_ptr<FrameTreeNode> child); |
42 void RemoveChild(FrameTreeNode* child); | 42 void RemoveChild(FrameTreeNode* child); |
43 | 43 |
| 44 // TODO(nasko): This method should be removed once there is a |
| 45 // RenderFrameHostManager for each node in the frame tree. |
| 46 void set_render_frame_host( |
| 47 RenderFrameHostImpl* render_frame_host, |
| 48 bool owns_render_frame_host) { |
| 49 render_frame_host_ = render_frame_host; |
| 50 owns_render_frame_host_ = owns_render_frame_host; |
| 51 } |
| 52 |
44 // Transitional API allowing the RenderFrameHost of a FrameTreeNode | 53 // Transitional API allowing the RenderFrameHost of a FrameTreeNode |
45 // representing the main frame to be provided by someone else. After | 54 // representing the main frame to be provided by someone else. After |
46 // this is called, the FrameTreeNode no longer owns its RenderFrameHost. | 55 // this is called, the FrameTreeNode no longer owns its RenderFrameHost. |
47 // | 56 // |
48 // This should only be used for the main frame (aka root) in a frame tree. | 57 // This should only be used for the main frame (aka root) in a frame tree. |
49 // | 58 // |
50 // TODO(ajwong): Remove this method once the main frame RenderFrameHostImpl is | 59 // TODO(ajwong): Remove this method once the main frame RenderFrameHostImpl is |
51 // no longer owned by the RenderViewHostImpl. | 60 // no longer owned by the RenderViewHostImpl. |
52 void ResetForMainFrame(RenderFrameHostImpl* new_render_frame_host); | 61 void ResetForMainFrame(RenderFrameHostImpl* new_render_frame_host); |
53 | 62 |
(...skipping 97 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 |