| 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" | |
| 28 #include "ui/wm/core/capture_controller.h" | 27 #include "ui/wm/core/capture_controller.h" |
| 29 #include "ui/wm/core/focus_controller.h" | |
| 30 #include "ui/wm/core/wm_state.h" | 28 #include "ui/wm/core/wm_state.h" |
| 31 | 29 |
| 32 namespace views { | 30 namespace views { |
| 33 namespace { | 31 namespace { |
| 34 | 32 |
| 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 | |
| 51 class PropertyConverterImpl : public aura::PropertyConverter { | 33 class PropertyConverterImpl : public aura::PropertyConverter { |
| 52 public: | 34 public: |
| 53 PropertyConverterImpl() {} | 35 PropertyConverterImpl() {} |
| 54 ~PropertyConverterImpl() override {} | 36 ~PropertyConverterImpl() override {} |
| 55 | 37 |
| 56 // aura::PropertyConverter: | 38 // aura::PropertyConverter: |
| 57 bool ConvertPropertyForTransport( | 39 bool ConvertPropertyForTransport( |
| 58 aura::Window* window, | 40 aura::Window* window, |
| 59 const void* key, | 41 const void* key, |
| 60 std::string* transport_name, | 42 std::string* transport_name, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 instance_ = this; | 106 instance_ = this; |
| 125 property_converter_ = base::MakeUnique<PropertyConverterImpl>(); | 107 property_converter_ = base::MakeUnique<PropertyConverterImpl>(); |
| 126 | 108 |
| 127 wm_state_ = base::MakeUnique<wm::WMState>(); | 109 wm_state_ = base::MakeUnique<wm::WMState>(); |
| 128 | 110 |
| 129 gpu_service_ = aura::GpuService::Create(connector, std::move(io_task_runner)); | 111 gpu_service_ = aura::GpuService::Create(connector, std::move(io_task_runner)); |
| 130 compositor_context_factory_ = | 112 compositor_context_factory_ = |
| 131 base::MakeUnique<views::SurfaceContextFactory>(gpu_service_.get()); | 113 base::MakeUnique<views::SurfaceContextFactory>(gpu_service_.get()); |
| 132 aura::Env::GetInstance()->set_context_factory( | 114 aura::Env::GetInstance()->set_context_factory( |
| 133 compositor_context_factory_.get()); | 115 compositor_context_factory_.get()); |
| 134 // TODO(sky): need a class similar to DesktopFocusRules. | |
| 135 focus_controller_ = base::MakeUnique<wm::FocusController>(new FocusRulesMus); | |
| 136 window_tree_client_ = | 116 window_tree_client_ = |
| 137 base::MakeUnique<aura::WindowTreeClient>(this, nullptr, nullptr); | 117 base::MakeUnique<aura::WindowTreeClient>(this, nullptr, nullptr); |
| 138 window_tree_client_->ConnectViaWindowTreeFactory(connector_); | 118 window_tree_client_->ConnectViaWindowTreeFactory(connector_); |
| 139 | 119 |
| 140 // TODO(sky): wire up PointerWatcherEventRouter. | 120 // TODO(sky): wire up PointerWatcherEventRouter. |
| 141 | 121 |
| 142 screen_ = base::MakeUnique<ScreenMus>(this); | 122 screen_ = base::MakeUnique<ScreenMus>(this); |
| 143 screen_->Init(connector); | 123 screen_->Init(connector); |
| 144 | 124 |
| 145 std::unique_ptr<ClipboardMus> clipboard = base::MakeUnique<ClipboardMus>(); | 125 std::unique_ptr<ClipboardMus> clipboard = base::MakeUnique<ClipboardMus>(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 169 aura::Window* target) { | 149 aura::Window* target) { |
| 170 // TODO(sky): wire up pointer events. | 150 // TODO(sky): wire up pointer events. |
| 171 NOTIMPLEMENTED(); | 151 NOTIMPLEMENTED(); |
| 172 } | 152 } |
| 173 | 153 |
| 174 void MusClient::OnWindowManagerFrameValuesChanged() { | 154 void MusClient::OnWindowManagerFrameValuesChanged() { |
| 175 // TODO(sky): wire up to DesktopNativeWidgetAura. | 155 // TODO(sky): wire up to DesktopNativeWidgetAura. |
| 176 NOTIMPLEMENTED(); | 156 NOTIMPLEMENTED(); |
| 177 } | 157 } |
| 178 | 158 |
| 179 aura::client::FocusClient* MusClient::GetFocusClient() { | |
| 180 return focus_controller_.get(); | |
| 181 } | |
| 182 | |
| 183 aura::client::CaptureClient* MusClient::GetCaptureClient() { | 159 aura::client::CaptureClient* MusClient::GetCaptureClient() { |
| 184 return wm::CaptureController::Get(); | 160 return wm::CaptureController::Get(); |
| 185 } | 161 } |
| 186 | 162 |
| 187 aura::PropertyConverter* MusClient::GetPropertyConverter() { | 163 aura::PropertyConverter* MusClient::GetPropertyConverter() { |
| 188 return property_converter_.get(); | 164 return property_converter_.get(); |
| 189 } | 165 } |
| 190 | 166 |
| 191 gfx::Point MusClient::GetCursorScreenPoint() { | 167 gfx::Point MusClient::GetCursorScreenPoint() { |
| 192 return window_tree_client_->GetCursorScreenPoint(); | 168 return window_tree_client_->GetCursorScreenPoint(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 204 return root->GetTopWindowContainingPoint(relative_point); | 180 return root->GetTopWindowContainingPoint(relative_point); |
| 205 } | 181 } |
| 206 return nullptr; | 182 return nullptr; |
| 207 } | 183 } |
| 208 | 184 |
| 209 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() { | 185 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() { |
| 210 return base::MakeUnique<aura::OSExchangeDataProviderMus>(); | 186 return base::MakeUnique<aura::OSExchangeDataProviderMus>(); |
| 211 } | 187 } |
| 212 | 188 |
| 213 } // namespace views | 189 } // namespace views |
| OLD | NEW |