Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: ui/base/dragdrop/drag_utils.cc

Issue 328993002: Ensure that the size passed down to the SetDragImageOnDataObject function called from drag_utils::S… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed parentheses and fixed alignment Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/base/dragdrop/drag_utils.h ('k') | ui/base/dragdrop/drag_utils_aura.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "ui/base/dragdrop/os_exchange_data.h" 10 #include "ui/base/dragdrop/os_exchange_data.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 void CreateDragImageForFile(const base::FilePath& file_name, 85 void CreateDragImageForFile(const base::FilePath& file_name,
86 const gfx::ImageSkia& icon, 86 const gfx::ImageSkia& icon,
87 ui::OSExchangeData* data_object) { 87 ui::OSExchangeData* data_object) {
88 DCHECK(data_object); 88 DCHECK(data_object);
89 gfx::CanvasImageSource* source = new FileDragImageSource(file_name, icon); 89 gfx::CanvasImageSource* source = new FileDragImageSource(file_name, icon);
90 gfx::Size size = source->size(); 90 gfx::Size size = source->size();
91 // ImageSkia takes ownership of |source|. 91 // ImageSkia takes ownership of |source|.
92 gfx::ImageSkia image = gfx::ImageSkia(source, size); 92 gfx::ImageSkia image = gfx::ImageSkia(source, size);
93 93
94 gfx::Vector2d cursor_offset(size.width() / 2, kLinkDragImageVPadding); 94 gfx::Vector2d cursor_offset(size.width() / 2, kLinkDragImageVPadding);
95 SetDragImageOnDataObject(image, size, cursor_offset, data_object); 95 SetDragImageOnDataObject(image, cursor_offset, data_object);
96 } 96 }
97 97
98 void SetDragImageOnDataObject(const gfx::Canvas& canvas, 98 void SetDragImageOnDataObject(const gfx::Canvas& canvas,
99 const gfx::Size& size,
100 const gfx::Vector2d& cursor_offset, 99 const gfx::Vector2d& cursor_offset,
101 ui::OSExchangeData* data_object) { 100 ui::OSExchangeData* data_object) {
102 gfx::ImageSkia image = gfx::ImageSkia(canvas.ExtractImageRep()); 101 gfx::ImageSkia image = gfx::ImageSkia(canvas.ExtractImageRep());
103 SetDragImageOnDataObject(image, size, cursor_offset, data_object); 102 SetDragImageOnDataObject(image, cursor_offset, data_object);
104 } 103 }
105 104
106 } // namespace drag_utils 105 } // namespace drag_utils
OLDNEW
« no previous file with comments | « ui/base/dragdrop/drag_utils.h ('k') | ui/base/dragdrop/drag_utils_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698