| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 class FrameTree; | 26 class FrameTree; |
| 27 class NavigationRequest; | 27 class NavigationRequest; |
| 28 class Navigator; | 28 class Navigator; |
| 29 class RenderFrameHostImpl; | 29 class RenderFrameHostImpl; |
| 30 | 30 |
| 31 // When a page contains iframes, its renderer process maintains a tree structure | 31 // When a page contains iframes, its renderer process maintains a tree structure |
| 32 // of those frames. We are mirroring this tree in the browser process. This | 32 // of those frames. We are mirroring this tree in the browser process. This |
| 33 // class represents a node in this tree and is a wrapper for all objects that | 33 // class represents a node in this tree and is a wrapper for all objects that |
| 34 // are frame-specific (as opposed to page-specific). | 34 // are frame-specific (as opposed to page-specific). |
| 35 class CONTENT_EXPORT FrameTreeNode { | 35 class CONTENT_EXPORT FrameTreeNode : |
| 36 public base::trace_event::TraceLog::EnabledStateObserver { |
| 36 public: | 37 public: |
| 37 class Observer { | 38 class Observer { |
| 38 public: | 39 public: |
| 39 // Invoked when a FrameTreeNode is being destroyed. | 40 // Invoked when a FrameTreeNode is being destroyed. |
| 40 virtual void OnFrameTreeNodeDestroyed(FrameTreeNode* node) {} | 41 virtual void OnFrameTreeNodeDestroyed(FrameTreeNode* node) {} |
| 41 | 42 |
| 42 // Invoked when a FrameTreeNode becomes focused. | 43 // Invoked when a FrameTreeNode becomes focused. |
| 43 virtual void OnFrameTreeNodeFocused(FrameTreeNode* node) {} | 44 virtual void OnFrameTreeNodeFocused(FrameTreeNode* node) {} |
| 44 | 45 |
| 45 virtual ~Observer() {} | 46 virtual ~Observer() {} |
| (...skipping 11 matching lines...) Expand all Loading... |
| 57 Navigator* navigator, | 58 Navigator* navigator, |
| 58 RenderFrameHostDelegate* render_frame_delegate, | 59 RenderFrameHostDelegate* render_frame_delegate, |
| 59 RenderViewHostDelegate* render_view_delegate, | 60 RenderViewHostDelegate* render_view_delegate, |
| 60 RenderWidgetHostDelegate* render_widget_delegate, | 61 RenderWidgetHostDelegate* render_widget_delegate, |
| 61 RenderFrameHostManager::Delegate* manager_delegate, | 62 RenderFrameHostManager::Delegate* manager_delegate, |
| 62 blink::WebTreeScopeType scope, | 63 blink::WebTreeScopeType scope, |
| 63 const std::string& name, | 64 const std::string& name, |
| 64 const std::string& unique_name, | 65 const std::string& unique_name, |
| 65 const blink::WebFrameOwnerProperties& frame_owner_properties); | 66 const blink::WebFrameOwnerProperties& frame_owner_properties); |
| 66 | 67 |
| 67 ~FrameTreeNode(); | 68 ~FrameTreeNode() override; |
| 68 | 69 |
| 69 void AddObserver(Observer* observer); | 70 void AddObserver(Observer* observer); |
| 70 void RemoveObserver(Observer* observer); | 71 void RemoveObserver(Observer* observer); |
| 71 | 72 |
| 72 bool IsMainFrame() const; | 73 bool IsMainFrame() const; |
| 73 | 74 |
| 74 FrameTreeNode* AddChild(scoped_ptr<FrameTreeNode> child, | 75 FrameTreeNode* AddChild(scoped_ptr<FrameTreeNode> child, |
| 75 int process_id, | 76 int process_id, |
| 76 int frame_routing_id); | 77 int frame_routing_id); |
| 77 void RemoveChild(FrameTreeNode* child); | 78 void RemoveChild(FrameTreeNode* child); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 261 |
| 261 // Called when this node becomes focused. Updates the node's last focused | 262 // Called when this node becomes focused. Updates the node's last focused |
| 262 // time and notifies observers. | 263 // time and notifies observers. |
| 263 void DidFocus(); | 264 void DidFocus(); |
| 264 | 265 |
| 265 // Called when the user closed the modal dialogue for BeforeUnload and | 266 // Called when the user closed the modal dialogue for BeforeUnload and |
| 266 // cancelled the navigation. This should stop any load happening in the | 267 // cancelled the navigation. This should stop any load happening in the |
| 267 // FrameTreeNode. | 268 // FrameTreeNode. |
| 268 void BeforeUnloadCanceled(); | 269 void BeforeUnloadCanceled(); |
| 269 | 270 |
| 271 // TraceLog::EnabledStateObserver |
| 272 void OnTraceLogEnabled() override; |
| 273 void OnTraceLogDisabled() override {} |
| 274 |
| 270 private: | 275 private: |
| 271 class OpenerDestroyedObserver; | 276 class OpenerDestroyedObserver; |
| 272 | 277 |
| 273 void set_parent(FrameTreeNode* parent) { parent_ = parent; } | 278 void set_parent(FrameTreeNode* parent) { parent_ = parent; } |
| 274 | 279 |
| 280 void TraceSnapshot() const; |
| 281 |
| 275 // The next available browser-global FrameTreeNode ID. | 282 // The next available browser-global FrameTreeNode ID. |
| 276 static int next_frame_tree_node_id_; | 283 static int next_frame_tree_node_id_; |
| 277 | 284 |
| 278 // The FrameTree that owns us. | 285 // The FrameTree that owns us. |
| 279 FrameTree* frame_tree_; // not owned. | 286 FrameTree* frame_tree_; // not owned. |
| 280 | 287 |
| 281 // The Navigator object responsible for managing navigations at this node | 288 // The Navigator object responsible for managing navigations at this node |
| 282 // of the frame tree. | 289 // of the frame tree. |
| 283 scoped_refptr<Navigator> navigator_; | 290 scoped_refptr<Navigator> navigator_; |
| 284 | 291 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 base::ObserverList<Observer> observers_; | 353 base::ObserverList<Observer> observers_; |
| 347 | 354 |
| 348 base::TimeTicks last_focus_time_; | 355 base::TimeTicks last_focus_time_; |
| 349 | 356 |
| 350 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); | 357 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); |
| 351 }; | 358 }; |
| 352 | 359 |
| 353 } // namespace content | 360 } // namespace content |
| 354 | 361 |
| 355 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ | 362 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ |
| OLD | NEW |