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

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

Issue 861683003: Move services code brought in from Mojo to live under //third_party. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 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 "base/basictypes.h"
11
12 #include "input_events/public/interfaces/input_events.mojom.h"
13 #include "view_manager/public/cpp/view.h"
14
15 namespace mojo {
16
17 class View;
18
19 // A note on -ing and -ed suffixes:
20 //
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.
23 //
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.
28
29 class ViewObserver {
30 public:
31 struct TreeChangeParams {
32 TreeChangeParams();
33 View* target;
34 View* old_parent;
35 View* new_parent;
36 View* receiver;
37 };
38
39 virtual void OnTreeChanging(const TreeChangeParams& params) {}
40 virtual void OnTreeChanged(const TreeChangeParams& params) {}
41
42 virtual void OnViewReordering(View* view,
43 View* relative_view,
44 OrderDirection direction) {}
45 virtual void OnViewReordered(View* view,
46 View* relative_view,
47 OrderDirection direction) {}
48
49 virtual void OnViewDestroying(View* view) {}
50 virtual void OnViewDestroyed(View* view) {}
51
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) {}
58
59 virtual void OnViewViewportMetricsChanged(View* view,
60 const ViewportMetrics& old_bounds,
61 const ViewportMetrics& new_bounds) {
62 }
63
64 virtual void OnCaptureChanged(View* gained_capture, View* lost_capture) {}
65 virtual void OnViewFocusChanged(View* gained_focus, View* lost_focus) {}
66 virtual void OnViewActivationChanged(View* gained_active, View* lost_active) {
67 }
68
69 virtual void OnViewInputEvent(View* view, const EventPtr& event) {}
70
71 virtual void OnViewVisibilityChanging(View* view) {}
72 virtual void OnViewVisibilityChanged(View* view) {}
73
74 // Invoked when this View's shared properties have changed. This can either
75 // be caused by SetSharedProperty() being called locally, or by us receiving
76 // a mojo message that this property has changed. If this property has been
77 // added, |old_data| is null. If this property was removed, |new_data| is
78 // null.
79 virtual void OnViewSharedPropertyChanged(
80 View* view,
81 const std::string& name,
82 const std::vector<uint8_t>* old_data,
83 const std::vector<uint8_t>* new_data) {}
84
85 // Invoked when SetProperty() or ClearProperty() is called on the window.
86 // |key| is either a WindowProperty<T>* (SetProperty, ClearProperty). Either
87 // way, it can simply be compared for equality with the property
88 // constant. |old| is the old property value, which must be cast to the
89 // appropriate type before use.
90 virtual void OnViewLocalPropertyChanged(
91 View* view,
92 const void* key,
93 intptr_t old) {}
94
95 virtual void OnViewEmbeddedAppDisconnected(View* view) {}
96
97 // Sent when the drawn state changes. This is only sent for the root nodes
98 // when embedded.
99 virtual void OnViewDrawnChanging(View* view) {}
100 virtual void OnViewDrawnChanged(View* view) {}
101
102 protected:
103 virtual ~ViewObserver() {}
104 };
105
106 } // namespace mojo
107
108 #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.h ('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