Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 24 #include "ui/aura/window.h" | 24 #include "ui/aura/window.h" |
| 25 #include "ui/aura/window_tree_host.h" | 25 #include "ui/aura/window_tree_host.h" |
| 26 #include "ui/views/mus/aura_init.h" | 26 #include "ui/views/mus/aura_init.h" |
| 27 #include "ui/views/mus/clipboard_mus.h" | 27 #include "ui/views/mus/clipboard_mus.h" |
| 28 #include "ui/views/mus/desktop_window_tree_host_mus.h" | 28 #include "ui/views/mus/desktop_window_tree_host_mus.h" |
| 29 #include "ui/views/mus/pointer_watcher_event_router.h" | 29 #include "ui/views/mus/pointer_watcher_event_router.h" |
| 30 #include "ui/views/mus/screen_mus.h" | 30 #include "ui/views/mus/screen_mus.h" |
| 31 #include "ui/views/views_delegate.h" | 31 #include "ui/views/views_delegate.h" |
| 32 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 32 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 33 #include "ui/views/widget/widget_delegate.h" | 33 #include "ui/views/widget/widget_delegate.h" |
| 34 #include "ui/wm/core/capture_controller.h" | 34 #include "ui/wm/core/capture_controller.h" |
|
sadrul
2017/01/27 01:15:13
Probably no longer needed?
| |
| 35 #include "ui/wm/core/wm_state.h" | 35 #include "ui/wm/core/wm_state.h" |
| 36 | 36 |
| 37 // Widget::InitParams::Type must match that of ui::mojom::WindowType. | 37 // Widget::InitParams::Type must match that of ui::mojom::WindowType. |
| 38 #define WINDOW_TYPES_MATCH(NAME) \ | 38 #define WINDOW_TYPES_MATCH(NAME) \ |
| 39 static_assert( \ | 39 static_assert( \ |
| 40 static_cast<int32_t>(views::Widget::InitParams::TYPE_##NAME) == \ | 40 static_cast<int32_t>(views::Widget::InitParams::TYPE_##NAME) == \ |
| 41 static_cast<int32_t>(ui::mojom::WindowType::NAME), \ | 41 static_cast<int32_t>(ui::mojom::WindowType::NAME), \ |
| 42 "Window type constants must match") | 42 "Window type constants must match") |
| 43 | 43 |
| 44 WINDOW_TYPES_MATCH(WINDOW); | 44 WINDOW_TYPES_MATCH(WINDOW); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 void MusClient::OnPointerEventObserved(const ui::PointerEvent& event, | 242 void MusClient::OnPointerEventObserved(const ui::PointerEvent& event, |
| 243 aura::Window* target) { | 243 aura::Window* target) { |
| 244 pointer_watcher_event_router_->OnPointerEventObserved(event, target); | 244 pointer_watcher_event_router_->OnPointerEventObserved(event, target); |
| 245 } | 245 } |
| 246 | 246 |
| 247 void MusClient::OnWindowManagerFrameValuesChanged() { | 247 void MusClient::OnWindowManagerFrameValuesChanged() { |
| 248 for (auto& observer : observer_list_) | 248 for (auto& observer : observer_list_) |
| 249 observer.OnWindowManagerFrameValuesChanged(); | 249 observer.OnWindowManagerFrameValuesChanged(); |
| 250 } | 250 } |
| 251 | 251 |
| 252 aura::client::CaptureClient* MusClient::GetCaptureClient() { | |
| 253 return wm::CaptureController::Get(); | |
| 254 } | |
| 255 | |
| 256 aura::PropertyConverter* MusClient::GetPropertyConverter() { | 252 aura::PropertyConverter* MusClient::GetPropertyConverter() { |
| 257 return property_converter_.get(); | 253 return property_converter_.get(); |
| 258 } | 254 } |
| 259 | 255 |
| 260 aura::Window* MusClient::GetWindowAtScreenPoint(const gfx::Point& point) { | 256 aura::Window* MusClient::GetWindowAtScreenPoint(const gfx::Point& point) { |
| 261 for (aura::Window* root : window_tree_client_->GetRoots()) { | 257 for (aura::Window* root : window_tree_client_->GetRoots()) { |
| 262 aura::WindowTreeHost* window_tree_host = root->GetHost(); | 258 aura::WindowTreeHost* window_tree_host = root->GetHost(); |
| 263 if (!window_tree_host) | 259 if (!window_tree_host) |
| 264 continue; | 260 continue; |
| 265 // TODO: this likely gets z-order wrong. http://crbug.com/663606. | 261 // TODO: this likely gets z-order wrong. http://crbug.com/663606. |
| 266 gfx::Point relative_point(point); | 262 gfx::Point relative_point(point); |
| 267 window_tree_host->ConvertScreenInPixelsToDIP(&relative_point); | 263 window_tree_host->ConvertScreenInPixelsToDIP(&relative_point); |
| 268 if (gfx::Rect(root->bounds().size()).Contains(relative_point)) | 264 if (gfx::Rect(root->bounds().size()).Contains(relative_point)) |
| 269 return root->GetTopWindowContainingPoint(relative_point); | 265 return root->GetTopWindowContainingPoint(relative_point); |
| 270 } | 266 } |
| 271 return nullptr; | 267 return nullptr; |
| 272 } | 268 } |
| 273 | 269 |
| 274 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() { | 270 std::unique_ptr<OSExchangeData::Provider> MusClient::BuildProvider() { |
| 275 return base::MakeUnique<aura::OSExchangeDataProviderMus>(); | 271 return base::MakeUnique<aura::OSExchangeDataProviderMus>(); |
| 276 } | 272 } |
| 277 | 273 |
| 278 } // namespace views | 274 } // namespace views |
| OLD | NEW |