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" |
11 #include "mojo/services/view_manager/ids.h" | 11 #include "mojo/services/view_manager/ids.h" |
12 #include "mojo/services/view_manager/view_manager_export.h" | 12 #include "mojo/services/view_manager/view_manager_export.h" |
13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
14 #include "ui/aura/window_delegate.h" | 14 #include "ui/aura/window_delegate.h" |
15 #include "ui/aura/window_observer.h" | 15 #include "ui/aura/window_observer.h" |
16 | 16 |
17 namespace mojo { | 17 namespace mojo { |
18 namespace services { | 18 namespace services { |
19 namespace view_manager { | 19 namespace view_manager { |
20 | 20 |
21 class NodeDelegate; | 21 class NodeDelegate; |
| 22 namespace service { |
22 class View; | 23 class View; |
| 24 } |
23 | 25 |
24 // Represents a node in the graph. Delegate is informed of interesting events. | 26 // Represents a node in the graph. Delegate is informed of interesting events. |
25 class MOJO_VIEW_MANAGER_EXPORT Node | 27 class MOJO_VIEW_MANAGER_EXPORT Node |
26 : public aura::WindowObserver, | 28 : public aura::WindowObserver, |
27 public aura::WindowDelegate { | 29 public aura::WindowDelegate { |
28 public: | 30 public: |
29 Node(NodeDelegate* delegate, const NodeId& id); | 31 Node(NodeDelegate* delegate, const NodeId& id); |
30 virtual ~Node(); | 32 virtual ~Node(); |
31 | 33 |
32 void set_view_id(const ViewId& view_id) { view_id_ = view_id; } | 34 void set_view_id(const ViewId& view_id) { view_id_ = view_id; } |
33 const ViewId& view_id() const { return view_id_; } | 35 const ViewId& view_id() const { return view_id_; } |
34 | 36 |
35 const NodeId& id() const { return id_; } | 37 const NodeId& id() const { return id_; } |
36 | 38 |
37 void Add(Node* child); | 39 void Add(Node* child); |
38 void Remove(Node* child); | 40 void Remove(Node* child); |
39 | 41 |
40 aura::Window* window() { return &window_; } | 42 aura::Window* window() { return &window_; } |
41 | 43 |
42 Node* GetParent(); | 44 Node* GetParent(); |
43 | 45 |
44 std::vector<Node*> GetChildren(); | 46 std::vector<Node*> GetChildren(); |
45 | 47 |
46 // Sets the view associated with this node. Node does not own its View. | 48 // Sets the view associated with this node. Node does not own its View. |
47 void SetView(View* view); | 49 void SetView(service::View* view); |
48 View* view() { return view_; } | 50 service::View* view() { return view_; } |
49 | 51 |
50 private: | 52 private: |
51 // WindowObserver overrides: | 53 // WindowObserver overrides: |
52 virtual void OnWindowHierarchyChanged( | 54 virtual void OnWindowHierarchyChanged( |
53 const aura::WindowObserver::HierarchyChangeParams& params) OVERRIDE; | 55 const aura::WindowObserver::HierarchyChangeParams& params) OVERRIDE; |
54 | 56 |
55 // WindowDelegate overrides: | 57 // WindowDelegate overrides: |
56 virtual gfx::Size GetMinimumSize() const OVERRIDE; | 58 virtual gfx::Size GetMinimumSize() const OVERRIDE; |
57 virtual gfx::Size GetMaximumSize() const OVERRIDE; | 59 virtual gfx::Size GetMaximumSize() const OVERRIDE; |
58 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 60 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, |
(...skipping 10 matching lines...) Expand all Loading... |
69 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; | 71 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; |
70 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; | 72 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
71 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE; | 73 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE; |
72 virtual bool HasHitTestMask() const OVERRIDE; | 74 virtual bool HasHitTestMask() const OVERRIDE; |
73 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; | 75 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; |
74 | 76 |
75 NodeDelegate* delegate_; | 77 NodeDelegate* delegate_; |
76 const NodeId id_; | 78 const NodeId id_; |
77 | 79 |
78 // Weak pointer to view associated with this node. | 80 // Weak pointer to view associated with this node. |
79 View* view_; | 81 service::View* view_; |
80 | 82 |
81 ViewId view_id_; | 83 ViewId view_id_; |
82 | 84 |
83 aura::Window window_; | 85 aura::Window window_; |
84 | 86 |
85 DISALLOW_COPY_AND_ASSIGN(Node); | 87 DISALLOW_COPY_AND_ASSIGN(Node); |
86 }; | 88 }; |
87 | 89 |
88 } // namespace view_manager | 90 } // namespace view_manager |
89 } // namespace services | 91 } // namespace services |
90 } // namespace mojo | 92 } // namespace mojo |
91 | 93 |
92 #endif // MOJO_SERVICES_VIEW_MANAGER_NODE_H_ | 94 #endif // MOJO_SERVICES_VIEW_MANAGER_NODE_H_ |
OLD | NEW |