• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2012 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 "content/common/cursors/webcursor.h"
6 
7 #include <windows.h>
8 
9 #include "third_party/WebKit/public/platform/WebCursorInfo.h"
10 #include "ui/gfx/icon_util.h"
11 
12 namespace content {
13 
GetPlatformCursor()14 ui::PlatformCursor WebCursor::GetPlatformCursor() {
15   if (!IsCustom())
16     return LoadCursor(NULL, IDC_ARROW);
17 
18   if (custom_cursor_)
19     return custom_cursor_;
20 
21   custom_cursor_ =
22       IconUtil::CreateCursorFromDIB(
23           custom_size_,
24           hotspot_,
25           !custom_data_.empty() ? &custom_data_[0] : NULL,
26           custom_data_.size());
27   return custom_cursor_;
28 }
29 
SetDisplayInfo(const gfx::Display & display)30 void WebCursor::SetDisplayInfo(const gfx::Display& display) {
31   // TODO(winguru): Add support for scaling the cursor.
32 }
33 
InitPlatformData()34 void WebCursor::InitPlatformData() {
35   custom_cursor_ = NULL;
36 }
37 
SerializePlatformData(Pickle * pickle) const38 bool WebCursor::SerializePlatformData(Pickle* pickle) const {
39   return true;
40 }
41 
DeserializePlatformData(PickleIterator * iter)42 bool WebCursor::DeserializePlatformData(PickleIterator* iter) {
43   return true;
44 }
45 
IsPlatformDataEqual(const WebCursor & other) const46 bool WebCursor::IsPlatformDataEqual(const WebCursor& other) const {
47   return true;
48 }
49 
CleanupPlatformData()50 void WebCursor::CleanupPlatformData() {
51   if (custom_cursor_) {
52     DestroyIcon(custom_cursor_);
53     custom_cursor_ = NULL;
54   }
55 }
56 
CopyPlatformData(const WebCursor & other)57 void WebCursor::CopyPlatformData(const WebCursor& other) {
58 }
59 
60 }  // namespace content
61