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

Side by Side Diff: components/mus/public/cpp/window_observer.h

Issue 2119963002: Move mus to //services/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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 COMPONENTS_MUS_PUBLIC_CPP_WINDOW_OBSERVER_H_
6 #define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_OBSERVER_H_
7
8 #include <stdint.h>
9
10 #include <vector>
11
12 #include "components/mus/public/cpp/window.h"
13
14 namespace mus {
15
16 class Window;
17
18 // A note on -ing and -ed suffixes:
19 //
20 // -ing methods are called before changes are applied to the local window model.
21 // -ed methods are called after changes are applied to the local window model.
22 //
23 // If the change originated from another connection to the window manager, it's
24 // possible that the change has already been applied to the service-side model
25 // prior to being called, so for example in the case of OnWindowDestroying(),
26 // it's possible the window has already been destroyed on the service side.
27
28 class WindowObserver {
29 public:
30 struct TreeChangeParams {
31 TreeChangeParams();
32 Window* target;
33 Window* old_parent;
34 Window* new_parent;
35 Window* receiver;
36 };
37
38 virtual void OnTreeChanging(const TreeChangeParams& params) {}
39 virtual void OnTreeChanged(const TreeChangeParams& params) {}
40
41 virtual void OnWindowReordering(Window* window,
42 Window* relative_window,
43 mojom::OrderDirection direction) {}
44 virtual void OnWindowReordered(Window* window,
45 Window* relative_window,
46 mojom::OrderDirection direction) {}
47
48 virtual void OnWindowDestroying(Window* window) {}
49 virtual void OnWindowDestroyed(Window* window) {}
50
51 virtual void OnWindowBoundsChanging(Window* window,
52 const gfx::Rect& old_bounds,
53 const gfx::Rect& new_bounds) {}
54 virtual void OnWindowBoundsChanged(Window* window,
55 const gfx::Rect& old_bounds,
56 const gfx::Rect& new_bounds) {}
57 virtual void OnWindowLostCapture(Window* window) {}
58 virtual void OnWindowClientAreaChanged(
59 Window* window,
60 const gfx::Insets& old_client_area,
61 const std::vector<gfx::Rect>& old_additional_client_areas) {}
62
63 virtual void OnWindowFocusChanged(Window* gained_focus, Window* lost_focus) {}
64
65 virtual void OnWindowPredefinedCursorChanged(Window* window,
66 mojom::Cursor cursor) {}
67 virtual void OnWindowVisibilityChanging(Window* window) {}
68 virtual void OnWindowVisibilityChanged(Window* window) {}
69 virtual void OnWindowOpacityChanged(Window* window,
70 float old_opacity,
71 float new_opacity) {}
72
73 // Invoked when this Window's shared properties have changed. This can either
74 // be caused by SetSharedProperty() being called locally, or by us receiving
75 // a mojo message that this property has changed. If this property has been
76 // added, |old_data| is null. If this property was removed, |new_data| is
77 // null.
78 virtual void OnWindowSharedPropertyChanged(
79 Window* window,
80 const std::string& name,
81 const std::vector<uint8_t>* old_data,
82 const std::vector<uint8_t>* new_data) {}
83
84 // Invoked when SetProperty() or ClearProperty() is called on the window.
85 // |key| is either a WindowProperty<T>* (SetProperty, ClearProperty). Either
86 // way, it can simply be compared for equality with the property
87 // constant. |old| is the old property value, which must be cast to the
88 // appropriate type before use.
89 virtual void OnWindowLocalPropertyChanged(Window* window,
90 const void* key,
91 intptr_t old) {}
92
93 virtual void OnWindowEmbeddedAppDisconnected(Window* window) {}
94
95 // Sent when the drawn state changes. This is only sent for the root nodes
96 // when embedded.
97 virtual void OnWindowDrawnChanging(Window* window) {}
98 virtual void OnWindowDrawnChanged(Window* window) {}
99
100 // The WindowManager has requested the window to close. If the observer
101 // allows the close it should destroy the window as appropriate.
102 virtual void OnRequestClose(Window* window) {}
103
104 protected:
105 virtual ~WindowObserver() {}
106 };
107
108 } // namespace mus
109
110 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_OBSERVER_H_
OLDNEW
« no previous file with comments | « components/mus/public/cpp/window_manager_delegate.h ('k') | components/mus/public/cpp/window_property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698