OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_FRAME_TREE_NODE_H_ | |
6 #define CONTENT_BROWSER_WEB_CONTENTS_FRAME_TREE_NODE_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/memory/scoped_vector.h" | |
12 #include "content/common/content_export.h" | |
13 #include "url/gurl.h" | |
14 | |
15 namespace content { | |
16 | |
17 // Any page that contains iframes has a tree structure of the frames in the | |
18 // renderer process. We are mirroring this tree in the browser process. This | |
19 // class represents a node in this tree and is a wrapper for all objects that | |
20 // are frame-specific (as opposed to page-specific). | |
21 class CONTENT_EXPORT FrameTreeNode { | |
22 public: | |
23 FrameTreeNode(int64 frame_id, const std::string& name); | |
24 ~FrameTreeNode(); | |
25 | |
26 // This method takes ownership of the child pointer. | |
27 void AddChild(FrameTreeNode* child); | |
28 void RemoveChild(int64 child_id); | |
29 | |
30 int64 frame_id() const { | |
31 return frame_id_; | |
32 } | |
33 | |
34 const std::string& frame_name() const { | |
35 return frame_name_; | |
36 } | |
37 | |
38 size_t child_count() const { | |
39 return children_.size(); | |
40 } | |
41 | |
42 FrameTreeNode* child_at(size_t index) const { | |
43 return children_[index]; | |
44 } | |
45 | |
46 const GURL& current_url() const { | |
47 return current_url_; | |
48 } | |
49 | |
50 void set_current_url(const GURL& url) { | |
51 current_url_ = url; | |
52 } | |
53 | |
54 private: | |
55 // The unique identifier for the frame in the page. | |
56 int64 frame_id_; | |
57 | |
58 // The assigned name of the frame. This name can be empty, unlike the unique | |
59 // name generated internally in the DOM tree. | |
60 std::string frame_name_; | |
61 | |
62 // The immediate children of this specific frame. | |
63 ScopedVector<FrameTreeNode> children_; | |
64 | |
65 // Track the current frame's last committed URL, so we can estimate the | |
66 // process impact of out-of-process iframes. | |
67 // TODO(creis): Remove this when we can store subframe URLs in the | |
68 // NavigationController. | |
69 GURL current_url_; | |
70 | |
71 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); | |
72 }; | |
73 | |
74 } // namespace content | |
75 | |
76 #endif // CONTENT_BROWSER_WEB_CONTENTS_FRAME_TREE_NODE_H_ | |
OLD | NEW |