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

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

Issue 2471033005: Adds DesktopWindowTreeHostMus (Closed)
Patch Set: fix Created 4 years, 1 month 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_MUS_CLIENT_INIT_H_ 5 #ifndef UI_VIEWS_MUS_MUS_CLIENT_INIT_H_
6 #define UI_VIEWS_MUS_MUS_CLIENT_INIT_H_ 6 #define UI_VIEWS_MUS_MUS_CLIENT_INIT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "ui/aura/mus/window_tree_client_delegate.h" 11 #include "ui/aura/mus/window_tree_client_delegate.h"
12 #include "ui/base/dragdrop/os_exchange_data_provider_factory.h" 12 #include "ui/base/dragdrop/os_exchange_data_provider_factory.h"
13 #include "ui/views/mus/mus_export.h" 13 #include "ui/views/mus/mus_export.h"
14 #include "ui/views/mus/screen_mus_delegate.h" 14 #include "ui/views/mus/screen_mus_delegate.h"
15 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
16 16
17 namespace aura { 17 namespace aura {
18 class Env; 18 class Env;
19 class PropertyConverter; 19 class PropertyConverter;
20 class Window; 20 class Window;
21 class WindowPort;
22 class WindowTreeClient; 21 class WindowTreeClient;
23 } 22 }
24 23
25 namespace base { 24 namespace base {
26 class SingleThreadTaskRunner; 25 class SingleThreadTaskRunner;
27 } 26 }
28 27
29 namespace service_manager { 28 namespace service_manager {
30 class Connector; 29 class Connector;
31 class Identity; 30 class Identity;
32 } 31 }
33 32
34 namespace ui { 33 namespace ui {
35 class GpuService; 34 class GpuService;
36 } 35 }
37 36
38 namespace wm { 37 namespace wm {
39 class FocusController; 38 class FocusController;
40 class WMState; 39 class WMState;
41 } 40 }
42 41
43 namespace views { 42 namespace views {
44 43
45 class AuraInit;
46 class ScreenMus; 44 class ScreenMus;
47 class SurfaceContextFactory; 45 class SurfaceContextFactory;
48 46
49 namespace internal { 47 namespace internal {
50 class NativeWidgetDelegate; 48 class NativeWidgetDelegate;
51 } 49 }
52 50
51 namespace test {
52 class MusClientTestApi;
53 }
54
53 // MusClient establishes a connection to mus and sets up necessary state so that 55 // MusClient establishes a connection to mus and sets up necessary state so that
54 // aura and views target mus. This class is useful for typical clients, not the 56 // aura and views target mus. This class is useful for typical clients, not the
55 // WindowManager. 57 // WindowManager. This class is created by AuraInit when
58 // AuraInit::Mode::AURA_MUS is passed as the mode.
59 // AuraInit::Mode::AURA to AuraInit and MusClient will be created for us.
56 class VIEWS_MUS_EXPORT MusClient 60 class VIEWS_MUS_EXPORT MusClient
57 : public aura::WindowTreeClientDelegate, 61 : public aura::WindowTreeClientDelegate,
58 public ScreenMusDelegate, 62 public ScreenMusDelegate,
59 public ui::OSExchangeDataProviderFactory::Factory { 63 public ui::OSExchangeDataProviderFactory::Factory {
60 public: 64 public:
65 ~MusClient() override;
66
67 static MusClient* Get() { return instance_; }
68
69 service_manager::Connector* connector() { return connector_; }
70
71 aura::WindowTreeClient* window_tree_client() {
72 return window_tree_client_.get();
73 }
74
75 // Creates DesktopNativeWidgetAura with DesktopWindowTreeHostMus. This is
76 // set as the factory function used for creating NativeWidgets when a
77 // NativeWidget has not been explicitly set.
78 NativeWidget* CreateNativeWidget(const Widget::InitParams& init_params,
79 internal::NativeWidgetDelegate* delegate);
80
81 private:
82 friend class AuraInit;
83 friend class test::MusClientTestApi;
84
61 MusClient( 85 MusClient(
62 service_manager::Connector* connector, 86 service_manager::Connector* connector,
63 const service_manager::Identity& identity, 87 const service_manager::Identity& identity,
64 const std::string& resource_file,
65 const std::string& resource_file_200 = std::string(),
66 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = nullptr); 88 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = nullptr);
67 ~MusClient() override;
68
69 service_manager::Connector* connector() { return connector_; }
70
71 private:
72 NativeWidget* CreateNativeWidget(const Widget::InitParams& init_params,
73 internal::NativeWidgetDelegate* delegate);
74
75 // Creates aura::WindowPortMus.
76 std::unique_ptr<aura::WindowPort> CreateWindowPort(aura::Window* window);
77 89
78 // aura::WindowTreeClientDelegate: 90 // aura::WindowTreeClientDelegate:
79 void OnEmbed( 91 void OnEmbed(
80 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) override; 92 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) override;
81 void OnLostConnection(aura::WindowTreeClient* client) override; 93 void OnLostConnection(aura::WindowTreeClient* client) override;
82 void OnEmbedRootDestroyed(aura::Window* root) override; 94 void OnEmbedRootDestroyed(aura::Window* root) override;
83 void OnPointerEventObserved(const ui::PointerEvent& event, 95 void OnPointerEventObserved(const ui::PointerEvent& event,
84 aura::Window* target) override; 96 aura::Window* target) override;
85 aura::client::FocusClient* GetFocusClient() override; 97 aura::client::FocusClient* GetFocusClient() override;
86 aura::client::CaptureClient* GetCaptureClient() override; 98 aura::client::CaptureClient* GetCaptureClient() override;
87 aura::PropertyConverter* GetPropertyConverter() override; 99 aura::PropertyConverter* GetPropertyConverter() override;
88 100
89 // ScreenMusDelegate: 101 // ScreenMusDelegate:
90 void OnWindowManagerFrameValuesChanged() override; 102 void OnWindowManagerFrameValuesChanged() override;
91 gfx::Point GetCursorScreenPoint() override; 103 gfx::Point GetCursorScreenPoint() override;
92 aura::Window* GetWindowAtScreenPoint(const gfx::Point& point) override; 104 aura::Window* GetWindowAtScreenPoint(const gfx::Point& point) override;
93 105
94 // ui:OSExchangeDataProviderFactory::Factory: 106 // ui:OSExchangeDataProviderFactory::Factory:
95 std::unique_ptr<OSExchangeData::Provider> BuildProvider() override; 107 std::unique_ptr<OSExchangeData::Provider> BuildProvider() override;
96 108
109 static MusClient* instance_;
110
97 service_manager::Connector* connector_; 111 service_manager::Connector* connector_;
98 service_manager::Identity identity_; 112 service_manager::Identity identity_;
99 113
100 std::unique_ptr<AuraInit> aura_init_;
101
102 std::unique_ptr<wm::WMState> wm_state_; 114 std::unique_ptr<wm::WMState> wm_state_;
103 115
104 std::unique_ptr<ScreenMus> screen_; 116 std::unique_ptr<ScreenMus> screen_;
105 117
106 std::unique_ptr<wm::FocusController> focus_controller_; 118 std::unique_ptr<wm::FocusController> focus_controller_;
107 119
108 std::unique_ptr<aura::PropertyConverter> property_converter_; 120 std::unique_ptr<aura::PropertyConverter> property_converter_;
109 121
110 std::unique_ptr<aura::WindowTreeClient> window_tree_client_; 122 std::unique_ptr<aura::WindowTreeClient> window_tree_client_;
111 123
112 std::unique_ptr<ui::GpuService> gpu_service_; 124 std::unique_ptr<ui::GpuService> gpu_service_;
113 125
114 std::unique_ptr<SurfaceContextFactory> compositor_context_factory_; 126 std::unique_ptr<SurfaceContextFactory> compositor_context_factory_;
115 127
116 DISALLOW_COPY_AND_ASSIGN(MusClient); 128 DISALLOW_COPY_AND_ASSIGN(MusClient);
117 }; 129 };
118 130
119 } // namespace views 131 } // namespace views
120 132
121 #endif // UI_VIEWS_MUS_MUS_CLIENT_INIT_H_ 133 #endif // UI_VIEWS_MUS_MUS_CLIENT_INIT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698