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_VIEW_MANAGER_NODE_H_ | 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_NODE_H_ |
6 #define MOJO_SERVICES_VIEW_MANAGER_NODE_H_ | 6 #define MOJO_SERVICES_VIEW_MANAGER_NODE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 void set_view_id(const ViewId& view_id) { view_id_ = view_id; } | 32 void set_view_id(const ViewId& view_id) { view_id_ = view_id; } |
33 const ViewId& view_id() const { return view_id_; } | 33 const ViewId& view_id() const { return view_id_; } |
34 | 34 |
35 const NodeId& id() const { return id_; } | 35 const NodeId& id() const { return id_; } |
36 | 36 |
37 void Add(Node* child); | 37 void Add(Node* child); |
38 void Remove(Node* child); | 38 void Remove(Node* child); |
39 | 39 |
40 aura::Window* window() { return &window_; } | 40 aura::Window* window() { return &window_; } |
41 | 41 |
42 const Node* GetParent() const; | 42 Node* GetParent(); |
43 Node* GetParent() { | |
44 return const_cast<Node*>(const_cast<const Node*>(this)->GetParent()); | |
45 } | |
46 | |
47 const Node* GetRoot() const; | |
48 Node* GetRoot() { | |
49 return const_cast<Node*>(const_cast<const Node*>(this)->GetRoot()); | |
50 } | |
51 | 43 |
52 std::vector<Node*> GetChildren(); | 44 std::vector<Node*> GetChildren(); |
53 | 45 |
54 bool Contains(const Node* node) const; | |
55 | |
56 // Sets the view associated with this node. Node does not own its View. | 46 // Sets the view associated with this node. Node does not own its View. |
57 void SetView(View* view); | 47 void SetView(View* view); |
58 View* view() { return view_; } | 48 View* view() { return view_; } |
59 const View* view() const { return view_; } | |
60 | 49 |
61 private: | 50 private: |
62 // WindowObserver overrides: | 51 // WindowObserver overrides: |
63 virtual void OnWindowHierarchyChanged( | 52 virtual void OnWindowHierarchyChanged( |
64 const aura::WindowObserver::HierarchyChangeParams& params) OVERRIDE; | 53 const aura::WindowObserver::HierarchyChangeParams& params) OVERRIDE; |
65 | 54 |
66 // WindowDelegate overrides: | 55 // WindowDelegate overrides: |
67 virtual gfx::Size GetMinimumSize() const OVERRIDE; | 56 virtual gfx::Size GetMinimumSize() const OVERRIDE; |
68 virtual gfx::Size GetMaximumSize() const OVERRIDE; | 57 virtual gfx::Size GetMaximumSize() const OVERRIDE; |
69 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 58 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, |
(...skipping 24 matching lines...) Expand all Loading... |
94 aura::Window window_; | 83 aura::Window window_; |
95 | 84 |
96 DISALLOW_COPY_AND_ASSIGN(Node); | 85 DISALLOW_COPY_AND_ASSIGN(Node); |
97 }; | 86 }; |
98 | 87 |
99 } // namespace service | 88 } // namespace service |
100 } // namespace view_manager | 89 } // namespace view_manager |
101 } // namespace mojo | 90 } // namespace mojo |
102 | 91 |
103 #endif // MOJO_SERVICES_VIEW_MANAGER_NODE_H_ | 92 #endif // MOJO_SERVICES_VIEW_MANAGER_NODE_H_ |
OLD | NEW |