Make USB permissions work in the new permission message system
[chromium-blink-merge.git] / content / renderer / cursor_utils.cc
blob2ad8a9f60d012af88c953276acc833842300df03
1 // Copyright 2013 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 "content/renderer/cursor_utils.h"
7 #include "build/build_config.h"
8 #include "content/common/cursors/webcursor.h"
9 #include "third_party/WebKit/public/platform/WebCursorInfo.h"
11 using blink::WebCursorInfo;
13 namespace content {
15 bool GetWebKitCursorInfo(const WebCursor& cursor,
16 WebCursorInfo* webkit_cursor_info) {
17 WebCursor::CursorInfo cursor_info;
18 cursor.GetCursorInfo(&cursor_info);
20 webkit_cursor_info->type = cursor_info.type;
21 webkit_cursor_info->hotSpot = cursor_info.hotspot;
22 webkit_cursor_info->customImage = cursor_info.custom_image;
23 webkit_cursor_info->imageScaleFactor = cursor_info.image_scale_factor;
24 #if defined(OS_WIN)
25 webkit_cursor_info->externalHandle = cursor_info.external_handle;
26 #endif
27 return true;
30 void InitializeCursorFromWebKitCursorInfo(
31 WebCursor* cursor,
32 const WebCursorInfo& webkit_cursor_info) {
33 WebCursor::CursorInfo web_cursor_info;
34 web_cursor_info.type = webkit_cursor_info.type;
35 web_cursor_info.image_scale_factor = webkit_cursor_info.imageScaleFactor;
36 web_cursor_info.hotspot = webkit_cursor_info.hotSpot;
37 web_cursor_info.custom_image = webkit_cursor_info.customImage.getSkBitmap();
38 #if defined(OS_WIN)
39 web_cursor_info.external_handle = webkit_cursor_info.externalHandle;
40 #endif
41 cursor->InitFromCursorInfo(web_cursor_info);
44 } // namespce content