#ifndef UI_BASE_CURSOR_OZONE_BITMAP_CURSOR_FACTORY_OZONE_H_
#define UI_BASE_CURSOR_OZONE_BITMAP_CURSOR_FACTORY_OZONE_H_
#include <map>
#include "base/memory/ref_counted.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/cursor/ozone/cursor_factory_ozone.h"
#include "ui/base/ui_base_export.h"
#include "ui/gfx/geometry/point.h"
namespace ui {
class UI_BASE_EXPORT BitmapCursorOzone
: public base::RefCounted<BitmapCursorOzone> {
public:
BitmapCursorOzone(const SkBitmap& bitmap, const gfx::Point& hotspot)
: bitmap_(bitmap), hotspot_(hotspot) {}
const gfx::Point& hotspot() { return hotspot_; }
const SkBitmap& bitmap() { return bitmap_; }
private:
friend class base::RefCounted<BitmapCursorOzone>;
~BitmapCursorOzone() {}
SkBitmap bitmap_;
gfx::Point hotspot_;
DISALLOW_COPY_AND_ASSIGN(BitmapCursorOzone);
};
class UI_BASE_EXPORT BitmapCursorFactoryOzone : public CursorFactoryOzone {
public:
BitmapCursorFactoryOzone();
virtual ~BitmapCursorFactoryOzone();
virtual PlatformCursor GetDefaultCursor(int type) OVERRIDE;
virtual PlatformCursor CreateImageCursor(const SkBitmap& bitmap,
const gfx::Point& hotspot) OVERRIDE;
virtual void RefImageCursor(PlatformCursor cursor) OVERRIDE;
virtual void UnrefImageCursor(PlatformCursor cursor) OVERRIDE;
virtual void SetCursor(gfx::AcceleratedWidget widget,
PlatformCursor cursor) OVERRIDE;
virtual void SetBitmapCursor(gfx::AcceleratedWidget window,
scoped_refptr<BitmapCursorOzone> cursor);
private:
typedef std::map<int, scoped_refptr<BitmapCursorOzone> > DefaultCursorMap;
DefaultCursorMap default_cursors_;
DISALLOW_COPY_AND_ASSIGN(BitmapCursorFactoryOzone);
};
}
#endif