| 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 "services/ui/ws/platform_display.h" | 5 #include "services/ui/ws/platform_display.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
| 8 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 9 #include "cc/ipc/quads.mojom.h" | 11 #include "cc/ipc/quads.mojom.h" |
| 10 #include "cc/output/copy_output_request.h" | 12 #include "cc/output/copy_output_request.h" |
| 11 #include "gpu/ipc/client/gpu_channel_host.h" | 13 #include "gpu/ipc/client/gpu_channel_host.h" |
| 12 #include "services/service_manager/public/cpp/connection.h" | 14 #include "services/service_manager/public/cpp/connection.h" |
| 13 #include "services/service_manager/public/cpp/connector.h" | 15 #include "services/service_manager/public/cpp/connector.h" |
| 14 #include "services/ui/display/platform_screen.h" | 16 #include "services/ui/display/platform_screen.h" |
| 15 #include "services/ui/surfaces/display_compositor.h" | 17 #include "services/ui/surfaces/display_compositor.h" |
| 16 #include "services/ui/ws/platform_display_factory.h" | 18 #include "services/ui/ws/platform_display_factory.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 36 #endif | 38 #endif |
| 37 | 39 |
| 38 namespace ui { | 40 namespace ui { |
| 39 | 41 |
| 40 namespace ws { | 42 namespace ws { |
| 41 | 43 |
| 42 // static | 44 // static |
| 43 PlatformDisplayFactory* PlatformDisplay::factory_ = nullptr; | 45 PlatformDisplayFactory* PlatformDisplay::factory_ = nullptr; |
| 44 | 46 |
| 45 // static | 47 // static |
| 46 PlatformDisplay* PlatformDisplay::Create( | 48 std::unique_ptr<PlatformDisplay> PlatformDisplay::Create( |
| 47 const PlatformDisplayInitParams& init_params) { | 49 const PlatformDisplayInitParams& init_params) { |
| 48 if (factory_) | 50 if (factory_) |
| 49 return factory_->CreatePlatformDisplay(); | 51 return factory_->CreatePlatformDisplay(); |
| 50 | 52 |
| 51 return new DefaultPlatformDisplay(init_params); | 53 return base::MakeUnique<DefaultPlatformDisplay>(init_params); |
| 52 } | 54 } |
| 53 | 55 |
| 54 DefaultPlatformDisplay::DefaultPlatformDisplay( | 56 DefaultPlatformDisplay::DefaultPlatformDisplay( |
| 55 const PlatformDisplayInitParams& init_params) | 57 const PlatformDisplayInitParams& init_params) |
| 56 : id_(init_params.display_id), | 58 : id_(init_params.display_id), |
| 57 #if !defined(OS_ANDROID) | 59 #if !defined(OS_ANDROID) |
| 58 cursor_loader_(ui::CursorLoader::Create()), | 60 cursor_loader_(ui::CursorLoader::Create()), |
| 59 #endif | 61 #endif |
| 60 frame_generator_(new FrameGenerator(this, init_params.root_window)), | 62 frame_generator_(new FrameGenerator(this, init_params.root_window)), |
| 61 metrics_(init_params.metrics) { | 63 metrics_(init_params.metrics) { |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 void DefaultPlatformDisplay::OnWindowStateChanged( | 251 void DefaultPlatformDisplay::OnWindowStateChanged( |
| 250 ui::PlatformWindowState new_state) {} | 252 ui::PlatformWindowState new_state) {} |
| 251 | 253 |
| 252 void DefaultPlatformDisplay::OnLostCapture() { | 254 void DefaultPlatformDisplay::OnLostCapture() { |
| 253 delegate_->OnNativeCaptureLost(); | 255 delegate_->OnNativeCaptureLost(); |
| 254 } | 256 } |
| 255 | 257 |
| 256 void DefaultPlatformDisplay::OnAcceleratedWidgetAvailable( | 258 void DefaultPlatformDisplay::OnAcceleratedWidgetAvailable( |
| 257 gfx::AcceleratedWidget widget, | 259 gfx::AcceleratedWidget widget, |
| 258 float device_scale_factor) { | 260 float device_scale_factor) { |
| 261 // This will get called after Init() is called, either synchronously as part |
| 262 // of the Init() callstack or async after Init() has returned, depending on |
| 263 // the platform. |
| 264 delegate_->OnAcceleratedWidgetAvailable(); |
| 259 frame_generator_->OnAcceleratedWidgetAvailable(widget); | 265 frame_generator_->OnAcceleratedWidgetAvailable(widget); |
| 260 } | 266 } |
| 261 | 267 |
| 262 void DefaultPlatformDisplay::OnAcceleratedWidgetDestroyed() { | 268 void DefaultPlatformDisplay::OnAcceleratedWidgetDestroyed() { |
| 263 NOTREACHED(); | 269 NOTREACHED(); |
| 264 } | 270 } |
| 265 | 271 |
| 266 void DefaultPlatformDisplay::OnActivationChanged(bool active) {} | 272 void DefaultPlatformDisplay::OnActivationChanged(bool active) {} |
| 267 | 273 |
| 268 bool DefaultPlatformDisplay::IsInHighContrastMode() { | 274 bool DefaultPlatformDisplay::IsInHighContrastMode() { |
| 269 return delegate_ ? delegate_->IsInHighContrastMode() : false; | 275 return delegate_ ? delegate_->IsInHighContrastMode() : false; |
| 270 } | 276 } |
| 271 | 277 |
| 272 } // namespace ws | 278 } // namespace ws |
| 273 | 279 |
| 274 } // namespace ui | 280 } // namespace ui |
| OLD | NEW |