| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <iterator> | 10 #include <iterator> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // it to serve as an anchor for state that needs to persist across top-level | 35 // it to serve as an anchor for state that needs to persist across top-level |
| 36 // page navigations. | 36 // page navigations. |
| 37 // | 37 // |
| 38 // TODO(ajwong): Move NavigationController ownership to the main frame | 38 // TODO(ajwong): Move NavigationController ownership to the main frame |
| 39 // FrameTreeNode. Possibly expose access to it from here. | 39 // FrameTreeNode. Possibly expose access to it from here. |
| 40 // | 40 // |
| 41 // This object is only used on the UI thread. | 41 // This object is only used on the UI thread. |
| 42 class CONTENT_EXPORT FrameTree { | 42 class CONTENT_EXPORT FrameTree { |
| 43 public: | 43 public: |
| 44 class NodeRange; | 44 class NodeRange; |
| 45 class ConstNodeRange; | |
| 46 | 45 |
| 47 class CONTENT_EXPORT NodeIterator | 46 class CONTENT_EXPORT NodeIterator |
| 48 : public std::iterator<std::forward_iterator_tag, FrameTreeNode> { | 47 : public std::iterator<std::forward_iterator_tag, FrameTreeNode> { |
| 49 public: | 48 public: |
| 50 NodeIterator(const NodeIterator& other); | 49 NodeIterator(const NodeIterator& other); |
| 51 ~NodeIterator(); | 50 ~NodeIterator(); |
| 52 | 51 |
| 53 NodeIterator& operator++(); | 52 NodeIterator& operator++(); |
| 54 | 53 |
| 55 bool operator==(const NodeIterator& rhs) const; | 54 bool operator==(const NodeIterator& rhs) const; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 74 | 73 |
| 75 private: | 74 private: |
| 76 friend class FrameTree; | 75 friend class FrameTree; |
| 77 | 76 |
| 78 NodeRange(FrameTreeNode* root, FrameTreeNode* node_to_skip); | 77 NodeRange(FrameTreeNode* root, FrameTreeNode* node_to_skip); |
| 79 | 78 |
| 80 FrameTreeNode* const root_; | 79 FrameTreeNode* const root_; |
| 81 FrameTreeNode* const node_to_skip_; | 80 FrameTreeNode* const node_to_skip_; |
| 82 }; | 81 }; |
| 83 | 82 |
| 84 class CONTENT_EXPORT ConstNodeIterator { | |
| 85 public: | |
| 86 ConstNodeIterator(const ConstNodeIterator& other); | |
| 87 ~ConstNodeIterator(); | |
| 88 | |
| 89 ConstNodeIterator& operator++(); | |
| 90 | |
| 91 bool operator==(const ConstNodeIterator& rhs) const; | |
| 92 bool operator!=(const ConstNodeIterator& rhs) const { | |
| 93 return !(*this == rhs); | |
| 94 } | |
| 95 | |
| 96 const FrameTreeNode* operator*() { return current_node_; } | |
| 97 | |
| 98 private: | |
| 99 friend class ConstNodeRange; | |
| 100 | |
| 101 ConstNodeIterator(const FrameTreeNode* starting_node); | |
| 102 | |
| 103 const FrameTreeNode* current_node_; | |
| 104 std::queue<const FrameTreeNode*> queue_; | |
| 105 }; | |
| 106 | |
| 107 class CONTENT_EXPORT ConstNodeRange { | |
| 108 public: | |
| 109 ConstNodeIterator begin(); | |
| 110 ConstNodeIterator end(); | |
| 111 | |
| 112 private: | |
| 113 friend class FrameTree; | |
| 114 | |
| 115 ConstNodeRange(const FrameTreeNode* root); | |
| 116 | |
| 117 const FrameTreeNode* const root_; | |
| 118 }; | |
| 119 | |
| 120 // Each FrameTreeNode will default to using the given |navigator| for | 83 // Each FrameTreeNode will default to using the given |navigator| for |
| 121 // navigation tasks in the frame. | 84 // navigation tasks in the frame. |
| 122 // A set of delegates are remembered here so that we can create | 85 // A set of delegates are remembered here so that we can create |
| 123 // RenderFrameHostManagers. | 86 // RenderFrameHostManagers. |
| 124 // TODO(creis): This set of delegates will change as we move things to | 87 // TODO(creis): This set of delegates will change as we move things to |
| 125 // Navigator. | 88 // Navigator. |
| 126 FrameTree(Navigator* navigator, | 89 FrameTree(Navigator* navigator, |
| 127 RenderFrameHostDelegate* render_frame_delegate, | 90 RenderFrameHostDelegate* render_frame_delegate, |
| 128 RenderViewHostDelegate* render_view_delegate, | 91 RenderViewHostDelegate* render_view_delegate, |
| 129 RenderWidgetHostDelegate* render_widget_delegate, | 92 RenderWidgetHostDelegate* render_widget_delegate, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 146 FrameTreeNode* FindByName(const std::string& name); | 109 FrameTreeNode* FindByName(const std::string& name); |
| 147 | 110 |
| 148 // Returns a range to iterate over all FrameTreeNodes in the frame tree in | 111 // Returns a range to iterate over all FrameTreeNodes in the frame tree in |
| 149 // breadth-first traversal order. | 112 // breadth-first traversal order. |
| 150 NodeRange Nodes(); | 113 NodeRange Nodes(); |
| 151 | 114 |
| 152 // Returns a range to iterate over all FrameTreeNodes in a subtree of the | 115 // Returns a range to iterate over all FrameTreeNodes in a subtree of the |
| 153 // frame tree, starting from |subtree_root|. | 116 // frame tree, starting from |subtree_root|. |
| 154 NodeRange SubtreeNodes(FrameTreeNode* subtree_root); | 117 NodeRange SubtreeNodes(FrameTreeNode* subtree_root); |
| 155 | 118 |
| 156 // Returns a range to iterate over all FrameTreeNodes in the frame tree in | |
| 157 // breadth-first traversal order. All FrameTreeNodes returned will be const. | |
| 158 ConstNodeRange ConstNodes() const; | |
| 159 | |
| 160 // Adds a new child frame to the frame tree. |process_id| is required to | 119 // Adds a new child frame to the frame tree. |process_id| is required to |
| 161 // disambiguate |new_routing_id|, and it must match the process of the | 120 // disambiguate |new_routing_id|, and it must match the process of the |
| 162 // |parent| node. Otherwise no child is added and this method returns false. | 121 // |parent| node. Otherwise no child is added and this method returns false. |
| 163 bool AddFrame(FrameTreeNode* parent, | 122 bool AddFrame(FrameTreeNode* parent, |
| 164 int process_id, | 123 int process_id, |
| 165 int new_routing_id, | 124 int new_routing_id, |
| 166 blink::WebTreeScopeType scope, | 125 blink::WebTreeScopeType scope, |
| 167 const std::string& frame_name, | 126 const std::string& frame_name, |
| 168 const std::string& frame_unique_name, | 127 const std::string& frame_unique_name, |
| 169 blink::WebSandboxFlags sandbox_flags, | 128 blink::WebSandboxFlags sandbox_flags, |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 | 254 |
| 296 // Overall load progress. | 255 // Overall load progress. |
| 297 double load_progress_; | 256 double load_progress_; |
| 298 | 257 |
| 299 DISALLOW_COPY_AND_ASSIGN(FrameTree); | 258 DISALLOW_COPY_AND_ASSIGN(FrameTree); |
| 300 }; | 259 }; |
| 301 | 260 |
| 302 } // namespace content | 261 } // namespace content |
| 303 | 262 |
| 304 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ | 263 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ |
| OLD | NEW |