Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: mojo/services/view_manager/public/cpp/view_observer.h

Issue 1391243003: Move //mojo/services/X/public/... to //mojo/services/X/... (part 4). (Closed) Base URL: https://github.com/domokit/mojo.git@no_public_3-x-no_public_2-x-no_public_1
Patch Set: copyright header Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_VIEW_MANAGER_PUBLIC_CPP_VIEW_OBSERVER_H_
6 #define MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_OBSERVER_H_
7
8 #include <vector>
9
10 #include "input_events/interfaces/input_events.mojom.h"
11 #include "view_manager/public/cpp/view.h"
12
13 namespace mojo {
14
15 class View;
16
17 // A note on -ing and -ed suffixes:
18 //
19 // -ing methods are called before changes are applied to the local view model.
20 // -ed methods are called after changes are applied to the local view model.
21 //
22 // If the change originated from another connection to the view manager, it's
23 // possible that the change has already been applied to the service-side model
24 // prior to being called, so for example in the case of OnViewDestroying(), it's
25 // possible the view has already been destroyed on the service side.
26
27 class ViewObserver {
28 public:
29 struct TreeChangeParams {
30 TreeChangeParams();
31 View* target;
32 View* old_parent;
33 View* new_parent;
34 View* receiver;
35 };
36
37 virtual void OnTreeChanging(const TreeChangeParams& params) {}
38 virtual void OnTreeChanged(const TreeChangeParams& params) {}
39
40 virtual void OnViewReordering(View* view,
41 View* relative_view,
42 OrderDirection direction) {}
43 virtual void OnViewReordered(View* view,
44 View* relative_view,
45 OrderDirection direction) {}
46
47 virtual void OnViewDestroying(View* view) {}
48 virtual void OnViewDestroyed(View* view) {}
49
50 virtual void OnViewBoundsChanging(View* view,
51 const Rect& old_bounds,
52 const Rect& new_bounds) {}
53 virtual void OnViewBoundsChanged(View* view,
54 const Rect& old_bounds,
55 const Rect& new_bounds) {}
56
57 virtual void OnViewViewportMetricsChanged(View* view,
58 const ViewportMetrics& old_bounds,
59 const ViewportMetrics& new_bounds) {
60 }
61
62 virtual void OnViewCaptureChanged(View* gained_capture, View* lost_capture) {}
63 virtual void OnViewFocusChanged(View* gained_focus, View* lost_focus) {}
64 virtual void OnViewActivationChanged(View* gained_active, View* lost_active) {
65 }
66
67 virtual void OnViewInputEvent(View* view, const EventPtr& event) {}
68
69 virtual void OnViewVisibilityChanging(View* view) {}
70 virtual void OnViewVisibilityChanged(View* view) {}
71
72 // Invoked when this View's shared properties have changed. This can either
73 // be caused by SetSharedProperty() being called locally, or by us receiving
74 // a mojo message that this property has changed. If this property has been
75 // added, |old_data| is null. If this property was removed, |new_data| is
76 // null.
77 virtual void OnViewSharedPropertyChanged(
78 View* view,
79 const std::string& name,
80 const std::vector<uint8_t>* old_data,
81 const std::vector<uint8_t>* new_data) {}
82
83 // Invoked when SetProperty() or ClearProperty() is called on the window.
84 // |key| is either a WindowProperty<T>* (SetProperty, ClearProperty). Either
85 // way, it can simply be compared for equality with the property
86 // constant. |old| is the old property value, which must be cast to the
87 // appropriate type before use.
88 virtual void OnViewLocalPropertyChanged(
89 View* view,
90 const void* key,
91 intptr_t old) {}
92
93 virtual void OnViewEmbeddedAppDisconnected(View* view) {}
94
95 // Sent when the drawn state changes. This is only sent for the root nodes
96 // when embedded.
97 virtual void OnViewDrawnChanging(View* view) {}
98 virtual void OnViewDrawnChanged(View* view) {}
99
100 protected:
101 virtual ~ViewObserver() {}
102 };
103
104 } // namespace mojo
105
106 #endif // MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_OBSERVER_H_
OLDNEW
« no previous file with comments | « mojo/services/view_manager/public/cpp/view_manager_delegate.cc ('k') | mojo/services/view_manager/public/cpp/view_property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698