OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SERVICES_UI_PUBLIC_CPP_WINDOW_MANAGER_DELEGATE_H_ | 5 #ifndef UI_AURA_MUS_WINDOW_MANAGER_DELEGATE_H_ |
6 #define SERVICES_UI_PUBLIC_CPP_WINDOW_MANAGER_DELEGATE_H_ | 6 #define UI_AURA_MUS_WINDOW_MANAGER_DELEGATE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/callback_forward.h" | 15 #include "base/callback_forward.h" |
16 #include "services/ui/public/interfaces/cursor.mojom.h" | 16 #include "services/ui/public/interfaces/cursor.mojom.h" |
17 #include "services/ui/public/interfaces/event_matcher.mojom.h" | 17 #include "services/ui/public/interfaces/event_matcher.mojom.h" |
18 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 18 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
19 #include "services/ui/public/interfaces/window_tree_constants.mojom.h" | 19 #include "services/ui/public/interfaces/window_tree_constants.mojom.h" |
| 20 #include "ui/aura/aura_export.h" |
20 #include "ui/events/mojo/event.mojom.h" | 21 #include "ui/events/mojo/event.mojom.h" |
21 | 22 |
22 namespace display { | 23 namespace display { |
23 class Display; | 24 class Display; |
24 } | 25 } |
25 | 26 |
26 namespace gfx { | 27 namespace gfx { |
27 class Insets; | 28 class Insets; |
28 class Rect; | 29 class Rect; |
29 class Vector2d; | 30 class Vector2d; |
30 } | 31 } |
31 | 32 |
32 namespace ui { | 33 namespace ui { |
33 class Event; | 34 class Event; |
34 } | 35 } |
35 | 36 |
36 namespace ui { | 37 namespace aura { |
37 | 38 |
38 class Window; | 39 class Window; |
39 | 40 |
40 // See the mojom with the same name for details on the functions in this | 41 // See the mojom with the same name for details on the functions in this |
41 // interface. | 42 // interface. |
42 class WindowManagerClient { | 43 class AURA_EXPORT WindowManagerClient { |
43 public: | 44 public: |
44 virtual void SetFrameDecorationValues( | 45 virtual void SetFrameDecorationValues( |
45 mojom::FrameDecorationValuesPtr values) = 0; | 46 ui::mojom::FrameDecorationValuesPtr values) = 0; |
46 virtual void SetNonClientCursor(Window* window, | 47 virtual void SetNonClientCursor(Window* window, |
47 mojom::Cursor non_client_cursor) = 0; | 48 ui::mojom::Cursor non_client_cursor) = 0; |
48 | 49 |
49 virtual void AddAccelerator(uint32_t id, | 50 virtual void AddAccelerator(uint32_t id, |
50 mojom::EventMatcherPtr event_matcher, | 51 ui::mojom::EventMatcherPtr event_matcher, |
51 const base::Callback<void(bool)>& callback) = 0; | 52 const base::Callback<void(bool)>& callback) = 0; |
52 virtual void RemoveAccelerator(uint32_t id) = 0; | 53 virtual void RemoveAccelerator(uint32_t id) = 0; |
53 virtual void AddActivationParent(Window* window) = 0; | 54 virtual void AddActivationParent(Window* window) = 0; |
54 virtual void RemoveActivationParent(Window* window) = 0; | 55 virtual void RemoveActivationParent(Window* window) = 0; |
55 virtual void ActivateNextWindow() = 0; | 56 virtual void ActivateNextWindow() = 0; |
56 virtual void SetUnderlaySurfaceOffsetAndExtendedHitArea( | 57 virtual void SetUnderlaySurfaceOffsetAndExtendedHitArea( |
57 Window* window, | 58 Window* window, |
58 const gfx::Vector2d& offset, | 59 const gfx::Vector2d& offset, |
59 const gfx::Insets& hit_area) = 0; | 60 const gfx::Insets& hit_area) = 0; |
60 | 61 |
61 protected: | 62 protected: |
62 virtual ~WindowManagerClient() {} | 63 virtual ~WindowManagerClient() {} |
63 }; | 64 }; |
64 | 65 |
65 // Used by clients implementing a window manager. | 66 // Used by clients implementing a window manager. |
66 // TODO(sky): this should be called WindowManager, but that's rather confusing | 67 // TODO(sky): this should be called WindowManager, but that's rather confusing |
67 // currently. | 68 // currently. |
68 class WindowManagerDelegate { | 69 class AURA_EXPORT WindowManagerDelegate { |
69 public: | 70 public: |
70 // Called once to give the delegate access to functions only exposed to | 71 // Called once to give the delegate access to functions only exposed to |
71 // the WindowManager. | 72 // the WindowManager. |
72 virtual void SetWindowManagerClient(WindowManagerClient* client) = 0; | 73 virtual void SetWindowManagerClient(WindowManagerClient* client) = 0; |
73 | 74 |
74 // A client requested the bounds of |window| to change to |bounds|. Return | 75 // A client requested the bounds of |window| to change to |bounds|. Return |
75 // true if the bounds are allowed to change. A return value of false | 76 // true if the bounds are allowed to change. A return value of false |
76 // indicates the change is not allowed. | 77 // indicates the change is not allowed. |
77 // NOTE: This should not change the bounds of |window|. Instead return the | 78 // NOTE: This should not change the bounds of |window|. Instead return the |
78 // bounds the window should be in |bounds|. | 79 // bounds the window should be in |bounds|. |
79 virtual bool OnWmSetBounds(Window* window, gfx::Rect* bounds) = 0; | 80 virtual bool OnWmSetBounds(Window* window, gfx::Rect* bounds) = 0; |
80 | 81 |
81 // A client requested the shared property named |name| to change to | 82 // A client requested the shared property named |name| to change to |
82 // |new_data|. Return true to allow the change to |new_data|, false | 83 // |new_data|. Return true to allow the change to |new_data|, false |
83 // otherwise. | 84 // otherwise. If true is returned the property is set via |
| 85 // PropertyConverter::SetPropertyFromTransportValue(). |
84 virtual bool OnWmSetProperty( | 86 virtual bool OnWmSetProperty( |
85 Window* window, | 87 Window* window, |
86 const std::string& name, | 88 const std::string& name, |
87 std::unique_ptr<std::vector<uint8_t>>* new_data) = 0; | 89 std::unique_ptr<std::vector<uint8_t>>* new_data) = 0; |
88 | 90 |
89 // A client has requested a new top level window. The delegate should create | 91 // A client has requested a new top level window. The delegate should create |
90 // and parent the window appropriately and return it. |properties| is the | 92 // and parent the window appropriately and return it. |properties| is the |
91 // supplied properties from the client requesting the new window. The | 93 // supplied properties from the client requesting the new window. The |
92 // delegate may modify |properties| before calling NewWindow(), but the | 94 // delegate may modify |properties| before calling NewWindow(), but the |
93 // delegate does *not* own |properties|, they are valid only for the life | 95 // delegate does *not* own |properties|, they are valid only for the life |
(...skipping 11 matching lines...) Expand all Loading... |
105 // the specified display. | 107 // the specified display. |
106 virtual void OnWmNewDisplay(Window* window, | 108 virtual void OnWmNewDisplay(Window* window, |
107 const display::Display& display) = 0; | 109 const display::Display& display) = 0; |
108 | 110 |
109 // Called when a display is removed. |window| is the root of the display. | 111 // Called when a display is removed. |window| is the root of the display. |
110 virtual void OnWmDisplayRemoved(Window* window) = 0; | 112 virtual void OnWmDisplayRemoved(Window* window) = 0; |
111 | 113 |
112 // Called when a display is modified. | 114 // Called when a display is modified. |
113 virtual void OnWmDisplayModified(const display::Display& display) = 0; | 115 virtual void OnWmDisplayModified(const display::Display& display) = 0; |
114 | 116 |
115 virtual mojom::EventResult OnAccelerator(uint32_t id, const ui::Event& event); | 117 virtual ui::mojom::EventResult OnAccelerator(uint32_t id, |
| 118 const ui::Event& event); |
116 | 119 |
117 virtual void OnWmPerformMoveLoop( | 120 virtual void OnWmPerformMoveLoop( |
118 Window* window, | 121 Window* window, |
119 ui::mojom::MoveLoopSource source, | 122 ui::mojom::MoveLoopSource source, |
120 const gfx::Point& cursor_location, | 123 const gfx::Point& cursor_location, |
121 const base::Callback<void(bool)>& on_done) = 0; | 124 const base::Callback<void(bool)>& on_done) = 0; |
122 | 125 |
123 virtual void OnWmCancelMoveLoop(Window* window) = 0; | 126 virtual void OnWmCancelMoveLoop(Window* window) = 0; |
124 | 127 |
125 protected: | 128 protected: |
126 virtual ~WindowManagerDelegate() {} | 129 virtual ~WindowManagerDelegate() {} |
127 }; | 130 }; |
128 | 131 |
129 } // namespace ui | 132 } // namespace ui |
130 | 133 |
131 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_MANAGER_DELEGATE_H_ | 134 #endif // UI_AURA_MUS_WINDOW_MANAGER_DELEGATE_H_ |
OLD | NEW |