OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/drag_utils.h" | 5 #include "views/drag_utils.h" |
6 | 6 |
7 #include "app/os_exchange_data.h" | 7 #include "app/os_exchange_data.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 canvas.DrawBitmapInt(*icon, (width - icon->width()) / 2, 0); | 73 canvas.DrawBitmapInt(*icon, (width - icon->width()) / 2, 0); |
74 | 74 |
75 std::wstring name = file_name.BaseName().ToWStringHack(); | 75 std::wstring name = file_name.BaseName().ToWStringHack(); |
76 #if defined(OS_WIN) | 76 #if defined(OS_WIN) |
77 // Paint the file name. We inset it one pixel to allow room for the halo. | 77 // Paint the file name. We inset it one pixel to allow room for the halo. |
78 canvas.DrawStringWithHalo(name, font, kFileDragImageTextColor, SK_ColorWHITE, | 78 canvas.DrawStringWithHalo(name, font, kFileDragImageTextColor, SK_ColorWHITE, |
79 1, icon->height() + kLinkDragImageVPadding + 1, | 79 1, icon->height() + kLinkDragImageVPadding + 1, |
80 width - 2, font.GetHeight(), | 80 width - 2, font.GetHeight(), |
81 gfx::Canvas::TEXT_ALIGN_CENTER); | 81 gfx::Canvas::TEXT_ALIGN_CENTER); |
82 #else | 82 #else |
83 canvas.DrawStringInt(WideToUTF16Hack(name), font, kFileDragImageTextColor, | 83 canvas.DrawStringInt(name, font, kFileDragImageTextColor, |
84 0, icon->height() + kLinkDragImageVPadding, | 84 0, icon->height() + kLinkDragImageVPadding, |
85 width, font.GetHeight(), gfx::Canvas::TEXT_ALIGN_CENTER); | 85 width, font.GetHeight(), gfx::Canvas::TEXT_ALIGN_CENTER); |
86 #endif | 86 #endif |
87 | 87 |
88 SetDragImageOnDataObject(canvas, gfx::Size(width, height), | 88 SetDragImageOnDataObject(canvas, gfx::Size(width, height), |
89 gfx::Point(width / 2, kLinkDragImageVPadding), | 89 gfx::Point(width / 2, kLinkDragImageVPadding), |
90 data_object); | 90 data_object); |
91 } | 91 } |
92 | 92 |
93 void SetDragImageOnDataObject(const gfx::Canvas& canvas, | 93 void SetDragImageOnDataObject(const gfx::Canvas& canvas, |
94 const gfx::Size& size, | 94 const gfx::Size& size, |
95 const gfx::Point& cursor_offset, | 95 const gfx::Point& cursor_offset, |
96 OSExchangeData* data_object) { | 96 OSExchangeData* data_object) { |
97 SetDragImageOnDataObject( | 97 SetDragImageOnDataObject( |
98 canvas.AsCanvasSkia()->ExtractBitmap(), size, cursor_offset, data_object); | 98 canvas.AsCanvasSkia()->ExtractBitmap(), size, cursor_offset, data_object); |
99 } | 99 } |
100 | 100 |
101 } // namespace drag_utils | 101 } // namespace drag_utils |
OLD | NEW |