| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_H_ | 5 #ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_H_ |
| 6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_H_ | 6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 class ViewTreeNode { | 27 class ViewTreeNode { |
| 28 public: | 28 public: |
| 29 typedef std::vector<ViewTreeNode*> Children; | 29 typedef std::vector<ViewTreeNode*> Children; |
| 30 | 30 |
| 31 static ViewTreeNode* Create(ViewManager* view_manager); | 31 static ViewTreeNode* Create(ViewManager* view_manager); |
| 32 | 32 |
| 33 // Destroys this node and all its children. | 33 // Destroys this node and all its children. |
| 34 void Destroy(); | 34 void Destroy(); |
| 35 | 35 |
| 36 // Configuration. | 36 // Configuration. |
| 37 TransportNodeId id() const { return id_; } | 37 Id id() const { return id_; } |
| 38 | 38 |
| 39 // Geometric disposition. | 39 // Geometric disposition. |
| 40 const gfx::Rect& bounds() { return bounds_; } | 40 const gfx::Rect& bounds() { return bounds_; } |
| 41 void SetBounds(const gfx::Rect& bounds); | 41 void SetBounds(const gfx::Rect& bounds); |
| 42 | 42 |
| 43 // Observation. | 43 // Observation. |
| 44 void AddObserver(ViewTreeNodeObserver* observer); | 44 void AddObserver(ViewTreeNodeObserver* observer); |
| 45 void RemoveObserver(ViewTreeNodeObserver* observer); | 45 void RemoveObserver(ViewTreeNodeObserver* observer); |
| 46 | 46 |
| 47 // Tree. | 47 // Tree. |
| 48 ViewTreeNode* parent() { return parent_; } | 48 ViewTreeNode* parent() { return parent_; } |
| 49 const ViewTreeNode* parent() const { return parent_; } | 49 const ViewTreeNode* parent() const { return parent_; } |
| 50 const Children& children() const { return children_; } | 50 const Children& children() const { return children_; } |
| 51 | 51 |
| 52 void AddChild(ViewTreeNode* child); | 52 void AddChild(ViewTreeNode* child); |
| 53 void RemoveChild(ViewTreeNode* child); | 53 void RemoveChild(ViewTreeNode* child); |
| 54 | 54 |
| 55 bool Contains(ViewTreeNode* child) const; | 55 bool Contains(ViewTreeNode* child) const; |
| 56 | 56 |
| 57 ViewTreeNode* GetChildById(TransportNodeId id); | 57 ViewTreeNode* GetChildById(Id id); |
| 58 | 58 |
| 59 // View. | 59 // View. |
| 60 void SetActiveView(View* view); | 60 void SetActiveView(View* view); |
| 61 View* active_view() { return active_view_; } | 61 View* active_view() { return active_view_; } |
| 62 | 62 |
| 63 // Embedding. | 63 // Embedding. |
| 64 void Embed(const String& url); | 64 void Embed(const String& url); |
| 65 | 65 |
| 66 protected: | 66 protected: |
| 67 // This class is subclassed only by test classes that provide a public ctor. | 67 // This class is subclassed only by test classes that provide a public ctor. |
| 68 ViewTreeNode(); | 68 ViewTreeNode(); |
| 69 ~ViewTreeNode(); | 69 ~ViewTreeNode(); |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 friend class ViewTreeNodePrivate; | 72 friend class ViewTreeNodePrivate; |
| 73 | 73 |
| 74 explicit ViewTreeNode(ViewManager* manager); | 74 explicit ViewTreeNode(ViewManager* manager); |
| 75 | 75 |
| 76 void LocalDestroy(); | 76 void LocalDestroy(); |
| 77 void LocalAddChild(ViewTreeNode* child); | 77 void LocalAddChild(ViewTreeNode* child); |
| 78 void LocalRemoveChild(ViewTreeNode* child); | 78 void LocalRemoveChild(ViewTreeNode* child); |
| 79 void LocalSetActiveView(View* view); | 79 void LocalSetActiveView(View* view); |
| 80 void LocalSetBounds(const gfx::Rect& old_bounds, const gfx::Rect& new_bounds); | 80 void LocalSetBounds(const gfx::Rect& old_bounds, const gfx::Rect& new_bounds); |
| 81 | 81 |
| 82 ViewManager* manager_; | 82 ViewManager* manager_; |
| 83 TransportNodeId id_; | 83 Id id_; |
| 84 ViewTreeNode* parent_; | 84 ViewTreeNode* parent_; |
| 85 Children children_; | 85 Children children_; |
| 86 | 86 |
| 87 ObserverList<ViewTreeNodeObserver> observers_; | 87 ObserverList<ViewTreeNodeObserver> observers_; |
| 88 | 88 |
| 89 gfx::Rect bounds_; | 89 gfx::Rect bounds_; |
| 90 View* active_view_; | 90 View* active_view_; |
| 91 | 91 |
| 92 DISALLOW_COPY_AND_ASSIGN(ViewTreeNode); | 92 DISALLOW_COPY_AND_ASSIGN(ViewTreeNode); |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 } // namespace view_manager | 95 } // namespace view_manager |
| 96 } // namespace mojo | 96 } // namespace mojo |
| 97 | 97 |
| 98 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_H_ | 98 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_TREE_NODE_H_ |
| OLD | NEW |