| Index: ui/base/cursor/cursors_android.cc
|
| diff --git a/ui/base/cursor/cursors_android.cc b/ui/base/cursor/cursors_android.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b09ddc189e58fe58616843b5e3d369630069eb87
|
| --- /dev/null
|
| +++ b/ui/base/cursor/cursors_android.cc
|
| @@ -0,0 +1,70 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "ui/base/cursor/cursors_android.h"
|
| +
|
| +#include "third_party/WebKit/public/platform/WebCursorInfo.h"
|
| +#include "third_party/skia/include/core/SkBitmap.h"
|
| +#include "ui/base/resource/resource_bundle.h"
|
| +#include "ui/gfx/image/image_skia.h"
|
| +#include "ui/resources/grit/ui_resources.h"
|
| +
|
| +using blink::WebCursorInfo;
|
| +
|
| +namespace ui {
|
| +
|
| +bool GetCursorBitmap(int type, SkBitmap* bitmap) {
|
| + DCHECK(bitmap);
|
| + int resource_id;
|
| + switch (type) {
|
| + case WebCursorInfo::kTypeEastResize:
|
| + resource_id = IDR_ANDROID_CURSOR_EAST_RESIZE;
|
| + break;
|
| + case WebCursorInfo::kTypeNorthResize:
|
| + resource_id = IDR_ANDROID_CURSOR_NORTH_RESIZE;
|
| + break;
|
| + case WebCursorInfo::kTypeNorthEastResize:
|
| + resource_id = IDR_ANDROID_CURSOR_NORTH_EAST_RESIZE;
|
| + break;
|
| + case WebCursorInfo::kTypeNorthWestResize:
|
| + resource_id = IDR_ANDROID_CURSOR_NORTH_WEST_RESIZE;
|
| + break;
|
| + case WebCursorInfo::kTypeSouthResize:
|
| + resource_id = IDR_ANDROID_CURSOR_SOUTH_RESIZE;
|
| + break;
|
| + case WebCursorInfo::kTypeSouthEastResize:
|
| + resource_id = IDR_ANDROID_CURSOR_SOUTH_EAST_RESIZE;
|
| + break;
|
| + case WebCursorInfo::kTypeSouthWestResize:
|
| + resource_id = IDR_ANDROID_CURSOR_SOUTH_WEST_RESIZE;
|
| + break;
|
| + case WebCursorInfo::kTypeWestResize:
|
| + resource_id = IDR_ANDROID_CURSOR_WEST_RESIZE;
|
| + break;
|
| + case WebCursorInfo::kTypeMove:
|
| + resource_id = IDR_ANDROID_CURSOR_MOVE;
|
| + break;
|
| + case WebCursorInfo::kTypeMiddlePanning:
|
| + resource_id = IDR_ANDROID_CURSOR_MIDDLE_PANNING;
|
| + break;
|
| + case WebCursorInfo::kTypeProgress:
|
| + resource_id = IDR_ANDROID_CURSOR_PROGRESS;
|
| + break;
|
| + case WebCursorInfo::kTypeNotAllowed:
|
| + resource_id = IDR_ANDROID_CURSOR_NOT_ALLOWED;
|
| + break;
|
| + default:
|
| + return false;
|
| + }
|
| +
|
| + const SkBitmap* cursor_bitmap = ResourceBundle::GetSharedInstance()
|
| + .GetImageSkiaNamed(resource_id)
|
| + ->bitmap();
|
| + if (!cursor_bitmap)
|
| + return false;
|
| + *bitmap = *cursor_bitmap;
|
| + return true;
|
| +}
|
| +
|
| +} // namespace ui
|
|
|