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

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

Issue 2268563003: Replaced CursorLoader in PlatformDisplay with a ImageCursor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 "services/shell/public/cpp/connection.h" 12 #include "services/shell/public/cpp/connection.h"
13 #include "services/shell/public/cpp/connector.h" 13 #include "services/shell/public/cpp/connector.h"
14 #include "services/ui/surfaces/display_compositor.h" 14 #include "services/ui/surfaces/display_compositor.h"
15 #include "services/ui/surfaces/surfaces_state.h" 15 #include "services/ui/surfaces/surfaces_state.h"
16 #include "services/ui/ws/display.h"
16 #include "services/ui/ws/platform_display_factory.h" 17 #include "services/ui/ws/platform_display_factory.h"
17 #include "services/ui/ws/platform_display_init_params.h" 18 #include "services/ui/ws/platform_display_init_params.h"
18 #include "services/ui/ws/server_window.h" 19 #include "services/ui/ws/server_window.h"
19 #include "services/ui/ws/window_coordinate_conversions.h" 20 #include "services/ui/ws/window_coordinate_conversions.h"
20 #include "third_party/skia/include/core/SkXfermode.h" 21 #include "third_party/skia/include/core/SkXfermode.h"
21 #include "ui/base/cursor/cursor_loader.h" 22 #include "ui/base/cursor/image_cursors.h"
22 #include "ui/display/display.h" 23 #include "ui/display/display.h"
23 #include "ui/events/event.h" 24 #include "ui/events/event.h"
24 #include "ui/events/event_utils.h" 25 #include "ui/events/event_utils.h"
25 #include "ui/platform_window/platform_ime_controller.h" 26 #include "ui/platform_window/platform_ime_controller.h"
26 #include "ui/platform_window/platform_window.h" 27 #include "ui/platform_window/platform_window.h"
27 28
28 #if defined(OS_WIN) 29 #if defined(OS_WIN)
29 #include "ui/platform_window/win/win_window.h" 30 #include "ui/platform_window/win/win_window.h"
30 #elif defined(USE_X11) 31 #elif defined(USE_X11)
31 #include "ui/platform_window/x11/x11_window.h" 32 #include "ui/platform_window/x11/x11_window.h"
(...skipping 17 matching lines...) Expand all
49 return factory_->CreatePlatformDisplay(); 50 return factory_->CreatePlatformDisplay();
50 51
51 return new DefaultPlatformDisplay(init_params); 52 return new DefaultPlatformDisplay(init_params);
52 } 53 }
53 54
54 DefaultPlatformDisplay::DefaultPlatformDisplay( 55 DefaultPlatformDisplay::DefaultPlatformDisplay(
55 const PlatformDisplayInitParams& init_params) 56 const PlatformDisplayInitParams& init_params)
56 : id_(init_params.display_id), 57 : id_(init_params.display_id),
57 platform_screen_(init_params.platform_screen), 58 platform_screen_(init_params.platform_screen),
58 #if !defined(OS_ANDROID) 59 #if !defined(OS_ANDROID)
59 cursor_loader_(ui::CursorLoader::Create()), 60 image_cursors_(new ImageCursors),
60 #endif 61 #endif
61 frame_generator_(new FrameGenerator(this, init_params.surfaces_state)) { 62 frame_generator_(new FrameGenerator(this, init_params.surfaces_state)) {
62 metrics_.bounds = init_params.display_bounds; 63 metrics_.bounds = init_params.display_bounds;
63 } 64 }
64 65
65 void DefaultPlatformDisplay::Init(PlatformDisplayDelegate* delegate) { 66 void DefaultPlatformDisplay::Init(PlatformDisplayDelegate* delegate) {
66 delegate_ = delegate; 67 delegate_ = delegate;
67 68
68 #if defined(OS_WIN) 69 #if defined(OS_WIN)
69 platform_window_.reset(new ui::WinWindow(this, metrics_.bounds)); 70 platform_window_.reset(new ui::WinWindow(this, metrics_.bounds));
70 #elif defined(USE_X11) 71 #elif defined(USE_X11)
71 platform_window_.reset(new ui::X11Window(this)); 72 platform_window_.reset(new ui::X11Window(this));
72 #elif defined(OS_ANDROID) 73 #elif defined(OS_ANDROID)
73 platform_window_.reset(new ui::PlatformWindowAndroid(this)); 74 platform_window_.reset(new ui::PlatformWindowAndroid(this));
74 #elif defined(USE_OZONE) 75 #elif defined(USE_OZONE)
75 platform_window_ = ui::OzonePlatform::GetInstance()->CreatePlatformWindow( 76 platform_window_ = ui::OzonePlatform::GetInstance()->CreatePlatformWindow(
76 this, metrics_.bounds); 77 this, metrics_.bounds);
77 #else 78 #else
78 NOTREACHED() << "Unsupported platform"; 79 NOTREACHED() << "Unsupported platform";
79 #endif 80 #endif
81
82 #if !defined(OS_ANDROID)
83 image_cursors_->SetDisplay(
84 static_cast<ui::ws::Display*>(delegate_)->ToDisplay(),
85 GetDeviceScaleFactor());
sadrul 2016/08/22 14:39:40 Instead of static casting, introduce display::Disp
Alex Z. 2016/08/22 15:11:51 Done.
86 #endif
80 platform_window_->SetBounds(metrics_.bounds); 87 platform_window_->SetBounds(metrics_.bounds);
81 platform_window_->Show(); 88 platform_window_->Show();
82 } 89 }
83 90
84 int64_t DefaultPlatformDisplay::GetId() const { 91 int64_t DefaultPlatformDisplay::GetId() const {
85 return id_; 92 return id_;
86 } 93 }
87 94
88 DefaultPlatformDisplay::~DefaultPlatformDisplay() { 95 DefaultPlatformDisplay::~DefaultPlatformDisplay() {
89 // Don't notify the delegate from the destructor. 96 // Don't notify the delegate from the destructor.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 132 }
126 133
127 void DefaultPlatformDisplay::SetCursorById(int32_t cursor_id) { 134 void DefaultPlatformDisplay::SetCursorById(int32_t cursor_id) {
128 #if !defined(OS_ANDROID) 135 #if !defined(OS_ANDROID)
129 // TODO(erg): This still isn't sufficient, and will only use native cursors 136 // TODO(erg): This still isn't sufficient, and will only use native cursors
130 // that chrome would use, not custom image cursors. For that, we should 137 // that chrome would use, not custom image cursors. For that, we should
131 // delegate to the window manager to load images from resource packs. 138 // delegate to the window manager to load images from resource packs.
132 // 139 //
133 // We probably also need to deal with different DPIs. 140 // We probably also need to deal with different DPIs.
134 ui::Cursor cursor(cursor_id); 141 ui::Cursor cursor(cursor_id);
135 cursor_loader_->SetPlatformCursor(&cursor); 142 image_cursors_->SetPlatformCursor(&cursor);
143 // cursor_loader_->SetPlatformCursor(&cursor);
sadrul 2016/08/22 14:39:40 Remove.
Alex Z. 2016/08/22 15:11:51 Done.
136 platform_window_->SetCursor(cursor.platform()); 144 platform_window_->SetCursor(cursor.platform());
137 #endif 145 #endif
138 } 146 }
139 147
140 float DefaultPlatformDisplay::GetDeviceScaleFactor() { 148 float DefaultPlatformDisplay::GetDeviceScaleFactor() {
141 return metrics_.device_scale_factor; 149 return metrics_.device_scale_factor;
142 } 150 }
143 151
144 display::Display::Rotation DefaultPlatformDisplay::GetRotation() { 152 display::Display::Rotation DefaultPlatformDisplay::GetRotation() {
145 // TODO(sky): implement me. 153 // TODO(sky): implement me.
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 return delegate_ ? delegate_->IsInHighContrastMode() : false; 302 return delegate_ ? delegate_->IsInHighContrastMode() : false;
295 } 303 }
296 304
297 const ViewportMetrics& DefaultPlatformDisplay::GetViewportMetrics() { 305 const ViewportMetrics& DefaultPlatformDisplay::GetViewportMetrics() {
298 return metrics_; 306 return metrics_;
299 } 307 }
300 308
301 } // namespace ws 309 } // namespace ws
302 310
303 } // namespace ui 311 } // namespace ui
OLDNEW
« services/ui/ws/platform_display.h ('K') | « services/ui/ws/platform_display.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698