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

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

Issue 2310133002: Add mojom::DisplayController. (Closed)
Patch Set: Add missing dep. Created 4 years, 3 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
« no previous file with comments | « services/ui/ws/platform_display.h ('k') | services/ui/ws/platform_display_init_params.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "cc/output/delegated_frame_data.h" 11 #include "cc/output/delegated_frame_data.h"
12 #include "gpu/ipc/client/gpu_channel_host.h" 12 #include "gpu/ipc/client/gpu_channel_host.h"
13 #include "services/shell/public/cpp/connection.h" 13 #include "services/shell/public/cpp/connection.h"
14 #include "services/shell/public/cpp/connector.h" 14 #include "services/shell/public/cpp/connector.h"
15 #include "services/ui/display/platform_screen.h"
15 #include "services/ui/surfaces/display_compositor.h" 16 #include "services/ui/surfaces/display_compositor.h"
16 #include "services/ui/surfaces/surfaces_state.h" 17 #include "services/ui/surfaces/surfaces_state.h"
17 #include "services/ui/ws/platform_display_factory.h" 18 #include "services/ui/ws/platform_display_factory.h"
18 #include "services/ui/ws/platform_display_init_params.h" 19 #include "services/ui/ws/platform_display_init_params.h"
19 #include "services/ui/ws/server_window.h" 20 #include "services/ui/ws/server_window.h"
20 #include "services/ui/ws/window_coordinate_conversions.h" 21 #include "services/ui/ws/window_coordinate_conversions.h"
21 #include "third_party/skia/include/core/SkXfermode.h" 22 #include "third_party/skia/include/core/SkXfermode.h"
22 #include "ui/base/cursor/cursor_loader.h" 23 #include "ui/base/cursor/cursor_loader.h"
23 #include "ui/display/display.h" 24 #include "ui/display/display.h"
24 #include "ui/events/event.h" 25 #include "ui/events/event.h"
(...skipping 23 matching lines...) Expand all
48 const PlatformDisplayInitParams& init_params) { 49 const PlatformDisplayInitParams& init_params) {
49 if (factory_) 50 if (factory_)
50 return factory_->CreatePlatformDisplay(); 51 return factory_->CreatePlatformDisplay();
51 52
52 return new DefaultPlatformDisplay(init_params); 53 return new DefaultPlatformDisplay(init_params);
53 } 54 }
54 55
55 DefaultPlatformDisplay::DefaultPlatformDisplay( 56 DefaultPlatformDisplay::DefaultPlatformDisplay(
56 const PlatformDisplayInitParams& init_params) 57 const PlatformDisplayInitParams& init_params)
57 : id_(init_params.display_id), 58 : id_(init_params.display_id),
58 platform_screen_(init_params.platform_screen),
59 #if !defined(OS_ANDROID) 59 #if !defined(OS_ANDROID)
60 cursor_loader_(ui::CursorLoader::Create()), 60 cursor_loader_(ui::CursorLoader::Create()),
61 #endif 61 #endif
62 frame_generator_(new FrameGenerator(this, init_params.surfaces_state)) { 62 frame_generator_(new FrameGenerator(this, init_params.surfaces_state)) {
63 metrics_.bounds = init_params.display_bounds; 63 metrics_.bounds = init_params.display_bounds;
64 } 64 }
65 65
66 void DefaultPlatformDisplay::Init(PlatformDisplayDelegate* delegate) { 66 void DefaultPlatformDisplay::Init(PlatformDisplayDelegate* delegate) {
67 delegate_ = delegate; 67 delegate_ = delegate;
68 68
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 bool DefaultPlatformDisplay::IsFramePending() const { 163 bool DefaultPlatformDisplay::IsFramePending() const {
164 return frame_generator_->is_frame_pending(); 164 return frame_generator_->is_frame_pending();
165 } 165 }
166 166
167 gfx::Rect DefaultPlatformDisplay::GetBounds() const { 167 gfx::Rect DefaultPlatformDisplay::GetBounds() const {
168 return metrics_.bounds; 168 return metrics_.bounds;
169 } 169 }
170 170
171 bool DefaultPlatformDisplay::IsPrimaryDisplay() const { 171 bool DefaultPlatformDisplay::IsPrimaryDisplay() const {
172 return platform_screen_->GetPrimaryDisplayId() == id_; 172 return display::PlatformScreen::GetInstance()->GetPrimaryDisplayId() == id_;
173 } 173 }
174 174
175 void DefaultPlatformDisplay::OnGpuChannelEstablished( 175 void DefaultPlatformDisplay::OnGpuChannelEstablished(
176 scoped_refptr<gpu::GpuChannelHost> channel) { 176 scoped_refptr<gpu::GpuChannelHost> channel) {
177 frame_generator_->OnGpuChannelEstablished(channel); 177 frame_generator_->OnGpuChannelEstablished(channel);
178 } 178 }
179 179
180 void DefaultPlatformDisplay::UpdateMetrics(const gfx::Rect& bounds, 180 void DefaultPlatformDisplay::UpdateMetrics(const gfx::Rect& bounds,
181 float device_scale_factor) { 181 float device_scale_factor) {
182 if (display::Display::HasForceDeviceScaleFactor()) 182 if (display::Display::HasForceDeviceScaleFactor())
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 return delegate_ ? delegate_->IsInHighContrastMode() : false; 301 return delegate_ ? delegate_->IsInHighContrastMode() : false;
302 } 302 }
303 303
304 const ViewportMetrics& DefaultPlatformDisplay::GetViewportMetrics() { 304 const ViewportMetrics& DefaultPlatformDisplay::GetViewportMetrics() {
305 return metrics_; 305 return metrics_;
306 } 306 }
307 307
308 } // namespace ws 308 } // namespace ws
309 309
310 } // namespace ui 310 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/platform_display.h ('k') | services/ui/ws/platform_display_init_params.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698