OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_NODE_OBSERVER_H_ | |
6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_NODE_OBSERVER_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/basictypes.h" | |
11 | |
12 #include "mojo/services/public/cpp/view_manager/node.h" | |
13 #include "mojo/services/public/interfaces/input_events/input_events.mojom.h" | |
14 | |
15 namespace gfx { | |
16 class Rect; | |
17 } | |
18 | |
19 namespace mojo { | |
20 | |
21 class Node; | |
22 class View; | |
23 | |
24 // A note on -ing and -ed suffixes: | |
25 // | |
26 // -ing methods are called before changes are applied to the local node model. | |
27 // -ed methods are called after changes are applied to the local node model. | |
28 // | |
29 // If the change originated from another connection to the view manager, it's | |
30 // possible that the change has already been applied to the service-side model | |
31 // prior to being called, so for example in the case of OnNodeDestroying(), it's | |
32 // possible the node has already been destroyed on the service side. | |
33 | |
34 class NodeObserver { | |
35 public: | |
36 struct TreeChangeParams { | |
37 TreeChangeParams(); | |
38 Node* target; | |
39 Node* old_parent; | |
40 Node* new_parent; | |
41 Node* receiver; | |
42 }; | |
43 | |
44 virtual void OnTreeChanging(const TreeChangeParams& params) {} | |
45 virtual void OnTreeChanged(const TreeChangeParams& params) {} | |
46 | |
47 virtual void OnNodeReordering(Node* node, | |
48 Node* relative_node, | |
49 OrderDirection direction) {} | |
50 virtual void OnNodeReordered(Node* node, | |
51 Node* relative_node, | |
52 OrderDirection direction) {} | |
53 | |
54 virtual void OnNodeDestroying(Node* node) {} | |
55 virtual void OnNodeDestroyed(Node* node) {} | |
56 | |
57 virtual void OnNodeBoundsChanging(Node* node, | |
58 const gfx::Rect& old_bounds, | |
59 const gfx::Rect& new_bounds) {} | |
60 virtual void OnNodeBoundsChanged(Node* node, | |
61 const gfx::Rect& old_bounds, | |
62 const gfx::Rect& new_bounds) {} | |
63 | |
64 virtual void OnNodeFocusChanged(Node* gained_focus, Node* lost_focus) {} | |
65 | |
66 virtual void OnNodeInputEvent(Node* node, const EventPtr& event) {} | |
67 | |
68 protected: | |
69 virtual ~NodeObserver() {} | |
70 }; | |
71 | |
72 } // namespace mojo | |
73 | |
74 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_NODE_OBSERVER_H_ | |
OLD | NEW |