Upstream version 9.37.197.0
[platform/framework/web/crosswalk.git] / src / mojo / services / public / cpp / view_manager / node_observer.h
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
14 namespace gfx {
15 class Rect;
16 }
17
18 namespace mojo {
19 namespace view_manager {
20
21 class Node;
22 class View;
23
24 class NodeObserver {
25  public:
26   enum DispositionChangePhase {
27     DISPOSITION_CHANGING,
28     DISPOSITION_CHANGED
29   };
30
31   struct TreeChangeParams {
32     TreeChangeParams();
33     Node* target;
34     Node* old_parent;
35     Node* new_parent;
36     Node* receiver;
37     DispositionChangePhase phase;
38   };
39
40   virtual void OnTreeChange(const TreeChangeParams& params) {}
41
42   virtual void OnNodeReordered(Node* node,
43                                Node* relative_node,
44                                OrderDirection direction,
45                                DispositionChangePhase phase) {}
46
47   virtual void OnNodeDestroy(Node* node, DispositionChangePhase phase) {}
48
49   virtual void OnNodeActiveViewChange(Node* node,
50                                       View* old_view,
51                                       View* new_view,
52                                       DispositionChangePhase phase) {}
53
54   virtual void OnNodeBoundsChange(Node* node,
55                                   const gfx::Rect& old_bounds,
56                                   const gfx::Rect& new_bounds,
57                                   DispositionChangePhase phase) {}
58
59  protected:
60   virtual ~NodeObserver() {}
61 };
62
63 }  // namespace view_manager
64 }  // namespace mojo
65
66 #endif  // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_NODE_OBSERVER_H_