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