| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VIEWS_DRAG_UTILS_H_ | 5 #ifndef VIEWS_DRAG_UTILS_H_ |
| 6 #define VIEWS_DRAG_UTILS_H_ | 6 #define VIEWS_DRAG_UTILS_H_ |
| 7 | 7 |
| 8 #include <objidl.h> | |
| 9 #include <string> | 8 #include <string> |
| 10 | 9 |
| 11 namespace gfx { | 10 namespace gfx { |
| 12 class Canvas; | 11 class Canvas; |
| 13 } | 12 } |
| 14 class GURL; | 13 class GURL; |
| 15 class OSExchangeData; | 14 class OSExchangeData; |
| 16 class SkBitmap; | 15 class SkBitmap; |
| 17 | 16 |
| 18 namespace drag_utils { | 17 namespace drag_utils { |
| 19 | 18 |
| 20 // Sets url and title on data as well as setting a suitable image for dragging. | 19 // Sets url and title on data as well as setting a suitable image for dragging. |
| 21 // The image looks like that of the bookmark buttons. | 20 // The image looks like that of the bookmark buttons. |
| 22 void SetURLAndDragImage(const GURL& url, | 21 void SetURLAndDragImage(const GURL& url, |
| 23 const std::wstring& title, | 22 const std::wstring& title, |
| 24 const SkBitmap& icon, | 23 const SkBitmap& icon, |
| 25 OSExchangeData* data); | 24 OSExchangeData* data); |
| 26 | 25 |
| 27 // Creates a dragging image to be displayed when the user drags a file from | 26 // Creates a dragging image to be displayed when the user drags a file from |
| 28 // Chrome (via the download manager, for example). The drag image is set into | 27 // Chrome (via the download manager, for example). The drag image is set into |
| 29 // the supplied data_object. 'file_name' can be a full path, but the directory | 28 // the supplied data_object. 'file_name' can be a full path, but the directory |
| 30 // portion will be truncated in the drag image. | 29 // portion will be truncated in the drag image. |
| 31 void CreateDragImageForFile(const std::wstring& file_name, | 30 void CreateDragImageForFile(const std::wstring& file_name, |
| 32 SkBitmap* icon, | 31 SkBitmap* icon, |
| 33 IDataObject* data_object); | 32 OSExchangeData* data_object); |
| 34 | 33 |
| 35 // Sets the drag image on data_object from the supplied canvas. width/height | 34 // Sets the drag image on data_object from the supplied canvas. width/height |
| 36 // are the size of the image to use, and the offsets give the location of | 35 // are the size of the image to use, and the offsets give the location of |
| 37 // the hotspot for the drag image. | 36 // the hotspot for the drag image. |
| 38 void SetDragImageOnDataObject(const gfx::Canvas& canvas, | 37 void SetDragImageOnDataObject(const gfx::Canvas& canvas, |
| 39 int width, | 38 int width, |
| 40 int height, | 39 int height, |
| 41 int cursor_x_offset, | 40 int cursor_x_offset, |
| 42 int cursor_y_offset, | 41 int cursor_y_offset, |
| 43 IDataObject* data_object); | 42 OSExchangeData* data_object); |
| 44 | |
| 45 } // namespace drag_utils | 43 } // namespace drag_utils |
| 46 | 44 |
| 47 #endif // #ifndef VIEWS_DRAG_UTILS_H_ | 45 #endif // #ifndef VIEWS_DRAG_UTILS_H_ |
| OLD | NEW |