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

Side by Side Diff: ui/views/mus/native_widget_mus.h

Issue 1979573002: Move mus::InputEventHandler implementation and tests from PlatformWindowMus to NativeWidgetMus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@native_widget_mus5
Patch Set: Drop multiple copies of unittests (AGAIN) Created 4 years, 7 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
« no previous file with comments | « ui/views/mus/BUILD.gn ('k') | ui/views/mus/native_widget_mus.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 13
14 #include "base/callback.h"
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "components/mus/public/cpp/input_event_handler.h"
16 #include "components/mus/public/interfaces/window_tree.mojom.h" 18 #include "components/mus/public/interfaces/window_tree.mojom.h"
17 #include "ui/aura/window_delegate.h" 19 #include "ui/aura/window_delegate.h"
18 #include "ui/aura/window_tree_host_observer.h" 20 #include "ui/aura/window_tree_host_observer.h"
19 #include "ui/platform_window/platform_window_delegate.h" 21 #include "ui/platform_window/platform_window_delegate.h"
20 #include "ui/views/mus/mus_export.h" 22 #include "ui/views/mus/mus_export.h"
23 #include "ui/views/mus/window_tree_host_mus.h"
21 #include "ui/views/widget/native_widget_private.h" 24 #include "ui/views/widget/native_widget_private.h"
22 25
23 namespace aura { 26 namespace aura {
24 namespace client { 27 namespace client {
25 class DefaultCaptureClient; 28 class DefaultCaptureClient;
26 class ScreenPositionClient; 29 class ScreenPositionClient;
27 class WindowTreeClient; 30 class WindowTreeClient;
28 } 31 }
29 class Window; 32 class Window;
30 } 33 }
31 34
32 namespace mus { 35 namespace mus {
33 class Window; 36 class Window;
34 class WindowTreeConnection; 37 class WindowTreeConnection;
35 namespace mojom { 38 namespace mojom {
36 enum class Cursor; 39 enum class Cursor;
40 enum class EventResult;
37 } 41 }
38 } 42 }
39 43
40 namespace shell { 44 namespace shell {
41 class Connector; 45 class Connector;
42 } 46 }
43 47
48 namespace ui {
49 class Event;
50 }
51
44 namespace wm { 52 namespace wm {
45 class CursorManager; 53 class CursorManager;
46 class FocusController; 54 class FocusController;
47 } 55 }
48 56
49 namespace views { 57 namespace views {
50 class SurfaceContextFactory; 58 class SurfaceContextFactory;
51 class WidgetDelegate; 59 class WidgetDelegate;
52 class WindowTreeHostMus;
53 60
54 // An implementation of NativeWidget that binds to a mus::Window. Because Aura 61 // An implementation of NativeWidget that binds to a mus::Window. Because Aura
55 // is used extensively within Views code, this code uses aura and binds to the 62 // is used extensively within Views code, this code uses aura and binds to the
56 // mus::Window via a Mus-specific aura::WindowTreeHost impl. Because the root 63 // mus::Window via a Mus-specific aura::WindowTreeHost impl. Because the root
57 // aura::Window in a hierarchy is created without a delegate by the 64 // aura::Window in a hierarchy is created without a delegate by the
58 // aura::WindowTreeHost, we must create a child aura::Window in this class 65 // aura::WindowTreeHost, we must create a child aura::Window in this class
59 // (content_) and attach it to the root. 66 // (content_) and attach it to the root.
60 class VIEWS_MUS_EXPORT NativeWidgetMus : public internal::NativeWidgetPrivate, 67 class VIEWS_MUS_EXPORT NativeWidgetMus
61 public aura::WindowDelegate, 68 : public internal::NativeWidgetPrivate,
62 public aura::WindowTreeHostObserver { 69 public aura::WindowDelegate,
70 public aura::WindowTreeHostObserver,
71 public NON_EXPORTED_BASE(mus::InputEventHandler) {
63 public: 72 public:
64 NativeWidgetMus(internal::NativeWidgetDelegate* delegate, 73 NativeWidgetMus(internal::NativeWidgetDelegate* delegate,
65 shell::Connector* connector, 74 shell::Connector* connector,
66 mus::Window* window, 75 mus::Window* window,
67 mus::mojom::SurfaceType surface_type); 76 mus::mojom::SurfaceType surface_type);
68 ~NativeWidgetMus() override; 77 ~NativeWidgetMus() override;
69 78
70 // Configures the set of properties supplied to the window manager when 79 // Configures the set of properties supplied to the window manager when
71 // creating a new Window for a Widget. 80 // creating a new Window for a Widget.
72 static void ConfigurePropertiesForNewWindow( 81 static void ConfigurePropertiesForNewWindow(
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 210
202 // Overridden from ui::EventHandler: 211 // Overridden from ui::EventHandler:
203 void OnKeyEvent(ui::KeyEvent* event) override; 212 void OnKeyEvent(ui::KeyEvent* event) override;
204 void OnMouseEvent(ui::MouseEvent* event) override; 213 void OnMouseEvent(ui::MouseEvent* event) override;
205 void OnScrollEvent(ui::ScrollEvent* event) override; 214 void OnScrollEvent(ui::ScrollEvent* event) override;
206 void OnGestureEvent(ui::GestureEvent* event) override; 215 void OnGestureEvent(ui::GestureEvent* event) override;
207 216
208 // Overridden from aura::WindowTreeHostObserver: 217 // Overridden from aura::WindowTreeHostObserver:
209 void OnHostCloseRequested(const aura::WindowTreeHost* host) override; 218 void OnHostCloseRequested(const aura::WindowTreeHost* host) override;
210 219
211 private: 220 // Overridden from mus::InputEventHandler:
221 void OnWindowInputEvent(
222 mus::Window* view,
223 const ui::Event& event,
224 std::unique_ptr<base::Callback<void(mus::mojom::EventResult)>>*
225 ack_callback) override;
226
227 private:
228 friend class NativeWidgetMusTest;
212 class MusWindowObserver; 229 class MusWindowObserver;
213 230
231 ui::PlatformWindowDelegate* platform_window_delegate() {
232 return window_tree_host();
233 }
234
214 void set_last_cursor(mus::mojom::Cursor cursor) { last_cursor_ = cursor; } 235 void set_last_cursor(mus::mojom::Cursor cursor) { last_cursor_ = cursor; }
215 void SetShowState(mus::mojom::ShowState show_state); 236 void SetShowState(mus::mojom::ShowState show_state);
216 237
217 void OnMusWindowVisibilityChanging(mus::Window* window); 238 void OnMusWindowVisibilityChanging(mus::Window* window);
218 void OnMusWindowVisibilityChanged(mus::Window* window); 239 void OnMusWindowVisibilityChanged(mus::Window* window);
219 240
220 mus::Window* window_; 241 mus::Window* window_;
221 mus::mojom::Cursor last_cursor_; 242 mus::mojom::Cursor last_cursor_;
222 243
223 internal::NativeWidgetDelegate* native_widget_delegate_; 244 internal::NativeWidgetDelegate* native_widget_delegate_;
(...skipping 18 matching lines...) Expand all
242 std::unique_ptr<aura::client::ScreenPositionClient> screen_position_client_; 263 std::unique_ptr<aura::client::ScreenPositionClient> screen_position_client_;
243 std::unique_ptr<wm::CursorManager> cursor_manager_; 264 std::unique_ptr<wm::CursorManager> cursor_manager_;
244 base::WeakPtrFactory<NativeWidgetMus> close_widget_factory_; 265 base::WeakPtrFactory<NativeWidgetMus> close_widget_factory_;
245 266
246 DISALLOW_COPY_AND_ASSIGN(NativeWidgetMus); 267 DISALLOW_COPY_AND_ASSIGN(NativeWidgetMus);
247 }; 268 };
248 269
249 } // namespace views 270 } // namespace views
250 271
251 #endif // UI_VIEWS_MUS_NATIVE_WIDGET_MUS_H_ 272 #endif // UI_VIEWS_MUS_NATIVE_WIDGET_MUS_H_
OLDNEW
« no previous file with comments | « ui/views/mus/BUILD.gn ('k') | ui/views/mus/native_widget_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698