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 Node* GetParent(); | 42 const Node* GetParent() const; |
| 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 } |
43 | 51 |
44 std::vector<Node*> GetChildren(); | 52 std::vector<Node*> GetChildren(); |
45 | 53 |
| 54 bool Contains(const Node* node) const; |
| 55 |
46 // Sets the view associated with this node. Node does not own its View. | 56 // Sets the view associated with this node. Node does not own its View. |
47 void SetView(View* view); | 57 void SetView(View* view); |
48 View* view() { return view_; } | 58 View* view() { return view_; } |
| 59 const View* view() const { return view_; } |
49 | 60 |
50 private: | 61 private: |
51 // WindowObserver overrides: | 62 // WindowObserver overrides: |
52 virtual void OnWindowHierarchyChanged( | 63 virtual void OnWindowHierarchyChanged( |
53 const aura::WindowObserver::HierarchyChangeParams& params) OVERRIDE; | 64 const aura::WindowObserver::HierarchyChangeParams& params) OVERRIDE; |
54 | 65 |
55 // WindowDelegate overrides: | 66 // WindowDelegate overrides: |
56 virtual gfx::Size GetMinimumSize() const OVERRIDE; | 67 virtual gfx::Size GetMinimumSize() const OVERRIDE; |
57 virtual gfx::Size GetMaximumSize() const OVERRIDE; | 68 virtual gfx::Size GetMaximumSize() const OVERRIDE; |
58 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 69 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, |
(...skipping 24 matching lines...) Expand all Loading... |
83 aura::Window window_; | 94 aura::Window window_; |
84 | 95 |
85 DISALLOW_COPY_AND_ASSIGN(Node); | 96 DISALLOW_COPY_AND_ASSIGN(Node); |
86 }; | 97 }; |
87 | 98 |
88 } // namespace service | 99 } // namespace service |
89 } // namespace view_manager | 100 } // namespace view_manager |
90 } // namespace mojo | 101 } // namespace mojo |
91 | 102 |
92 #endif // MOJO_SERVICES_VIEW_MANAGER_NODE_H_ | 103 #endif // MOJO_SERVICES_VIEW_MANAGER_NODE_H_ |
OLD | NEW |