[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / ui / base / cursor / ozone / bitmap_cursor_factory_ozone.cc
blobc24c80fd9c23f55d45e2b9d44a0ac9d44ea85480
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
3 // found in the LICENSE file.
5 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h"
7 #include "base/logging.h"
8 #include "third_party/skia/include/core/SkBitmap.h"
9 #include "ui/base/cursor/cursors_aura.h"
11 namespace ui {
13 namespace {
15 BitmapCursorOzone* ToBitmapCursorOzone(PlatformCursor cursor) {
16 return static_cast<BitmapCursorOzone*>(cursor);
19 PlatformCursor ToPlatformCursor(BitmapCursorOzone* cursor) {
20 return static_cast<PlatformCursor>(cursor);
23 } // namespace
25 BitmapCursorFactoryOzone::BitmapCursorFactoryOzone() {}
27 BitmapCursorFactoryOzone::~BitmapCursorFactoryOzone() {}
29 PlatformCursor BitmapCursorFactoryOzone::GetDefaultCursor(int type) {
30 if (type == kCursorNone)
31 return NULL; // NULL is used for hidden cursor.
33 if (!default_cursors_.count(type)) {
34 // Create new owned image cursor from default aura bitmap for this type.
35 SkBitmap bitmap;
36 gfx::Point hotspot;
37 CHECK(GetCursorBitmap(type, &bitmap, &hotspot));
38 default_cursors_[type] = new BitmapCursorOzone(bitmap, hotspot);
41 // Returned owned default cursor for this type.
42 return default_cursors_[type];
45 PlatformCursor BitmapCursorFactoryOzone::CreateImageCursor(
46 const SkBitmap& bitmap,
47 const gfx::Point& hotspot) {
48 BitmapCursorOzone* cursor = new BitmapCursorOzone(bitmap, hotspot);
49 cursor->AddRef(); // Balanced by UnrefImageCursor.
50 return ToPlatformCursor(cursor);
53 void BitmapCursorFactoryOzone::RefImageCursor(PlatformCursor cursor) {
54 ToBitmapCursorOzone(cursor)->AddRef();
57 void BitmapCursorFactoryOzone::UnrefImageCursor(PlatformCursor cursor) {
58 ToBitmapCursorOzone(cursor)->Release();
61 void BitmapCursorFactoryOzone::SetCursor(gfx::AcceleratedWidget widget,
62 PlatformCursor platform_cursor) {
63 BitmapCursorOzone* cursor = ToBitmapCursorOzone(platform_cursor);
64 SetBitmapCursor(widget, make_scoped_refptr(cursor));
67 void BitmapCursorFactoryOzone::SetBitmapCursor(
68 gfx::AcceleratedWidget widget,
69 scoped_refptr<BitmapCursorOzone>) {
70 NOTIMPLEMENTED();
73 } // namespace ui