Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "ui/base/dragdrop/drag_utils.h" | 5 #include "ui/base/dragdrop/drag_utils.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| 11 #include "ui/base/dragdrop/os_exchange_data.h" | 11 #include "ui/base/dragdrop/os_exchange_data.h" |
| 12 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
| 13 #include "ui/gfx/canvas.h" | |
| 13 #include "ui/gfx/canvas_skia.h" | 14 #include "ui/gfx/canvas_skia.h" |
| 14 #include "ui/gfx/font.h" | 15 #include "ui/gfx/font.h" |
| 15 #include "ui/gfx/point.h" | 16 #include "ui/gfx/point.h" |
| 16 #include "ui/gfx/size.h" | 17 #include "ui/gfx/size.h" |
| 17 | 18 |
| 18 namespace drag_utils { | 19 namespace drag_utils { |
| 19 | 20 |
| 20 // Maximum width of the link drag image in pixels. | 21 // Maximum width of the link drag image in pixels. |
| 21 static const int kLinkDragImageVPadding = 3; | 22 static const int kLinkDragImageVPadding = 3; |
| 22 | 23 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 canvas.DrawStringInt(name, font, kFileDragImageTextColor, | 55 canvas.DrawStringInt(name, font, kFileDragImageTextColor, |
| 55 0, icon->height() + kLinkDragImageVPadding, | 56 0, icon->height() + kLinkDragImageVPadding, |
| 56 width, font.GetHeight(), gfx::Canvas::TEXT_ALIGN_CENTER); | 57 width, font.GetHeight(), gfx::Canvas::TEXT_ALIGN_CENTER); |
| 57 #endif | 58 #endif |
| 58 | 59 |
| 59 SetDragImageOnDataObject(canvas, gfx::Size(width, height), | 60 SetDragImageOnDataObject(canvas, gfx::Size(width, height), |
| 60 gfx::Point(width / 2, kLinkDragImageVPadding), | 61 gfx::Point(width / 2, kLinkDragImageVPadding), |
| 61 data_object); | 62 data_object); |
| 62 } | 63 } |
| 63 | 64 |
| 64 void SetDragImageOnDataObject(const gfx::Canvas& canvas, | 65 void SetDragImageOnDataObject(const gfx::CanvasSkia& canvas, |
|
Ben Goodger (Google)
2012/03/06 15:46:58
????
tfarina
2012/03/06 17:09:09
Done.
| |
| 65 const gfx::Size& size, | 66 const gfx::Size& size, |
| 66 const gfx::Point& cursor_offset, | 67 const gfx::Point& cursor_offset, |
| 67 ui::OSExchangeData* data_object) { | 68 ui::OSExchangeData* data_object) { |
| 68 SetDragImageOnDataObject( | 69 SetDragImageOnDataObject( |
| 69 canvas.AsCanvasSkia()->ExtractBitmap(), size, cursor_offset, data_object); | 70 canvas.ExtractBitmap(), size, cursor_offset, data_object); |
| 70 } | 71 } |
| 71 | 72 |
| 72 } // namespace drag_utils | 73 } // namespace drag_utils |
| OLD | NEW |