Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: services/ui/ws/platform_display.cc

Issue 2189893004: Unify display ids between Display and PlatformDisplay. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 PlatformDisplay* PlatformDisplay::Create( 47 PlatformDisplay* PlatformDisplay::Create(
48 const PlatformDisplayInitParams& init_params) { 48 const PlatformDisplayInitParams& init_params) {
49 if (factory_) 49 if (factory_)
50 return factory_->CreatePlatformDisplay(); 50 return factory_->CreatePlatformDisplay();
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 : display_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_(new FrameGenerator(this, 61 frame_generator_(new FrameGenerator(this, init_params.surfaces_state)) {
62 init_params.surfaces_state)) {
63 metrics_.bounds = init_params.display_bounds; 62 metrics_.bounds = init_params.display_bounds;
64 // TODO(rjkroege): Preserve the display_id when Ozone platform can use it. 63 // TODO(rjkroege): Preserve the display_id when Ozone platform can use it.
65 } 64 }
66 65
67 void DefaultPlatformDisplay::Init(PlatformDisplayDelegate* delegate) { 66 void DefaultPlatformDisplay::Init(PlatformDisplayDelegate* delegate) {
68 delegate_ = delegate; 67 delegate_ = delegate;
69 68
70 #if defined(OS_WIN) 69 #if defined(OS_WIN)
71 platform_window_.reset(new ui::WinWindow(this, metrics_.bounds)); 70 platform_window_.reset(new ui::WinWindow(this, metrics_.bounds));
72 #elif defined(USE_X11) 71 #elif defined(USE_X11)
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 void DefaultPlatformDisplay::SetImeVisibility(bool visible) { 153 void DefaultPlatformDisplay::SetImeVisibility(bool visible) {
155 ui::PlatformImeController* ime = platform_window_->GetPlatformImeController(); 154 ui::PlatformImeController* ime = platform_window_->GetPlatformImeController();
156 if (ime) 155 if (ime)
157 ime->SetImeVisibility(visible); 156 ime->SetImeVisibility(visible);
158 } 157 }
159 158
160 bool DefaultPlatformDisplay::IsFramePending() const { 159 bool DefaultPlatformDisplay::IsFramePending() const {
161 return frame_generator_->is_frame_pending(); 160 return frame_generator_->is_frame_pending();
162 } 161 }
163 162
164 int64_t DefaultPlatformDisplay::GetDisplayId() const { 163 int64_t DefaultPlatformDisplay::GetId() const {
165 return display_id_; 164 return id_;
166 } 165 }
167 166
168 gfx::Rect DefaultPlatformDisplay::GetBounds() const { 167 gfx::Rect DefaultPlatformDisplay::GetBounds() const {
169 return metrics_.bounds; 168 return metrics_.bounds;
170 } 169 }
171 170
172 void DefaultPlatformDisplay::UpdateMetrics(const gfx::Rect& bounds, 171 void DefaultPlatformDisplay::UpdateMetrics(const gfx::Rect& bounds,
173 float device_scale_factor) { 172 float device_scale_factor) {
174 if (display::Display::HasForceDeviceScaleFactor()) 173 if (display::Display::HasForceDeviceScaleFactor())
175 device_scale_factor = display::Display::GetForcedDeviceScaleFactor(); 174 device_scale_factor = display::Display::GetForcedDeviceScaleFactor();
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 return delegate_ ? delegate_->IsInHighContrastMode() : false; 277 return delegate_ ? delegate_->IsInHighContrastMode() : false;
279 } 278 }
280 279
281 const ViewportMetrics& DefaultPlatformDisplay::GetViewportMetrics() { 280 const ViewportMetrics& DefaultPlatformDisplay::GetViewportMetrics() {
282 return metrics_; 281 return metrics_;
283 } 282 }
284 283
285 } // namespace ws 284 } // namespace ws
286 285
287 } // namespace ui 286 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698