| 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 "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/ipc/quads.mojom.h" | 9 #include "cc/ipc/quads.mojom.h" |
| 10 #include "cc/output/copy_output_request.h" | 10 #include "cc/output/copy_output_request.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 return new DefaultPlatformDisplay(init_params); | 52 return new DefaultPlatformDisplay(init_params); |
| 53 } | 53 } |
| 54 | 54 |
| 55 DefaultPlatformDisplay::DefaultPlatformDisplay( | 55 DefaultPlatformDisplay::DefaultPlatformDisplay( |
| 56 const PlatformDisplayInitParams& init_params) | 56 const PlatformDisplayInitParams& init_params) |
| 57 : id_(init_params.display_id), | 57 : id_(init_params.display_id), |
| 58 #if !defined(OS_ANDROID) | 58 #if !defined(OS_ANDROID) |
| 59 cursor_loader_(ui::CursorLoader::Create()), | 59 cursor_loader_(ui::CursorLoader::Create()), |
| 60 #endif | 60 #endif |
| 61 frame_generator_( | 61 frame_generator_(new FrameGenerator(this, |
| 62 new FrameGenerator(this, init_params.display_compositor)), | 62 init_params.root_window, |
| 63 init_params.display_compositor)), |
| 63 metrics_(init_params.metrics) { | 64 metrics_(init_params.metrics) { |
| 64 } | 65 } |
| 65 | 66 |
| 66 void DefaultPlatformDisplay::Init(PlatformDisplayDelegate* delegate) { | 67 void DefaultPlatformDisplay::Init(PlatformDisplayDelegate* delegate) { |
| 67 delegate_ = delegate; | 68 delegate_ = delegate; |
| 68 | 69 |
| 69 DCHECK(!metrics_.pixel_size.IsEmpty()); | 70 DCHECK(!metrics_.pixel_size.IsEmpty()); |
| 70 | 71 |
| 71 // TODO(kylechar): The origin here isn't right if any displays have | 72 // TODO(kylechar): The origin here isn't right if any displays have |
| 72 // scale_factor other than 1.0 but will prevent windows from being stacked. | 73 // scale_factor other than 1.0 but will prevent windows from being stacked. |
| 73 gfx::Rect bounds(metrics_.bounds.origin(), metrics_.pixel_size); | 74 gfx::Rect bounds(metrics_.bounds.origin(), metrics_.pixel_size); |
| 74 #if defined(OS_WIN) | 75 #if defined(OS_WIN) |
| 75 platform_window_ = base::MakeUnique<ui::WinWindow>(this, bounds); | 76 platform_window_ = base::MakeUnique<ui::WinWindow>(this, bounds); |
| 76 #elif defined(USE_X11) | 77 #elif defined(USE_X11) |
| 77 platform_window_ = base::MakeUnique<ui::X11Window>(this); | 78 platform_window_ = base::MakeUnique<ui::X11Window>(this); |
| 78 #elif defined(OS_ANDROID) | 79 #elif defined(OS_ANDROID) |
| 79 platform_window_ = base::MakeUnique<ui::PlatformWindowAndroid>(this); | 80 platform_window_ = base::MakeUnique<ui::PlatformWindowAndroid>(this); |
| 80 #elif defined(USE_OZONE) | 81 #elif defined(USE_OZONE) |
| 81 platform_window_ = | 82 platform_window_ = |
| 82 ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds); | 83 ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds); |
| 83 #else | 84 #else |
| 84 NOTREACHED() << "Unsupported platform"; | 85 NOTREACHED() << "Unsupported platform"; |
| 85 #endif | 86 #endif |
| 86 delegate_->CreateRootWindow(metrics_.bounds.size()); | |
| 87 | 87 |
| 88 platform_window_->SetBounds(bounds); | 88 platform_window_->SetBounds(bounds); |
| 89 platform_window_->Show(); | 89 platform_window_->Show(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 int64_t DefaultPlatformDisplay::GetId() const { | 92 int64_t DefaultPlatformDisplay::GetId() const { |
| 93 return id_; | 93 return id_; |
| 94 } | 94 } |
| 95 | 95 |
| 96 DefaultPlatformDisplay::~DefaultPlatformDisplay() { | 96 DefaultPlatformDisplay::~DefaultPlatformDisplay() { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 return delegate_->GetRootWindow(); | 288 return delegate_->GetRootWindow(); |
| 289 } | 289 } |
| 290 | 290 |
| 291 bool DefaultPlatformDisplay::IsInHighContrastMode() { | 291 bool DefaultPlatformDisplay::IsInHighContrastMode() { |
| 292 return delegate_ ? delegate_->IsInHighContrastMode() : false; | 292 return delegate_ ? delegate_->IsInHighContrastMode() : false; |
| 293 } | 293 } |
| 294 | 294 |
| 295 } // namespace ws | 295 } // namespace ws |
| 296 | 296 |
| 297 } // namespace ui | 297 } // namespace ui |
| OLD | NEW |