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/public/interfaces/view_manager/view_manager.mojom.h" |
11 #include "mojo/services/view_manager/ids.h" | 12 #include "mojo/services/view_manager/ids.h" |
12 #include "mojo/services/view_manager/view_manager_export.h" | 13 #include "mojo/services/view_manager/view_manager_export.h" |
13 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
14 #include "ui/aura/window_delegate.h" | 15 #include "ui/aura/window_delegate.h" |
15 #include "ui/aura/window_observer.h" | 16 #include "ui/aura/window_observer.h" |
16 | 17 |
17 namespace mojo { | 18 namespace mojo { |
18 namespace view_manager { | 19 namespace view_manager { |
19 namespace service { | 20 namespace service { |
20 | 21 |
21 class NodeDelegate; | 22 class NodeDelegate; |
22 class View; | 23 class View; |
23 | 24 |
24 // Represents a node in the graph. Delegate is informed of interesting events. | 25 // Represents a node in the graph. Delegate is informed of interesting events. |
25 class MOJO_VIEW_MANAGER_EXPORT Node | 26 class MOJO_VIEW_MANAGER_EXPORT Node |
26 : public aura::WindowObserver, | 27 : public aura::WindowObserver, |
27 public aura::WindowDelegate { | 28 public aura::WindowDelegate { |
28 public: | 29 public: |
29 Node(NodeDelegate* delegate, const NodeId& id); | 30 Node(NodeDelegate* delegate, const NodeId& id); |
30 virtual ~Node(); | 31 virtual ~Node(); |
31 | 32 |
32 void set_view_id(const ViewId& view_id) { view_id_ = view_id; } | 33 void set_view_id(const ViewId& view_id) { view_id_ = view_id; } |
33 const ViewId& view_id() const { return view_id_; } | 34 const ViewId& view_id() const { return view_id_; } |
34 | 35 |
35 const NodeId& id() const { return id_; } | 36 const NodeId& id() const { return id_; } |
36 | 37 |
37 void Add(Node* child); | 38 void Add(Node* child); |
38 void Remove(Node* child); | 39 void Remove(Node* child); |
39 | 40 |
| 41 void Reorder(Node* child, Node* relative, OrderDirection direction); |
| 42 |
40 aura::Window* window() { return &window_; } | 43 aura::Window* window() { return &window_; } |
41 | 44 |
42 const gfx::Rect& bounds() const { return window_.bounds(); } | 45 const gfx::Rect& bounds() const { return window_.bounds(); } |
43 | 46 |
44 const Node* GetParent() const; | 47 const Node* GetParent() const; |
45 Node* GetParent() { | 48 Node* GetParent() { |
46 return const_cast<Node*>(const_cast<const Node*>(this)->GetParent()); | 49 return const_cast<Node*>(const_cast<const Node*>(this)->GetParent()); |
47 } | 50 } |
48 | 51 |
49 const Node* GetRoot() const; | 52 const Node* GetRoot() const; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 aura::Window window_; | 103 aura::Window window_; |
101 | 104 |
102 DISALLOW_COPY_AND_ASSIGN(Node); | 105 DISALLOW_COPY_AND_ASSIGN(Node); |
103 }; | 106 }; |
104 | 107 |
105 } // namespace service | 108 } // namespace service |
106 } // namespace view_manager | 109 } // namespace view_manager |
107 } // namespace mojo | 110 } // namespace mojo |
108 | 111 |
109 #endif // MOJO_SERVICES_VIEW_MANAGER_NODE_H_ | 112 #endif // MOJO_SERVICES_VIEW_MANAGER_NODE_H_ |
OLD | NEW |