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 UI_VIEWS_MUS_NATIVE_WIDGET_MUS_H_ | 5 #ifndef UI_VIEWS_MUS_NATIVE_WIDGET_MUS_H_ |
6 #define UI_VIEWS_MUS_NATIVE_WIDGET_MUS_H_ | 6 #define UI_VIEWS_MUS_NATIVE_WIDGET_MUS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // aura::Window in a hierarchy is created without a delegate by the | 69 // aura::Window in a hierarchy is created without a delegate by the |
70 // aura::WindowTreeHost, we must create a child aura::Window in this class | 70 // aura::WindowTreeHost, we must create a child aura::Window in this class |
71 // (content_) and attach it to the root. | 71 // (content_) and attach it to the root. |
72 class VIEWS_MUS_EXPORT NativeWidgetMus | 72 class VIEWS_MUS_EXPORT NativeWidgetMus |
73 : public internal::NativeWidgetPrivate, | 73 : public internal::NativeWidgetPrivate, |
74 public aura::WindowDelegate, | 74 public aura::WindowDelegate, |
75 public aura::WindowTreeHostObserver, | 75 public aura::WindowTreeHostObserver, |
76 public aura::client::DragDropDelegate, | 76 public aura::client::DragDropDelegate, |
77 public NON_EXPORTED_BASE(ui::InputEventHandler) { | 77 public NON_EXPORTED_BASE(ui::InputEventHandler) { |
78 public: | 78 public: |
79 NativeWidgetMus(internal::NativeWidgetDelegate* delegate, | 79 NativeWidgetMus( |
80 ui::Window* window, | 80 internal::NativeWidgetDelegate* delegate, |
81 ui::mojom::SurfaceType surface_type); | 81 ui::Window* window, |
| 82 ui::mojom::CompositorFrameSinkType compositor_frame_sink_type); |
82 ~NativeWidgetMus() override; | 83 ~NativeWidgetMus() override; |
83 | 84 |
84 // Configures the set of properties supplied to the window manager when | 85 // Configures the set of properties supplied to the window manager when |
85 // creating a new Window for a Widget. | 86 // creating a new Window for a Widget. |
86 static void ConfigurePropertiesForNewWindow( | 87 static void ConfigurePropertiesForNewWindow( |
87 const Widget::InitParams& init_params, | 88 const Widget::InitParams& init_params, |
88 std::map<std::string, std::vector<uint8_t>>* properties); | 89 std::map<std::string, std::vector<uint8_t>>* properties); |
89 | 90 |
90 // Notifies all widgets the frame constants changed in some way. | 91 // Notifies all widgets the frame constants changed in some way. |
91 static void NotifyFrameChanged(ui::WindowTreeClient* client); | 92 static void NotifyFrameChanged(ui::WindowTreeClient* client); |
92 | 93 |
93 // Returns the native widget for a ui::Window, or null if there is none. | 94 // Returns the native widget for a ui::Window, or null if there is none. |
94 static NativeWidgetMus* GetForWindow(ui::Window* window); | 95 static NativeWidgetMus* GetForWindow(ui::Window* window); |
95 | 96 |
96 // Returns the widget for a ui::Window, or null if there is none. | 97 // Returns the widget for a ui::Window, or null if there is none. |
97 static Widget* GetWidgetForWindow(ui::Window* window); | 98 static Widget* GetWidgetForWindow(ui::Window* window); |
98 | 99 |
99 ui::mojom::SurfaceType surface_type() const { return surface_type_; } | 100 ui::mojom::CompositorFrameSinkType compositor_frame_sink_type() const { |
| 101 return compositor_frame_sink_type_; |
| 102 } |
100 ui::Window* window() { return window_; } | 103 ui::Window* window() { return window_; } |
101 WindowTreeHostMus* window_tree_host() { return window_tree_host_.get(); } | 104 WindowTreeHostMus* window_tree_host() { return window_tree_host_.get(); } |
102 | 105 |
103 aura::Window* GetRootWindow(); | 106 aura::Window* GetRootWindow(); |
104 | 107 |
105 void OnPlatformWindowClosed(); | 108 void OnPlatformWindowClosed(); |
106 void OnActivationChanged(bool active); | 109 void OnActivationChanged(bool active); |
107 | 110 |
108 protected: | 111 protected: |
109 // Updates the client area in the ui::Window. | 112 // Updates the client area in the ui::Window. |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 class MusWindowObserver; | 250 class MusWindowObserver; |
248 class MusCaptureClient; | 251 class MusCaptureClient; |
249 | 252 |
250 ui::PlatformWindowDelegate* platform_window_delegate() { | 253 ui::PlatformWindowDelegate* platform_window_delegate() { |
251 return window_tree_host(); | 254 return window_tree_host(); |
252 } | 255 } |
253 | 256 |
254 // Returns true if this NativeWidgetMus exists on the window manager side | 257 // Returns true if this NativeWidgetMus exists on the window manager side |
255 // to provide the frame decorations. | 258 // to provide the frame decorations. |
256 bool is_parallel_widget_in_window_manager() { | 259 bool is_parallel_widget_in_window_manager() { |
257 return surface_type_ == ui::mojom::SurfaceType::UNDERLAY; | 260 return compositor_frame_sink_type_ == |
| 261 ui::mojom::CompositorFrameSinkType::UNDERLAY; |
258 } | 262 } |
259 | 263 |
260 void set_last_cursor(ui::mojom::Cursor cursor) { last_cursor_ = cursor; } | 264 void set_last_cursor(ui::mojom::Cursor cursor) { last_cursor_ = cursor; } |
261 void SetShowState(ui::mojom::ShowState show_state); | 265 void SetShowState(ui::mojom::ShowState show_state); |
262 | 266 |
263 void OnMusWindowVisibilityChanging(ui::Window* window, bool visible); | 267 void OnMusWindowVisibilityChanging(ui::Window* window, bool visible); |
264 void OnMusWindowVisibilityChanged(ui::Window* window, bool visible); | 268 void OnMusWindowVisibilityChanged(ui::Window* window, bool visible); |
265 | 269 |
266 // Propagates the widget hit test mask, if any, to the ui::Window. | 270 // Propagates the widget hit test mask, if any, to the ui::Window. |
267 // TODO(jamescook): Wire this through views::Widget so widgets can push | 271 // TODO(jamescook): Wire this through views::Widget so widgets can push |
268 // updates if needed. | 272 // updates if needed. |
269 void UpdateHitTestMask(); | 273 void UpdateHitTestMask(); |
270 | 274 |
271 ui::Window* window_; | 275 ui::Window* window_; |
272 ui::mojom::Cursor last_cursor_; | 276 ui::mojom::Cursor last_cursor_; |
273 | 277 |
274 internal::NativeWidgetDelegate* native_widget_delegate_; | 278 internal::NativeWidgetDelegate* native_widget_delegate_; |
275 | 279 |
276 const ui::mojom::SurfaceType surface_type_; | 280 const ui::mojom::CompositorFrameSinkType compositor_frame_sink_type_; |
277 ui::mojom::ShowState show_state_before_fullscreen_; | 281 ui::mojom::ShowState show_state_before_fullscreen_; |
278 | 282 |
279 // See class documentation for Widget in widget.h for a note about ownership. | 283 // See class documentation for Widget in widget.h for a note about ownership. |
280 Widget::InitParams::Ownership ownership_; | 284 Widget::InitParams::Ownership ownership_; |
281 | 285 |
282 // Functions with the same name require the ui::WindowObserver to be in | 286 // Functions with the same name require the ui::WindowObserver to be in |
283 // a separate class. | 287 // a separate class. |
284 std::unique_ptr<MusWindowObserver> mus_window_observer_; | 288 std::unique_ptr<MusWindowObserver> mus_window_observer_; |
285 | 289 |
286 // Receives drop events for |window_|. | 290 // Receives drop events for |window_|. |
(...skipping 18 matching lines...) Expand all Loading... |
305 std::unique_ptr<InputMethodMus> input_method_; | 309 std::unique_ptr<InputMethodMus> input_method_; |
306 | 310 |
307 base::WeakPtrFactory<NativeWidgetMus> close_widget_factory_; | 311 base::WeakPtrFactory<NativeWidgetMus> close_widget_factory_; |
308 | 312 |
309 DISALLOW_COPY_AND_ASSIGN(NativeWidgetMus); | 313 DISALLOW_COPY_AND_ASSIGN(NativeWidgetMus); |
310 }; | 314 }; |
311 | 315 |
312 } // namespace views | 316 } // namespace views |
313 | 317 |
314 #endif // UI_VIEWS_MUS_NATIVE_WIDGET_MUS_H_ | 318 #endif // UI_VIEWS_MUS_NATIVE_WIDGET_MUS_H_ |
OLD | NEW |