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

Side by Side Diff: ui/base/cursor/cursors_android.cc

Issue 2878403002: Support setting mouse cursor icon in Android N. (Closed)
Patch Set: Support setting mouse cursor icon in Android N Created 3 years, 7 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 | « ui/base/cursor/cursors_android.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/base/cursor/cursors_android.h"
6
7 #include "content/app/resources/grit/content_resources.h"
8 #include "third_party/WebKit/public/platform/WebCursorInfo.h"
9 #include "third_party/skia/include/core/SkBitmap.h"
10 #include "ui/base/resource/resource_bundle.h"
11 #include "ui/gfx/image/image_skia.h"
12
13 using blink::WebCursorInfo;
14
15 namespace ui {
16
17 bool GetCursorBitmap(int type, SkBitmap* bitmap) {
18 DCHECK(bitmap);
19 int resource_id;
20 switch (type) {
21 case WebCursorInfo::kTypeEastResize:
22 resource_id = IDR_ANDROID_EAST_RESIZE_CURSOR;
23 break;
24 case WebCursorInfo::kTypeNorthResize:
25 resource_id = IDR_ANDROID_NORTH_RESIZE_CURSOR;
26 break;
27 case WebCursorInfo::kTypeNorthEastResize:
28 resource_id = IDR_ANDROID_NORTHEAST_RESIZE_CURSOR;
29 break;
30 case WebCursorInfo::kTypeNorthWestResize:
31 resource_id = IDR_ANDROID_NORTHWEST_RESIZE_CURSOR;
32 break;
33 case WebCursorInfo::kTypeSouthResize:
34 resource_id = IDR_ANDROID_SOUTH_RESIZE_CURSOR;
35 break;
36 case WebCursorInfo::kTypeSouthEastResize:
37 resource_id = IDR_ANDROID_SOUTHEAST_RESIZE_CURSOR;
38 break;
39 case WebCursorInfo::kTypeSouthWestResize:
40 resource_id = IDR_ANDROID_SOUTHWEST_RESIZE_CURSOR;
41 break;
42 case WebCursorInfo::kTypeWestResize:
43 resource_id = IDR_ANDROID_WEST_RESIZE_CURSOR;
44 break;
45 case WebCursorInfo::kTypeMove:
46 resource_id = IDR_ANDROID_MOVE_CURSOR;
47 break;
48 // TODO(jaebaek): set PROGRESS, MIDDLE_PANNING and NOT_ALLOWED
49 // types correctly after fixing http://crbug.com/584424.
50 case WebCursorInfo::kTypeMiddlePanning:
51 case WebCursorInfo::kTypeProgress:
52 case WebCursorInfo::kTypeNotAllowed:
53 default:
54 return false;
55 }
56
57 const SkBitmap* cursor_bitmap = ResourceBundle::GetSharedInstance()
58 .GetImageSkiaNamed(resource_id)
aelias_OOO_until_Jul13 2017/05/23 22:43:26 Hmm, sorry to go back on previous code review sugg
jaebaek 2017/05/24 11:26:15 Can I just return false for all the cases here and
59 ->bitmap();
60 if (!cursor_bitmap)
61 return false;
62 *bitmap = *cursor_bitmap;
63 return true;
64 }
65
66 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/cursor/cursors_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698