| 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 "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "components/discardable_memory/client/client_discardable_shared_memory_
manager.h" | 10 #include "components/discardable_memory/client/client_discardable_shared_memory_
manager.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "ui/aura/window_tree_host.h" | 26 #include "ui/aura/window_tree_host.h" |
| 27 #include "ui/views/mus/aura_init.h" | 27 #include "ui/views/mus/aura_init.h" |
| 28 #include "ui/views/mus/clipboard_mus.h" | 28 #include "ui/views/mus/clipboard_mus.h" |
| 29 #include "ui/views/mus/desktop_window_tree_host_mus.h" | 29 #include "ui/views/mus/desktop_window_tree_host_mus.h" |
| 30 #include "ui/views/mus/mus_property_mirror.h" | 30 #include "ui/views/mus/mus_property_mirror.h" |
| 31 #include "ui/views/mus/pointer_watcher_event_router.h" | 31 #include "ui/views/mus/pointer_watcher_event_router.h" |
| 32 #include "ui/views/mus/screen_mus.h" | 32 #include "ui/views/mus/screen_mus.h" |
| 33 #include "ui/views/views_delegate.h" | 33 #include "ui/views/views_delegate.h" |
| 34 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 34 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 35 #include "ui/views/widget/widget_delegate.h" | 35 #include "ui/views/widget/widget_delegate.h" |
| 36 #include "ui/wm/core/capture_controller.h" | |
| 37 #include "ui/wm/core/wm_state.h" | 36 #include "ui/wm/core/wm_state.h" |
| 38 | 37 |
| 39 // Widget::InitParams::Type must match that of ui::mojom::WindowType. | 38 // Widget::InitParams::Type must match that of ui::mojom::WindowType. |
| 40 #define WINDOW_TYPES_MATCH(NAME) \ | 39 #define WINDOW_TYPES_MATCH(NAME) \ |
| 41 static_assert( \ | 40 static_assert( \ |
| 42 static_cast<int32_t>(views::Widget::InitParams::TYPE_##NAME) == \ | 41 static_cast<int32_t>(views::Widget::InitParams::TYPE_##NAME) == \ |
| 43 static_cast<int32_t>(ui::mojom::WindowType::NAME), \ | 42 static_cast<int32_t>(ui::mojom::WindowType::NAME), \ |
| 44 "Window type constants must match") | 43 "Window type constants must match") |
| 45 | 44 |
| 46 WINDOW_TYPES_MATCH(WINDOW); | 45 WINDOW_TYPES_MATCH(WINDOW); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 void MusClient::OnPointerEventObserved(const ui::PointerEvent& event, | 264 void MusClient::OnPointerEventObserved(const ui::PointerEvent& event, |
| 266 aura::Window* target) { | 265 aura::Window* target) { |
| 267 pointer_watcher_event_router_->OnPointerEventObserved(event, target); | 266 pointer_watcher_event_router_->OnPointerEventObserved(event, target); |
| 268 } | 267 } |
| 269 | 268 |
| 270 void MusClient::OnWindowManagerFrameValuesChanged() { | 269 void MusClient::OnWindowManagerFrameValuesChanged() { |
| 271 for (auto& observer : observer_list_) | 270 for (auto& observer : observer_list_) |
| 272 observer.OnWindowManagerFrameValuesChanged(); | 271 observer.OnWindowManagerFrameValuesChanged(); |
| 273 } | 272 } |
| 274 | 273 |
| 275 aura::client::CaptureClient* MusClient::GetCaptureClient() { | |
| 276 return wm::CaptureController::Get(); | |
| 277 } | |
| 278 | |
| 279 aura::PropertyConverter* MusClient::GetPropertyConverter() { | 274 aura::PropertyConverter* MusClient::GetPropertyConverter() { |
| 280 return property_converter_.get(); | 275 return property_converter_.get(); |
| 281 } | 276 } |
| 282 | 277 |
| 283 aura::Window* MusClient::GetWindowAtScreenPoint(const gfx::Point& point) { | 278 aura::Window* MusClient::GetWindowAtScreenPoint(const gfx::Point& point) { |
| 284 for (aura::Window* root : window_tree_client_->GetRoots()) { | 279 for (aura::Window* root : window_tree_client_->GetRoots()) { |
| 285 aura::WindowTreeHost* window_tree_host = root->GetHost(); | 280 aura::WindowTreeHost* window_tree_host = root->GetHost(); |
| 286 if (!window_tree_host) | 281 if (!window_tree_host) |
| 287 continue; | 282 continue; |
| 288 // TODO: this likely gets z-order wrong. http://crbug.com/663606. | 283 // TODO: this likely gets z-order wrong. http://crbug.com/663606. |
| 289 gfx::Point relative_point(point); | 284 gfx::Point relative_point(point); |
| 290 window_tree_host->ConvertScreenInPixelsToDIP(&relative_point); | 285 window_tree_host->ConvertScreenInPixelsToDIP(&relative_point); |
| 291 if (gfx::Rect(root->bounds().size()).Contains(relative_point)) | 286 if (gfx::Rect(root->bounds().size()).Contains(relative_point)) |
| 292 return root->GetTopWindowContainingPoint(relative_point); | 287 return root->GetTopWindowContainingPoint(relative_point); |
| 293 } | 288 } |
| 294 return nullptr; | 289 return nullptr; |
| 295 } | 290 } |
| 296 | 291 |
| 297 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() { | 292 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() { |
| 298 return base::MakeUnique<aura::OSExchangeDataProviderMus>(); | 293 return base::MakeUnique<aura::OSExchangeDataProviderMus>(); |
| 299 } | 294 } |
| 300 | 295 |
| 301 } // namespace views | 296 } // namespace views |
| OLD | NEW |