| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" |
| 14 #include "ui/gfx/font.h" | 14 #include "ui/gfx/font.h" |
| 15 #include "ui/gfx/point.h" | 15 #include "ui/gfx/point.h" |
| 16 #include "ui/gfx/size.h" | 16 #include "ui/gfx/size.h" |
| 17 | 17 |
| 18 namespace drag_utils { | 18 namespace drag_utils { |
| 19 | 19 |
| 20 // Maximum width of the link drag image in pixels. | 20 // Maximum width of the link drag image in pixels. |
| 21 static const int kLinkDragImageVPadding = 3; | 21 static const int kLinkDragImageVPadding = 3; |
| 22 | 22 |
| 23 // File dragging pixel measurements | 23 // File dragging pixel measurements |
| 24 static const int kFileDragImageMaxWidth = 200; | 24 static const int kFileDragImageMaxWidth = 200; |
| 25 static const SkColor kFileDragImageTextColor = SK_ColorBLACK; | 25 static const SkColor kFileDragImageTextColor = SK_ColorBLACK; |
| 26 | 26 |
| 27 void CreateDragImageForFile(const FilePath& file_name, | 27 void CreateDragImageForFile(const FilePath& file_name, |
| 28 const SkBitmap* icon, | 28 const gfx::ImageSkia* icon, |
| 29 ui::OSExchangeData* data_object) { | 29 ui::OSExchangeData* data_object) { |
| 30 DCHECK(icon); | 30 DCHECK(icon); |
| 31 DCHECK(data_object); | 31 DCHECK(data_object); |
| 32 | 32 |
| 33 // Set up our text portion | 33 // Set up our text portion |
| 34 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 34 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 35 gfx::Font font = rb.GetFont(ResourceBundle::BaseFont); | 35 gfx::Font font = rb.GetFont(ResourceBundle::BaseFont); |
| 36 | 36 |
| 37 const int width = kFileDragImageMaxWidth; | 37 const int width = kFileDragImageMaxWidth; |
| 38 // Add +2 here to allow room for the halo. | 38 // Add +2 here to allow room for the halo. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 65 | 65 |
| 66 void SetDragImageOnDataObject(const gfx::Canvas& canvas, | 66 void SetDragImageOnDataObject(const gfx::Canvas& canvas, |
| 67 const gfx::Size& size, | 67 const gfx::Size& size, |
| 68 const gfx::Point& cursor_offset, | 68 const gfx::Point& cursor_offset, |
| 69 ui::OSExchangeData* data_object) { | 69 ui::OSExchangeData* data_object) { |
| 70 SetDragImageOnDataObject(canvas.ExtractBitmap(), size, cursor_offset, | 70 SetDragImageOnDataObject(canvas.ExtractBitmap(), size, cursor_offset, |
| 71 data_object); | 71 data_object); |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // namespace drag_utils | 74 } // namespace drag_utils |
| OLD | NEW |