| 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 <string> | 10 #include <string> |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // it to serve as an anchor for state that needs to persist across top-level | 34 // it to serve as an anchor for state that needs to persist across top-level |
| 35 // page navigations. | 35 // page navigations. |
| 36 // | 36 // |
| 37 // TODO(ajwong): Move NavigationController ownership to the main frame | 37 // TODO(ajwong): Move NavigationController ownership to the main frame |
| 38 // FrameTreeNode. Possibly expose access to it from here. | 38 // FrameTreeNode. Possibly expose access to it from here. |
| 39 // | 39 // |
| 40 // This object is only used on the UI thread. | 40 // This object is only used on the UI thread. |
| 41 class CONTENT_EXPORT FrameTree { | 41 class CONTENT_EXPORT FrameTree { |
| 42 public: | 42 public: |
| 43 class NodeRange; | 43 class NodeRange; |
| 44 class ConstNodeRange; |
| 44 | 45 |
| 45 class CONTENT_EXPORT NodeIterator { | 46 class CONTENT_EXPORT NodeIterator { |
| 46 public: | 47 public: |
| 47 ~NodeIterator(); | 48 ~NodeIterator(); |
| 48 | 49 |
| 49 NodeIterator& operator++(); | 50 NodeIterator& operator++(); |
| 50 | 51 |
| 51 bool operator==(const NodeIterator& rhs) const; | 52 bool operator==(const NodeIterator& rhs) const; |
| 52 bool operator!=(const NodeIterator& rhs) const { return !(*this == rhs); } | 53 bool operator!=(const NodeIterator& rhs) const { return !(*this == rhs); } |
| 53 | 54 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 70 | 71 |
| 71 private: | 72 private: |
| 72 friend class FrameTree; | 73 friend class FrameTree; |
| 73 | 74 |
| 74 NodeRange(FrameTree* tree, FrameTreeNode* node_to_skip); | 75 NodeRange(FrameTree* tree, FrameTreeNode* node_to_skip); |
| 75 | 76 |
| 76 FrameTree* const tree_; | 77 FrameTree* const tree_; |
| 77 FrameTreeNode* const node_to_skip_; | 78 FrameTreeNode* const node_to_skip_; |
| 78 }; | 79 }; |
| 79 | 80 |
| 81 class CONTENT_EXPORT ConstNodeIterator { |
| 82 public: |
| 83 ~ConstNodeIterator(); |
| 84 |
| 85 ConstNodeIterator& operator++(); |
| 86 |
| 87 bool operator==(const ConstNodeIterator& rhs) const; |
| 88 bool operator!=(const ConstNodeIterator& rhs) const { |
| 89 return !(*this == rhs); |
| 90 } |
| 91 |
| 92 const FrameTreeNode* operator*() { return current_node_; } |
| 93 |
| 94 private: |
| 95 friend class ConstNodeRange; |
| 96 |
| 97 ConstNodeIterator(const FrameTreeNode* starting_node); |
| 98 |
| 99 const FrameTreeNode* current_node_; |
| 100 std::queue<const FrameTreeNode*> queue_; |
| 101 }; |
| 102 |
| 103 class CONTENT_EXPORT ConstNodeRange { |
| 104 public: |
| 105 ConstNodeIterator begin(); |
| 106 ConstNodeIterator end(); |
| 107 |
| 108 private: |
| 109 friend class FrameTree; |
| 110 |
| 111 ConstNodeRange(const FrameTree* tree); |
| 112 |
| 113 const FrameTree* const tree_; |
| 114 }; |
| 115 |
| 80 // Each FrameTreeNode will default to using the given |navigator| for | 116 // Each FrameTreeNode will default to using the given |navigator| for |
| 81 // navigation tasks in the frame. | 117 // navigation tasks in the frame. |
| 82 // A set of delegates are remembered here so that we can create | 118 // A set of delegates are remembered here so that we can create |
| 83 // RenderFrameHostManagers. | 119 // RenderFrameHostManagers. |
| 84 // TODO(creis): This set of delegates will change as we move things to | 120 // TODO(creis): This set of delegates will change as we move things to |
| 85 // Navigator. | 121 // Navigator. |
| 86 FrameTree(Navigator* navigator, | 122 FrameTree(Navigator* navigator, |
| 87 RenderFrameHostDelegate* render_frame_delegate, | 123 RenderFrameHostDelegate* render_frame_delegate, |
| 88 RenderViewHostDelegate* render_view_delegate, | 124 RenderViewHostDelegate* render_view_delegate, |
| 89 RenderWidgetHostDelegate* render_widget_delegate, | 125 RenderWidgetHostDelegate* render_widget_delegate, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 102 // Returns the first frame in this tree with the given |name|, or the main | 138 // Returns the first frame in this tree with the given |name|, or the main |
| 103 // frame if |name| is empty. | 139 // frame if |name| is empty. |
| 104 // Note that this does NOT support pseudo-names like _self, _top, and _blank, | 140 // Note that this does NOT support pseudo-names like _self, _top, and _blank, |
| 105 // nor searching other FrameTrees (unlike blink::WebView::findFrameByName). | 141 // nor searching other FrameTrees (unlike blink::WebView::findFrameByName). |
| 106 FrameTreeNode* FindByName(const std::string& name); | 142 FrameTreeNode* FindByName(const std::string& name); |
| 107 | 143 |
| 108 // Returns a range to iterate over all FrameTreeNodes in the frame tree in | 144 // Returns a range to iterate over all FrameTreeNodes in the frame tree in |
| 109 // breadth-first traversal order. | 145 // breadth-first traversal order. |
| 110 NodeRange Nodes(); | 146 NodeRange Nodes(); |
| 111 | 147 |
| 148 // Returns a range to iterate over all FrameTreeNodes in the frame tree in |
| 149 // breadth-first traversal order. All FrameTreeNodes returned will be const. |
| 150 ConstNodeRange ConstNodes() const; |
| 151 |
| 112 // Adds a new child frame to the frame tree. |process_id| is required to | 152 // Adds a new child frame to the frame tree. |process_id| is required to |
| 113 // disambiguate |new_routing_id|, and it must match the process of the | 153 // disambiguate |new_routing_id|, and it must match the process of the |
| 114 // |parent| node. Otherwise no child is added and this method returns false. | 154 // |parent| node. Otherwise no child is added and this method returns false. |
| 115 bool AddFrame(FrameTreeNode* parent, | 155 bool AddFrame(FrameTreeNode* parent, |
| 116 int process_id, | 156 int process_id, |
| 117 int new_routing_id, | 157 int new_routing_id, |
| 118 blink::WebTreeScopeType scope, | 158 blink::WebTreeScopeType scope, |
| 119 const std::string& frame_name, | 159 const std::string& frame_name, |
| 120 blink::WebSandboxFlags sandbox_flags, | 160 blink::WebSandboxFlags sandbox_flags, |
| 121 const blink::WebFrameOwnerProperties& frame_owner_properties); | 161 const blink::WebFrameOwnerProperties& frame_owner_properties); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 // Updates the overall load progress and notifies the WebContents. | 220 // Updates the overall load progress and notifies the WebContents. |
| 181 void UpdateLoadProgress(); | 221 void UpdateLoadProgress(); |
| 182 | 222 |
| 183 // Returns this FrameTree's total load progress. | 223 // Returns this FrameTree's total load progress. |
| 184 double load_progress() { return load_progress_; } | 224 double load_progress() { return load_progress_; } |
| 185 | 225 |
| 186 // Resets the load progress on all nodes in this FrameTree. | 226 // Resets the load progress on all nodes in this FrameTree. |
| 187 void ResetLoadProgress(); | 227 void ResetLoadProgress(); |
| 188 | 228 |
| 189 // Returns true if at least one of the nodes in this FrameTree is loading. | 229 // Returns true if at least one of the nodes in this FrameTree is loading. |
| 190 bool IsLoading(); | 230 bool IsLoading() const; |
| 191 | 231 |
| 192 // Set page-level focus in all SiteInstances involved in rendering | 232 // Set page-level focus in all SiteInstances involved in rendering |
| 193 // this FrameTree, not including the current main frame's | 233 // this FrameTree, not including the current main frame's |
| 194 // SiteInstance. The focus update will be sent via the main frame's proxies | 234 // SiteInstance. The focus update will be sent via the main frame's proxies |
| 195 // in those SiteInstances. | 235 // in those SiteInstances. |
| 196 void ReplicatePageFocus(bool is_focused); | 236 void ReplicatePageFocus(bool is_focused); |
| 197 | 237 |
| 198 // Updates page-level focus for this FrameTree in the subframe renderer | 238 // Updates page-level focus for this FrameTree in the subframe renderer |
| 199 // identified by |instance|. | 239 // identified by |instance|. |
| 200 void SetPageFocus(SiteInstance* instance, bool is_focused); | 240 void SetPageFocus(SiteInstance* instance, bool is_focused); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 286 |
| 247 // Overall load progress. | 287 // Overall load progress. |
| 248 double load_progress_; | 288 double load_progress_; |
| 249 | 289 |
| 250 DISALLOW_COPY_AND_ASSIGN(FrameTree); | 290 DISALLOW_COPY_AND_ASSIGN(FrameTree); |
| 251 }; | 291 }; |
| 252 | 292 |
| 253 } // namespace content | 293 } // namespace content |
| 254 | 294 |
| 255 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ | 295 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ |
| OLD | NEW |