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

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

Issue 11801022: Allow dragging a download only after the download is complete. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with trunk at 175906 Created 7 years, 11 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
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 // Download utility implementation 5 // Download utility implementation
6 6
7 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. 7 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first.
8 8
9 #include "chrome/browser/download/download_util.h" 9 #include "chrome/browser/download/download_util.h"
10 10
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 int GetBigProgressIconOffset() { 341 int GetBigProgressIconOffset() {
342 return (GetBigProgressIconSize() - kBigIconSize) / 2; 342 return (GetBigProgressIconSize() - kBigIconSize) / 2;
343 } 343 }
344 344
345 #if defined(TOOLKIT_VIEWS) 345 #if defined(TOOLKIT_VIEWS)
346 // Download dragging 346 // Download dragging
347 void DragDownload(const DownloadItem* download, 347 void DragDownload(const DownloadItem* download,
348 gfx::Image* icon, 348 gfx::Image* icon,
349 gfx::NativeView view) { 349 gfx::NativeView view) {
350 DCHECK(download); 350 DCHECK(download);
351 DCHECK(download->IsComplete());
351 352
352 // Set up our OLE machinery 353 // Set up our OLE machinery
353 ui::OSExchangeData data; 354 ui::OSExchangeData data;
354 355
355 if (icon) { 356 if (icon) {
356 drag_utils::CreateDragImageForFile( 357 drag_utils::CreateDragImageForFile(
357 download->GetFileNameToReportUser(), icon->ToImageSkia(), &data); 358 download->GetFileNameToReportUser(), icon->ToImageSkia(), &data);
358 } 359 }
359 360
360 const FilePath full_path = download->GetFullPath(); 361 const FilePath full_path = download->GetTargetFilePath();
361 data.SetFilename(full_path); 362 data.SetFilename(full_path);
362 363
363 std::string mime_type = download->GetMimeType(); 364 std::string mime_type = download->GetMimeType();
364 if (mime_type.empty()) 365 if (mime_type.empty())
365 net::GetMimeTypeFromFile(full_path, &mime_type); 366 net::GetMimeTypeFromFile(full_path, &mime_type);
366 367
367 // Add URL so that we can load supported files when dragged to WebContents. 368 // Add URL so that we can load supported files when dragged to WebContents.
368 if (net::IsSupportedMimeType(mime_type)) { 369 if (net::IsSupportedMimeType(mime_type)) {
369 data.SetURL(net::FilePathToFileURL(full_path), 370 data.SetURL(net::FilePathToFileURL(full_path),
370 download->GetFileNameToReportUser().LossyDisplayName()); 371 download->GetFileNameToReportUser().LossyDisplayName());
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 UMA_HISTOGRAM_ENUMERATION( 495 UMA_HISTOGRAM_ENUMERATION(
495 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY); 496 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY);
496 } 497 }
497 498
498 void RecordDownloadSource(ChromeDownloadSource source) { 499 void RecordDownloadSource(ChromeDownloadSource source) {
499 UMA_HISTOGRAM_ENUMERATION( 500 UMA_HISTOGRAM_ENUMERATION(
500 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY); 501 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY);
501 } 502 }
502 503
503 } // namespace download_util 504 } // namespace download_util
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/drive_download_observer.cc ('k') | chrome/browser/ui/cocoa/download/download_item_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698