Chromium Code Reviews| 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_impl.h" |
| 15 #include "content/browser/frame_host/render_frame_host_manager.h" | 15 #include "content/browser/frame_host/render_frame_host_manager.h" |
| 16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "content/common/frame_replication_state.h" | |
| 17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 19 #include "url/origin.h" | |
| 18 | 20 |
| 19 namespace content { | 21 namespace content { |
| 20 | 22 |
| 21 class FrameTree; | 23 class FrameTree; |
| 22 class Navigator; | 24 class Navigator; |
| 23 class RenderFrameHostImpl; | 25 class RenderFrameHostImpl; |
| 24 | 26 |
| 25 // When a page contains iframes, its renderer process maintains a tree structure | 27 // When a page contains iframes, its renderer process maintains a tree structure |
| 26 // of those frames. We are mirroring this tree in the browser process. This | 28 // of those frames. We are mirroring this tree in the browser process. This |
| 27 // class represents a node in this tree and is a wrapper for all objects that | 29 // class represents a node in this tree and is a wrapper for all objects that |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 42 bool IsMainFrame() const; | 44 bool IsMainFrame() const; |
| 43 | 45 |
| 44 void AddChild(scoped_ptr<FrameTreeNode> child, | 46 void AddChild(scoped_ptr<FrameTreeNode> child, |
| 45 int process_id, | 47 int process_id, |
| 46 int frame_routing_id); | 48 int frame_routing_id); |
| 47 void RemoveChild(FrameTreeNode* child); | 49 void RemoveChild(FrameTreeNode* child); |
| 48 | 50 |
| 49 // Clears process specific-state in this node to prepare for a new process. | 51 // Clears process specific-state in this node to prepare for a new process. |
| 50 void ResetForNewProcess(); | 52 void ResetForNewProcess(); |
| 51 | 53 |
| 54 void SetOriginFromURL(const GURL& url); | |
|
Charlie Reis
2014/11/19 00:46:18
Don't forget to remove this.
alexmos
2014/11/19 02:49:27
Done.
| |
| 55 | |
| 52 FrameTree* frame_tree() const { | 56 FrameTree* frame_tree() const { |
| 53 return frame_tree_; | 57 return frame_tree_; |
| 54 } | 58 } |
| 55 | 59 |
| 56 Navigator* navigator() { | 60 Navigator* navigator() { |
| 57 return navigator_.get(); | 61 return navigator_.get(); |
| 58 } | 62 } |
| 59 | 63 |
| 60 RenderFrameHostManager* render_manager() { | 64 RenderFrameHostManager* render_manager() { |
| 61 return &render_manager_; | 65 return &render_manager_; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 80 } | 84 } |
| 81 | 85 |
| 82 const GURL& current_url() const { | 86 const GURL& current_url() const { |
| 83 return current_url_; | 87 return current_url_; |
| 84 } | 88 } |
| 85 | 89 |
| 86 void set_current_url(const GURL& url) { | 90 void set_current_url(const GURL& url) { |
| 87 current_url_ = url; | 91 current_url_ = url; |
| 88 } | 92 } |
| 89 | 93 |
| 94 void set_current_origin(const url::Origin& origin) { | |
| 95 replication_state_.origin = origin; | |
| 96 } | |
| 97 | |
| 98 const FrameReplicationState& current_replication_state() const { | |
| 99 return replication_state_; | |
| 100 } | |
| 101 | |
| 90 RenderFrameHostImpl* current_frame_host() const { | 102 RenderFrameHostImpl* current_frame_host() const { |
| 91 return render_manager_.current_frame_host(); | 103 return render_manager_.current_frame_host(); |
| 92 } | 104 } |
| 93 | 105 |
| 94 private: | 106 private: |
| 95 void set_parent(FrameTreeNode* parent) { parent_ = parent; } | 107 void set_parent(FrameTreeNode* parent) { parent_ = parent; } |
| 96 | 108 |
| 97 // The next available browser-global FrameTreeNode ID. | 109 // The next available browser-global FrameTreeNode ID. |
| 98 static int64 next_frame_tree_node_id_; | 110 static int64 next_frame_tree_node_id_; |
| 99 | 111 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 124 | 136 |
| 125 // The immediate children of this specific frame. | 137 // The immediate children of this specific frame. |
| 126 ScopedVector<FrameTreeNode> children_; | 138 ScopedVector<FrameTreeNode> children_; |
| 127 | 139 |
| 128 // Track the current frame's last committed URL, so we can estimate the | 140 // Track the current frame's last committed URL, so we can estimate the |
| 129 // process impact of out-of-process iframes. | 141 // process impact of out-of-process iframes. |
| 130 // TODO(creis): Remove this when we can store subframe URLs in the | 142 // TODO(creis): Remove this when we can store subframe URLs in the |
| 131 // NavigationController. | 143 // NavigationController. |
| 132 GURL current_url_; | 144 GURL current_url_; |
| 133 | 145 |
| 146 // Track information that needs to be replicated to processes that have | |
| 147 // proxies for this frame. | |
| 148 FrameReplicationState replication_state_; | |
| 149 | |
| 134 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); | 150 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); |
| 135 }; | 151 }; |
| 136 | 152 |
| 137 } // namespace content | 153 } // namespace content |
| 138 | 154 |
| 139 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ | 155 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ |
| OLD | NEW |