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

Side by Side Diff: services/ui/public/interfaces/cursor/cursor_struct_traits.cc

Issue 2949353003: Implement large cursors in Mushrome. (Closed)
Patch Set: rename everything to CursorSize Created 3 years, 5 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/public/interfaces/cursor/cursor_struct_traits.h" 5 #include "services/ui/public/interfaces/cursor/cursor_struct_traits.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "mojo/common/common_custom_types_struct_traits.h" 8 #include "mojo/common/common_custom_types_struct_traits.h"
9 #include "services/ui/public/interfaces/cursor/cursor.mojom.h" 9 #include "services/ui/public/interfaces/cursor/cursor.mojom.h"
10 #include "skia/public/interfaces/bitmap_skbitmap_struct_traits.h" 10 #include "skia/public/interfaces/bitmap_skbitmap_struct_traits.h"
11 #include "third_party/skia/include/core/SkBitmap.h" 11 #include "third_party/skia/include/core/SkBitmap.h"
12 #include "ui/base/cursor/cursor.h"
13 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" 12 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h"
14 13
15 namespace mojo { 14 namespace mojo {
16 15
17 // static 16 // static
18 ui::mojom::CursorType 17 ui::mojom::CursorType
19 EnumTraits<ui::mojom::CursorType, ui::CursorType>::ToMojom( 18 EnumTraits<ui::mojom::CursorType, ui::CursorType>::ToMojom(
20 ui::CursorType input) { 19 ui::CursorType input) {
21 switch (input) { 20 switch (input) {
22 case ui::CursorType::kNull: 21 case ui::CursorType::kNull:
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 case ui::mojom::CursorType::kCustom: 261 case ui::mojom::CursorType::kCustom:
263 *out = ui::CursorType::kCustom; 262 *out = ui::CursorType::kCustom;
264 return true; 263 return true;
265 } 264 }
266 265
267 NOTREACHED(); 266 NOTREACHED();
268 return false; 267 return false;
269 } 268 }
270 269
271 // static 270 // static
271 ui::mojom::CursorSize
272 EnumTraits<ui::mojom::CursorSize, ui::CursorSize>::ToMojom(
273 ui::CursorSize input) {
274 switch (input) {
275 case ui::CursorSize::kNormal:
276 return ui::mojom::CursorSize::kNormal;
277 case ui::CursorSize::kLarge:
278 return ui::mojom::CursorSize::kLarge;
279 }
280
281 NOTREACHED();
282 return ui::mojom::CursorSize::kNormal;
283 }
284
285 // static
286 bool EnumTraits<ui::mojom::CursorSize, ui::CursorSize>::FromMojom(
287 ui::mojom::CursorSize input,
288 ui::CursorSize* out) {
289 switch (input) {
290 case ui::mojom::CursorSize::kNormal:
291 *out = ui::CursorSize::kNormal;
292 return true;
293 case ui::mojom::CursorSize::kLarge:
294 *out = ui::CursorSize::kLarge;
295 return true;
296 }
297
298 NOTREACHED();
299 return false;
300 }
301
302 // static
272 const base::TimeDelta& 303 const base::TimeDelta&
273 StructTraits<ui::mojom::CursorDataDataView, ui::CursorData>::frame_delay( 304 StructTraits<ui::mojom::CursorDataDataView, ui::CursorData>::frame_delay(
274 const ui::CursorData& c) { 305 const ui::CursorData& c) {
275 return c.frame_delay(); 306 return c.frame_delay();
276 } 307 }
277 308
278 // static 309 // static
279 const gfx::Point& 310 const gfx::Point&
280 StructTraits<ui::mojom::CursorDataDataView, ui::CursorData>::hotspot_in_pixels( 311 StructTraits<ui::mojom::CursorDataDataView, ui::CursorData>::hotspot_in_pixels(
281 const ui::CursorData& c) { 312 const ui::CursorData& c) {
(...skipping 30 matching lines...) Expand all
312 !data.ReadFrameDelay(&frame_delay)) { 343 !data.ReadFrameDelay(&frame_delay)) {
313 return false; 344 return false;
314 } 345 }
315 346
316 *out = ui::CursorData(hotspot_in_pixels, cursor_frames, scale_factor, 347 *out = ui::CursorData(hotspot_in_pixels, cursor_frames, scale_factor,
317 frame_delay); 348 frame_delay);
318 return true; 349 return true;
319 } 350 }
320 351
321 } // namespace mojo 352 } // namespace mojo
OLDNEW
« no previous file with comments | « services/ui/public/interfaces/cursor/cursor_struct_traits.h ('k') | services/ui/public/interfaces/window_manager.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698