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

Side by Side Diff: chrome/browser/download/download_util.cc

Issue 164459: Implement drag and drop of downloads for the Mac downloads page (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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 | « chrome/browser/download/download_util.h ('k') | chrome/browser/views/download_item_view.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // Download utility implementation 5 // Download utility implementation
6 6
7 #include "chrome/browser/download/download_util.h" 7 #include "chrome/browser/download/download_util.h"
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 canvas->DrawBitmapInt(*complete, complete_bounds.x(), complete_bounds.y()); 213 canvas->DrawBitmapInt(*complete, complete_bounds.x(), complete_bounds.y());
214 canvas->restore(); 214 canvas->restore();
215 } 215 }
216 216
217 // Load a language dependent height so that the dangerous download confirmation 217 // Load a language dependent height so that the dangerous download confirmation
218 // message doesn't overlap with the download link label. 218 // message doesn't overlap with the download link label.
219 int GetBigProgressIconSize() { 219 int GetBigProgressIconSize() {
220 static int big_progress_icon_size = 0; 220 static int big_progress_icon_size = 0;
221 if (big_progress_icon_size == 0) { 221 if (big_progress_icon_size == 0) {
222 string16 locale_size_str = 222 string16 locale_size_str =
223 WideToUTF16Hack( 223 WideToUTF16Hack(l10n_util::GetString(IDS_DOWNLOAD_BIG_PROGRESS_SIZE));
224 l10n_util::GetString(IDS_DOWNLOAD_BIG_PROGRESS_SIZE));
225 bool rc = StringToInt(locale_size_str, &big_progress_icon_size); 224 bool rc = StringToInt(locale_size_str, &big_progress_icon_size);
226 if (!rc || big_progress_icon_size < kBigProgressIconSize) { 225 if (!rc || big_progress_icon_size < kBigProgressIconSize) {
227 NOTREACHED(); 226 NOTREACHED();
228 big_progress_icon_size = kBigProgressIconSize; 227 big_progress_icon_size = kBigProgressIconSize;
229 } 228 }
230 } 229 }
231 230
232 return big_progress_icon_size; 231 return big_progress_icon_size;
233 } 232 }
234 233
235 int GetBigProgressIconOffset() { 234 int GetBigProgressIconOffset() {
236 return (GetBigProgressIconSize() - kBigIconSize) / 2; 235 return (GetBigProgressIconSize() - kBigIconSize) / 2;
237 } 236 }
238 237
239 #if defined(OS_WIN) || defined(TOOLKIT_VIEWS) 238 #if defined(OS_WIN) || defined(TOOLKIT_VIEWS)
240 // Download dragging 239 // Download dragging
241 void DragDownload(const DownloadItem* download, SkBitmap* icon) { 240 void DragDownload(const DownloadItem* download,
241 SkBitmap* icon,
242 gfx::NativeView view) {
242 #if defined(OS_WIN) 243 #if defined(OS_WIN)
243 DCHECK(download); 244 DCHECK(download);
244 245
245 // Set up our OLE machinery 246 // Set up our OLE machinery
246 OSExchangeData data; 247 OSExchangeData data;
247 248
248 const FilePath::StringType file_name = download->file_name().value(); 249 const FilePath::StringType file_name = download->file_name().value();
249 if (icon) 250 if (icon)
250 drag_utils::CreateDragImageForFile(file_name, icon, &data); 251 drag_utils::CreateDragImageForFile(file_name, icon, &data);
251 data.SetFilename(download->full_path().ToWStringHack()); 252 data.SetFilename(download->full_path().ToWStringHack());
(...skipping 10 matching lines...) Expand all
262 data.SetURL(GURL(full_path.value()), file_name); 263 data.SetURL(GURL(full_path.value()), file_name);
263 264
264 scoped_refptr<BaseDragSource> drag_source(new BaseDragSource); 265 scoped_refptr<BaseDragSource> drag_source(new BaseDragSource);
265 266
266 // Run the drag and drop loop 267 // Run the drag and drop loop
267 DWORD effects; 268 DWORD effects;
268 DoDragDrop(OSExchangeDataProviderWin::GetIDataObject(data), drag_source.get(), 269 DoDragDrop(OSExchangeDataProviderWin::GetIDataObject(data), drag_source.get(),
269 DROPEFFECT_COPY | DROPEFFECT_LINK, &effects); 270 DROPEFFECT_COPY | DROPEFFECT_LINK, &effects);
270 #else 271 #else
271 NOTIMPLEMENTED(); 272 NOTIMPLEMENTED();
272 #endif 273 #endif // OS_WIN
273 } 274 }
274 #endif 275 #endif
275 276
276 } // namespace download_util 277 } // namespace download_util
OLDNEW
« no previous file with comments | « chrome/browser/download/download_util.h ('k') | chrome/browser/views/download_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698