| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/mus/ws/display_manager.h" | 5 #include "components/mus/ws/display_manager.h" |
| 6 | 6 |
| 7 #include "base/numerics/safe_conversions.h" | 7 #include "base/numerics/safe_conversions.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
| 10 #include "cc/output/copy_output_request.h" | 10 #include "cc/output/copy_output_request.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 } | 228 } |
| 229 | 229 |
| 230 void DefaultDisplayManager::SetViewportSize(const gfx::Size& size) { | 230 void DefaultDisplayManager::SetViewportSize(const gfx::Size& size) { |
| 231 platform_window_->SetBounds(gfx::Rect(size)); | 231 platform_window_->SetBounds(gfx::Rect(size)); |
| 232 } | 232 } |
| 233 | 233 |
| 234 void DefaultDisplayManager::SetTitle(const base::string16& title) { | 234 void DefaultDisplayManager::SetTitle(const base::string16& title) { |
| 235 platform_window_->SetTitle(title); | 235 platform_window_->SetTitle(title); |
| 236 } | 236 } |
| 237 | 237 |
| 238 void DefaultDisplayManager::SetCapture() { |
| 239 platform_window_->SetCapture(); |
| 240 } |
| 241 |
| 242 void DefaultDisplayManager::ReleaseCapture() { |
| 243 platform_window_->ReleaseCapture(); |
| 244 } |
| 245 |
| 238 void DefaultDisplayManager::SetCursorById(int32_t cursor_id) { | 246 void DefaultDisplayManager::SetCursorById(int32_t cursor_id) { |
| 239 #if !defined(OS_ANDROID) | 247 #if !defined(OS_ANDROID) |
| 240 // TODO(erg): This still isn't sufficient, and will only use native cursors | 248 // TODO(erg): This still isn't sufficient, and will only use native cursors |
| 241 // that chrome would use, not custom image cursors. For that, we should | 249 // that chrome would use, not custom image cursors. For that, we should |
| 242 // delegate to the window manager to load images from resource packs. | 250 // delegate to the window manager to load images from resource packs. |
| 243 // | 251 // |
| 244 // We probably also need to deal with different DPIs. | 252 // We probably also need to deal with different DPIs. |
| 245 ui::Cursor cursor(cursor_id); | 253 ui::Cursor cursor(cursor_id); |
| 246 cursor_loader_->SetPlatformCursor(&cursor); | 254 cursor_loader_->SetPlatformCursor(&cursor); |
| 247 platform_window_->SetCursor(cursor.platform()); | 255 platform_window_->SetCursor(cursor.platform()); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 platform_window_->Close(); | 403 platform_window_->Close(); |
| 396 } | 404 } |
| 397 | 405 |
| 398 void DefaultDisplayManager::OnClosed() { | 406 void DefaultDisplayManager::OnClosed() { |
| 399 delegate_->OnDisplayClosed(); | 407 delegate_->OnDisplayClosed(); |
| 400 } | 408 } |
| 401 | 409 |
| 402 void DefaultDisplayManager::OnWindowStateChanged( | 410 void DefaultDisplayManager::OnWindowStateChanged( |
| 403 ui::PlatformWindowState new_state) {} | 411 ui::PlatformWindowState new_state) {} |
| 404 | 412 |
| 405 void DefaultDisplayManager::OnLostCapture() {} | 413 void DefaultDisplayManager::OnLostCapture() { |
| 414 delegate_->OnLostCapture(); |
| 415 } |
| 406 | 416 |
| 407 void DefaultDisplayManager::OnAcceleratedWidgetAvailable( | 417 void DefaultDisplayManager::OnAcceleratedWidgetAvailable( |
| 408 gfx::AcceleratedWidget widget, | 418 gfx::AcceleratedWidget widget, |
| 409 float device_pixel_ratio) { | 419 float device_pixel_ratio) { |
| 410 if (widget != gfx::kNullAcceleratedWidget) { | 420 if (widget != gfx::kNullAcceleratedWidget) { |
| 411 top_level_display_client_.reset( | 421 top_level_display_client_.reset( |
| 412 new TopLevelDisplayClient(widget, gpu_state_, surfaces_state_)); | 422 new TopLevelDisplayClient(widget, gpu_state_, surfaces_state_)); |
| 413 delegate_->OnTopLevelSurfaceChanged( | 423 delegate_->OnTopLevelSurfaceChanged( |
| 414 top_level_display_client_->surface_id()); | 424 top_level_display_client_->surface_id()); |
| 415 } | 425 } |
| 416 UpdateMetrics(metrics_.size_in_pixels.To<gfx::Size>(), device_pixel_ratio); | 426 UpdateMetrics(metrics_.size_in_pixels.To<gfx::Size>(), device_pixel_ratio); |
| 417 } | 427 } |
| 418 | 428 |
| 419 void DefaultDisplayManager::OnAcceleratedWidgetDestroyed() { | 429 void DefaultDisplayManager::OnAcceleratedWidgetDestroyed() { |
| 420 NOTREACHED(); | 430 NOTREACHED(); |
| 421 } | 431 } |
| 422 | 432 |
| 423 void DefaultDisplayManager::OnActivationChanged(bool active) {} | 433 void DefaultDisplayManager::OnActivationChanged(bool active) {} |
| 424 | 434 |
| 425 void DefaultDisplayManager::RequestCopyOfOutput( | 435 void DefaultDisplayManager::RequestCopyOfOutput( |
| 426 scoped_ptr<cc::CopyOutputRequest> output_request) { | 436 scoped_ptr<cc::CopyOutputRequest> output_request) { |
| 427 if (top_level_display_client_) | 437 if (top_level_display_client_) |
| 428 top_level_display_client_->RequestCopyOfOutput(std::move(output_request)); | 438 top_level_display_client_->RequestCopyOfOutput(std::move(output_request)); |
| 429 } | 439 } |
| 430 | 440 |
| 431 } // namespace ws | 441 } // namespace ws |
| 432 | 442 |
| 433 } // namespace mus | 443 } // namespace mus |
| OLD | NEW |