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" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
86 void CreateDragImageForFile(const FilePath& file_name, | 86 void CreateDragImageForFile(const FilePath& file_name, |
87 const gfx::ImageSkia* icon, | 87 const gfx::ImageSkia* icon, |
88 ui::OSExchangeData* data_object) { | 88 ui::OSExchangeData* data_object) { |
89 DCHECK(icon); | 89 DCHECK(icon); |
90 DCHECK(data_object); | 90 DCHECK(data_object); |
91 gfx::CanvasImageSource* source = new FileDragImageSource(file_name, *icon); | 91 gfx::CanvasImageSource* source = new FileDragImageSource(file_name, *icon); |
92 gfx::Size size = source->size(); | 92 gfx::Size size = source->size(); |
93 // ImageSkia takes ownership of |source|. | 93 // ImageSkia takes ownership of |source|. |
94 gfx::ImageSkia image = gfx::ImageSkia(source, size); | 94 gfx::ImageSkia image = gfx::ImageSkia(source, size); |
95 | 95 |
96 SetDragImageOnDataObject(image, size, | 96 SetDragImageOnDataObject( |
97 gfx::Point(size.width() / 2, kLinkDragImageVPadding), | 97 image, size, gfx::Vector2d(size.width() / 2, kLinkDragImageVPadding), |
Peter Kasting
2012/10/31 01:04:41
Gah, didn't realize inlining this would actually m
danakj
2012/10/31 16:55:46
Done.
| |
98 data_object); | 98 data_object); |
99 } | 99 } |
100 | 100 |
101 void SetDragImageOnDataObject(const gfx::Canvas& canvas, | 101 void SetDragImageOnDataObject(const gfx::Canvas& canvas, |
102 const gfx::Size& size, | 102 const gfx::Size& size, |
103 const gfx::Point& cursor_offset, | 103 const gfx::Vector2d& cursor_offset, |
104 ui::OSExchangeData* data_object) { | 104 ui::OSExchangeData* data_object) { |
105 gfx::ImageSkia image = gfx::ImageSkia(canvas.ExtractImageRep()); | 105 gfx::ImageSkia image = gfx::ImageSkia(canvas.ExtractImageRep()); |
106 SetDragImageOnDataObject(image, size, cursor_offset, data_object); | 106 SetDragImageOnDataObject(image, size, cursor_offset, data_object); |
107 } | 107 } |
108 | 108 |
109 } // namespace drag_utils | 109 } // namespace drag_utils |
OLD | NEW |