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.
5 #ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_OBSERVER_H_
6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_OBSERVER_H_
10 #include "base/basictypes.h"
12 #include "mojo/services/public/cpp/view_manager/view.h"
13 #include "mojo/services/public/interfaces/input_events/input_events.mojom.h"
19 // A note on -ing and -ed suffixes:
21 // -ing methods are called before changes are applied to the local view model.
22 // -ed methods are called after changes are applied to the local view model.
24 // If the change originated from another connection to the view manager, it's
25 // possible that the change has already been applied to the service-side model
26 // prior to being called, so for example in the case of OnViewDestroying(), it's
27 // possible the view has already been destroyed on the service side.
31 struct TreeChangeParams {
39 virtual void OnTreeChanging(const TreeChangeParams& params) {}
40 virtual void OnTreeChanged(const TreeChangeParams& params) {}
42 virtual void OnViewReordering(View* view,
44 OrderDirection direction) {}
45 virtual void OnViewReordered(View* view,
47 OrderDirection direction) {}
49 virtual void OnViewDestroying(View* view) {}
50 virtual void OnViewDestroyed(View* view) {}
52 virtual void OnViewBoundsChanging(View* view,
53 const Rect& old_bounds,
54 const Rect& new_bounds) {}
55 virtual void OnViewBoundsChanged(View* view,
56 const Rect& old_bounds,
57 const Rect& new_bounds) {}
59 virtual void OnViewFocusChanged(View* gained_focus, View* lost_focus) {}
61 virtual void OnViewInputEvent(View* view, const EventPtr& event) {}
63 virtual void OnViewVisibilityChanging(View* view) {}
64 virtual void OnViewVisibilityChanged(View* view) {}
66 virtual void OnViewPropertyChanged(View* view,
67 const std::string& name,
68 const std::vector<uint8_t>* old_data,
69 const std::vector<uint8_t>* new_data) {}
71 virtual void OnViewEmbeddedAppDisconnected(View* view) {}
73 // Sent when the drawn state changes. This is only sent for the root nodes
75 virtual void OnViewDrawnChanging(View* view) {}
76 virtual void OnViewDrawnChanged(View* view) {}
79 virtual ~ViewObserver() {}
84 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_OBSERVER_H_