| 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 #include "views/drag_utils.h" | 5 #include "views/drag_utils.h" |
| 6 | 6 |
| 7 #include <objidl.h> | 7 #include <objidl.h> |
| 8 #include <shlobj.h> | 8 #include <shlobj.h> |
| 9 #include <shobjidl.h> | 9 #include <shobjidl.h> |
| 10 | 10 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 void CreateDragImageForFile(const std::wstring& file_name, | 112 void CreateDragImageForFile(const std::wstring& file_name, |
| 113 SkBitmap* icon, | 113 SkBitmap* icon, |
| 114 IDataObject* data_object) { | 114 IDataObject* data_object) { |
| 115 DCHECK(icon); | 115 DCHECK(icon); |
| 116 DCHECK(data_object); | 116 DCHECK(data_object); |
| 117 | 117 |
| 118 // Set up our text portion | 118 // Set up our text portion |
| 119 const std::wstring& name = file_util::GetFilenameFromPath(file_name); | 119 const std::wstring& name = file_util::GetFilenameFromPath(file_name); |
| 120 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 120 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 121 ChromeFont font = rb.GetFont(ResourceBundle::BaseFont); | 121 gfx::Font font = rb.GetFont(ResourceBundle::BaseFont); |
| 122 | 122 |
| 123 const int width = kFileDragImageMaxWidth; | 123 const int width = kFileDragImageMaxWidth; |
| 124 // Add +2 here to allow room for the halo. | 124 // Add +2 here to allow room for the halo. |
| 125 const int height = font.height() + icon->height() + | 125 const int height = font.height() + icon->height() + |
| 126 kLinkDragImageVPadding + 2; | 126 kLinkDragImageVPadding + 2; |
| 127 ChromeCanvas canvas(width, height, false /* translucent */); | 127 ChromeCanvas canvas(width, height, false /* translucent */); |
| 128 | 128 |
| 129 // Paint the icon. | 129 // Paint the icon. |
| 130 canvas.DrawBitmapInt(*icon, (width - icon->width()) / 2, 0); | 130 canvas.DrawBitmapInt(*icon, (width - icon->width()) / 2, 0); |
| 131 | 131 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 150 HBITMAP bitmap = CreateBitmapFromCanvas(canvas, width, height); | 150 HBITMAP bitmap = CreateBitmapFromCanvas(canvas, width, height); |
| 151 | 151 |
| 152 // Attach 'bitmap' to the data_object. | 152 // Attach 'bitmap' to the data_object. |
| 153 SetDragImageOnDataObject(bitmap, width, height, | 153 SetDragImageOnDataObject(bitmap, width, height, |
| 154 cursor_x_offset, | 154 cursor_x_offset, |
| 155 cursor_y_offset, | 155 cursor_y_offset, |
| 156 data_object); | 156 data_object); |
| 157 } | 157 } |
| 158 | 158 |
| 159 } // namespace drag_utils | 159 } // namespace drag_utils |
| OLD | NEW |