OLD | NEW |
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 #include "ui/views/mus/mus_client.h" | 5 #include "ui/views/mus/mus_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "services/service_manager/public/cpp/connection.h" | 9 #include "services/service_manager/public/cpp/connection.h" |
10 #include "services/service_manager/public/cpp/connector.h" | 10 #include "services/service_manager/public/cpp/connector.h" |
11 #include "services/ui/public/interfaces/event_matcher.mojom.h" | 11 #include "services/ui/public/interfaces/event_matcher.mojom.h" |
12 #include "ui/aura/env.h" | 12 #include "ui/aura/env.h" |
13 #include "ui/aura/mus/gpu_service.h" | 13 #include "ui/aura/mus/gpu_service.h" |
14 #include "ui/aura/mus/os_exchange_data_provider_mus.h" | 14 #include "ui/aura/mus/os_exchange_data_provider_mus.h" |
15 #include "ui/aura/mus/property_converter.h" | 15 #include "ui/aura/mus/property_converter.h" |
16 #include "ui/aura/mus/window_tree_client.h" | 16 #include "ui/aura/mus/window_tree_client.h" |
17 #include "ui/aura/mus/window_tree_host_mus.h" | 17 #include "ui/aura/mus/window_tree_host_mus.h" |
18 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
19 #include "ui/aura/window_tree_host.h" | 19 #include "ui/aura/window_tree_host.h" |
20 #include "ui/views/mus/aura_init.h" | 20 #include "ui/views/mus/aura_init.h" |
21 #include "ui/views/mus/clipboard_mus.h" | 21 #include "ui/views/mus/clipboard_mus.h" |
22 #include "ui/views/mus/desktop_window_tree_host_mus.h" | 22 #include "ui/views/mus/desktop_window_tree_host_mus.h" |
23 #include "ui/views/mus/screen_mus.h" | 23 #include "ui/views/mus/screen_mus.h" |
24 #include "ui/views/mus/surface_context_factory.h" | 24 #include "ui/views/mus/surface_context_factory.h" |
25 #include "ui/views/views_delegate.h" | 25 #include "ui/views/views_delegate.h" |
26 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 26 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 27 #include "ui/wm/core/base_focus_rules.h" |
27 #include "ui/wm/core/capture_controller.h" | 28 #include "ui/wm/core/capture_controller.h" |
| 29 #include "ui/wm/core/focus_controller.h" |
28 #include "ui/wm/core/wm_state.h" | 30 #include "ui/wm/core/wm_state.h" |
29 | 31 |
30 namespace views { | 32 namespace views { |
31 namespace { | 33 namespace { |
32 | 34 |
| 35 // TODO: this is temporary, figure out what the real one should be like. |
| 36 class FocusRulesMus : public wm::BaseFocusRules { |
| 37 public: |
| 38 FocusRulesMus() {} |
| 39 ~FocusRulesMus() override {} |
| 40 |
| 41 // wm::BaseFocusRules:: |
| 42 bool SupportsChildActivation(aura::Window* window) const override { |
| 43 NOTIMPLEMENTED(); |
| 44 return true; |
| 45 } |
| 46 |
| 47 private: |
| 48 DISALLOW_COPY_AND_ASSIGN(FocusRulesMus); |
| 49 }; |
| 50 |
33 class PropertyConverterImpl : public aura::PropertyConverter { | 51 class PropertyConverterImpl : public aura::PropertyConverter { |
34 public: | 52 public: |
35 PropertyConverterImpl() {} | 53 PropertyConverterImpl() {} |
36 ~PropertyConverterImpl() override {} | 54 ~PropertyConverterImpl() override {} |
37 | 55 |
38 // aura::PropertyConverter: | 56 // aura::PropertyConverter: |
39 bool ConvertPropertyForTransport( | 57 bool ConvertPropertyForTransport( |
40 aura::Window* window, | 58 aura::Window* window, |
41 const void* key, | 59 const void* key, |
42 std::string* transport_name, | 60 std::string* transport_name, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 instance_ = this; | 124 instance_ = this; |
107 property_converter_ = base::MakeUnique<PropertyConverterImpl>(); | 125 property_converter_ = base::MakeUnique<PropertyConverterImpl>(); |
108 | 126 |
109 wm_state_ = base::MakeUnique<wm::WMState>(); | 127 wm_state_ = base::MakeUnique<wm::WMState>(); |
110 | 128 |
111 gpu_service_ = aura::GpuService::Create(connector, std::move(io_task_runner)); | 129 gpu_service_ = aura::GpuService::Create(connector, std::move(io_task_runner)); |
112 compositor_context_factory_ = | 130 compositor_context_factory_ = |
113 base::MakeUnique<views::SurfaceContextFactory>(gpu_service_.get()); | 131 base::MakeUnique<views::SurfaceContextFactory>(gpu_service_.get()); |
114 aura::Env::GetInstance()->set_context_factory( | 132 aura::Env::GetInstance()->set_context_factory( |
115 compositor_context_factory_.get()); | 133 compositor_context_factory_.get()); |
| 134 // TODO(sky): need a class similar to DesktopFocusRules. |
| 135 focus_controller_ = base::MakeUnique<wm::FocusController>(new FocusRulesMus); |
116 window_tree_client_ = | 136 window_tree_client_ = |
117 base::MakeUnique<aura::WindowTreeClient>(this, nullptr, nullptr); | 137 base::MakeUnique<aura::WindowTreeClient>(this, nullptr, nullptr); |
118 window_tree_client_->ConnectViaWindowTreeFactory(connector_); | 138 window_tree_client_->ConnectViaWindowTreeFactory(connector_); |
119 | 139 |
120 // TODO(sky): wire up PointerWatcherEventRouter. | 140 // TODO(sky): wire up PointerWatcherEventRouter. |
121 | 141 |
122 screen_ = base::MakeUnique<ScreenMus>(this); | 142 screen_ = base::MakeUnique<ScreenMus>(this); |
123 screen_->Init(connector); | 143 screen_->Init(connector); |
124 | 144 |
125 std::unique_ptr<ClipboardMus> clipboard = base::MakeUnique<ClipboardMus>(); | 145 std::unique_ptr<ClipboardMus> clipboard = base::MakeUnique<ClipboardMus>(); |
(...skipping 23 matching lines...) Expand all Loading... |
149 aura::Window* target) { | 169 aura::Window* target) { |
150 // TODO(sky): wire up pointer events. | 170 // TODO(sky): wire up pointer events. |
151 NOTIMPLEMENTED(); | 171 NOTIMPLEMENTED(); |
152 } | 172 } |
153 | 173 |
154 void MusClient::OnWindowManagerFrameValuesChanged() { | 174 void MusClient::OnWindowManagerFrameValuesChanged() { |
155 // TODO(sky): wire up to DesktopNativeWidgetAura. | 175 // TODO(sky): wire up to DesktopNativeWidgetAura. |
156 NOTIMPLEMENTED(); | 176 NOTIMPLEMENTED(); |
157 } | 177 } |
158 | 178 |
| 179 aura::client::FocusClient* MusClient::GetFocusClient() { |
| 180 return focus_controller_.get(); |
| 181 } |
| 182 |
159 aura::client::CaptureClient* MusClient::GetCaptureClient() { | 183 aura::client::CaptureClient* MusClient::GetCaptureClient() { |
160 return wm::CaptureController::Get(); | 184 return wm::CaptureController::Get(); |
161 } | 185 } |
162 | 186 |
163 aura::PropertyConverter* MusClient::GetPropertyConverter() { | 187 aura::PropertyConverter* MusClient::GetPropertyConverter() { |
164 return property_converter_.get(); | 188 return property_converter_.get(); |
165 } | 189 } |
166 | 190 |
167 gfx::Point MusClient::GetCursorScreenPoint() { | 191 gfx::Point MusClient::GetCursorScreenPoint() { |
168 return window_tree_client_->GetCursorScreenPoint(); | 192 return window_tree_client_->GetCursorScreenPoint(); |
(...skipping 11 matching lines...) Expand all Loading... |
180 return root->GetTopWindowContainingPoint(relative_point); | 204 return root->GetTopWindowContainingPoint(relative_point); |
181 } | 205 } |
182 return nullptr; | 206 return nullptr; |
183 } | 207 } |
184 | 208 |
185 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() { | 209 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() { |
186 return base::MakeUnique<aura::OSExchangeDataProviderMus>(); | 210 return base::MakeUnique<aura::OSExchangeDataProviderMus>(); |
187 } | 211 } |
188 | 212 |
189 } // namespace views | 213 } // namespace views |
OLD | NEW |