| 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 "services/ui/ws/platform_display_default.h" | 5 #include "services/ui/ws/platform_display_default.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "gpu/ipc/client/gpu_channel_host.h" | 8 #include "gpu/ipc/client/gpu_channel_host.h" |
| 9 #include "services/ui/display/screen_manager.h" | 9 #include "services/ui/display/screen_manager.h" |
| 10 #include "services/ui/ws/platform_display_init_params.h" | 10 #include "services/ui/ws/platform_display_init_params.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 PlatformDisplayDefault::PlatformDisplayDefault( | 32 PlatformDisplayDefault::PlatformDisplayDefault( |
| 33 const PlatformDisplayInitParams& init_params) | 33 const PlatformDisplayInitParams& init_params) |
| 34 : display_id_(init_params.display_id), | 34 : display_id_(init_params.display_id), |
| 35 #if !defined(OS_ANDROID) | 35 #if !defined(OS_ANDROID) |
| 36 image_cursors_(new ImageCursors), | 36 image_cursors_(new ImageCursors), |
| 37 #endif | 37 #endif |
| 38 frame_generator_(new FrameGenerator(this, init_params.root_window)), | 38 frame_generator_(new FrameGenerator(this, init_params.root_window)), |
| 39 metrics_(init_params.metrics), | 39 metrics_(init_params.metrics), |
| 40 widget_(gfx::kNullAcceleratedWidget) { | 40 widget_(gfx::kNullAcceleratedWidget) { |
| 41 frame_generator_->set_device_scale_factor( | 41 frame_generator_->SetDeviceScaleFactor( |
| 42 init_params.metrics.device_scale_factor); | 42 init_params.metrics.device_scale_factor); |
| 43 } | 43 } |
| 44 | 44 |
| 45 PlatformDisplayDefault::~PlatformDisplayDefault() { | 45 PlatformDisplayDefault::~PlatformDisplayDefault() { |
| 46 // Don't notify the delegate from the destructor. | 46 // Don't notify the delegate from the destructor. |
| 47 delegate_ = nullptr; | 47 delegate_ = nullptr; |
| 48 | 48 |
| 49 frame_generator_.reset(); | 49 frame_generator_.reset(); |
| 50 // Destroy the PlatformWindow early on as it may call us back during | 50 // Destroy the PlatformWindow early on as it may call us back during |
| 51 // destruction and we want to be in a known state. But destroy the surface | 51 // destruction and we want to be in a known state. But destroy the surface |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 if (metrics_ == metrics) | 142 if (metrics_ == metrics) |
| 143 return false; | 143 return false; |
| 144 | 144 |
| 145 gfx::Rect bounds = platform_window_->GetBounds(); | 145 gfx::Rect bounds = platform_window_->GetBounds(); |
| 146 if (bounds.size() != metrics.pixel_size) { | 146 if (bounds.size() != metrics.pixel_size) { |
| 147 bounds.set_size(metrics.pixel_size); | 147 bounds.set_size(metrics.pixel_size); |
| 148 platform_window_->SetBounds(bounds); | 148 platform_window_->SetBounds(bounds); |
| 149 } | 149 } |
| 150 | 150 |
| 151 metrics_ = metrics; | 151 metrics_ = metrics; |
| 152 frame_generator_->set_device_scale_factor(metrics_.device_scale_factor); | 152 frame_generator_->SetDeviceScaleFactor(metrics_.device_scale_factor); |
| 153 return true; | 153 return true; |
| 154 } | 154 } |
| 155 | 155 |
| 156 const display::ViewportMetrics& PlatformDisplayDefault::GetViewportMetrics() | 156 const display::ViewportMetrics& PlatformDisplayDefault::GetViewportMetrics() |
| 157 const { | 157 const { |
| 158 return metrics_; | 158 return metrics_; |
| 159 } | 159 } |
| 160 | 160 |
| 161 gfx::AcceleratedWidget PlatformDisplayDefault::GetAcceleratedWidget() const { | 161 gfx::AcceleratedWidget PlatformDisplayDefault::GetAcceleratedWidget() const { |
| 162 return widget_; | 162 return widget_; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 delegate_->OnAcceleratedWidgetAvailable(); | 248 delegate_->OnAcceleratedWidgetAvailable(); |
| 249 frame_generator_->OnAcceleratedWidgetAvailable(widget); | 249 frame_generator_->OnAcceleratedWidgetAvailable(widget); |
| 250 } | 250 } |
| 251 | 251 |
| 252 void PlatformDisplayDefault::OnAcceleratedWidgetDestroyed() { | 252 void PlatformDisplayDefault::OnAcceleratedWidgetDestroyed() { |
| 253 NOTREACHED(); | 253 NOTREACHED(); |
| 254 } | 254 } |
| 255 | 255 |
| 256 void PlatformDisplayDefault::OnActivationChanged(bool active) {} | 256 void PlatformDisplayDefault::OnActivationChanged(bool active) {} |
| 257 | 257 |
| 258 ServerWindow* PlatformDisplayDefault::GetActiveRootWindow() { | |
| 259 return delegate_->GetActiveRootWindow(); | |
| 260 } | |
| 261 | |
| 262 bool PlatformDisplayDefault::IsInHighContrastMode() { | 258 bool PlatformDisplayDefault::IsInHighContrastMode() { |
| 263 return delegate_ ? delegate_->IsInHighContrastMode() : false; | 259 return delegate_ ? delegate_->IsInHighContrastMode() : false; |
| 264 } | 260 } |
| 265 | 261 |
| 266 } // namespace ws | 262 } // namespace ws |
| 267 } // namespace ui | 263 } // namespace ui |
| OLD | NEW |