| 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 "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
| 9 #include "cc/output/delegated_frame_data.h" | 9 #include "cc/output/delegated_frame_data.h" |
| 10 #include "cc/quads/render_pass.h" | 10 #include "cc/quads/render_pass.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 } | 179 } |
| 180 | 180 |
| 181 void DefaultDisplayManager::SetViewportSize(const gfx::Size& size) { | 181 void DefaultDisplayManager::SetViewportSize(const gfx::Size& size) { |
| 182 platform_window_->SetBounds(gfx::Rect(size)); | 182 platform_window_->SetBounds(gfx::Rect(size)); |
| 183 } | 183 } |
| 184 | 184 |
| 185 void DefaultDisplayManager::SetTitle(const base::string16& title) { | 185 void DefaultDisplayManager::SetTitle(const base::string16& title) { |
| 186 platform_window_->SetTitle(title); | 186 platform_window_->SetTitle(title); |
| 187 } | 187 } |
| 188 | 188 |
| 189 const mojo::ViewportMetrics& DefaultDisplayManager::GetViewportMetrics() { | 189 const mojom::ViewportMetrics& DefaultDisplayManager::GetViewportMetrics() { |
| 190 return metrics_; | 190 return metrics_; |
| 191 } | 191 } |
| 192 | 192 |
| 193 void DefaultDisplayManager::UpdateTextInputState( | 193 void DefaultDisplayManager::UpdateTextInputState( |
| 194 const ui::TextInputState& state) { | 194 const ui::TextInputState& state) { |
| 195 ui::PlatformImeController* ime = platform_window_->GetPlatformImeController(); | 195 ui::PlatformImeController* ime = platform_window_->GetPlatformImeController(); |
| 196 if (ime) | 196 if (ime) |
| 197 ime->UpdateTextInputState(state); | 197 ime->UpdateTextInputState(state); |
| 198 } | 198 } |
| 199 | 199 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 base::Bind(&DefaultDisplayManager::Draw, weak_factory_.GetWeakPtr())); | 233 base::Bind(&DefaultDisplayManager::Draw, weak_factory_.GetWeakPtr())); |
| 234 } | 234 } |
| 235 | 235 |
| 236 void DefaultDisplayManager::UpdateMetrics(const gfx::Size& size, | 236 void DefaultDisplayManager::UpdateMetrics(const gfx::Size& size, |
| 237 float device_pixel_ratio) { | 237 float device_pixel_ratio) { |
| 238 if (gfx::Display::HasForceDeviceScaleFactor()) | 238 if (gfx::Display::HasForceDeviceScaleFactor()) |
| 239 device_pixel_ratio = gfx::Display::GetForcedDeviceScaleFactor(); | 239 device_pixel_ratio = gfx::Display::GetForcedDeviceScaleFactor(); |
| 240 if (metrics_.size_in_pixels.To<gfx::Size>() == size && | 240 if (metrics_.size_in_pixels.To<gfx::Size>() == size && |
| 241 metrics_.device_pixel_ratio == device_pixel_ratio) | 241 metrics_.device_pixel_ratio == device_pixel_ratio) |
| 242 return; | 242 return; |
| 243 mojo::ViewportMetrics old_metrics; | 243 mojom::ViewportMetrics old_metrics; |
| 244 old_metrics.size_in_pixels = metrics_.size_in_pixels.Clone(); | 244 old_metrics.size_in_pixels = metrics_.size_in_pixels.Clone(); |
| 245 old_metrics.device_pixel_ratio = metrics_.device_pixel_ratio; | 245 old_metrics.device_pixel_ratio = metrics_.device_pixel_ratio; |
| 246 | 246 |
| 247 metrics_.size_in_pixels = mojo::Size::From(size); | 247 metrics_.size_in_pixels = mojo::Size::From(size); |
| 248 metrics_.device_pixel_ratio = device_pixel_ratio; | 248 metrics_.device_pixel_ratio = device_pixel_ratio; |
| 249 | 249 |
| 250 delegate_->OnViewportMetricsChanged(old_metrics, metrics_); | 250 delegate_->OnViewportMetricsChanged(old_metrics, metrics_); |
| 251 } | 251 } |
| 252 | 252 |
| 253 scoped_ptr<cc::CompositorFrame> | 253 scoped_ptr<cc::CompositorFrame> |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 new TopLevelDisplayClient(widget, gpu_state_, surfaces_state_)); | 348 new TopLevelDisplayClient(widget, gpu_state_, surfaces_state_)); |
| 349 delegate_->OnTopLevelSurfaceChanged( | 349 delegate_->OnTopLevelSurfaceChanged( |
| 350 top_level_display_client_->surface_id()); | 350 top_level_display_client_->surface_id()); |
| 351 } | 351 } |
| 352 UpdateMetrics(metrics_.size_in_pixels.To<gfx::Size>(), device_pixel_ratio); | 352 UpdateMetrics(metrics_.size_in_pixels.To<gfx::Size>(), device_pixel_ratio); |
| 353 } | 353 } |
| 354 | 354 |
| 355 void DefaultDisplayManager::OnActivationChanged(bool active) {} | 355 void DefaultDisplayManager::OnActivationChanged(bool active) {} |
| 356 | 356 |
| 357 } // namespace mus | 357 } // namespace mus |
| OLD | NEW |