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

Unified Diff: chrome/browser/download/download_util.cc

Issue 164119: Items in the Downloads page should be loaded like a normal OS file when dragg... (Closed) Base URL: http://src.chromium.org/svn/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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_util.cc
===================================================================
--- chrome/browser/download/download_util.cc (revision 22601)
+++ chrome/browser/download/download_util.cc (working copy)
@@ -19,6 +19,7 @@
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "grit/theme_resources.h"
+#include "net/base/mime_util.h"
#include "skia/ext/image_operations.h"
#include "third_party/skia/include/core/SkPath.h"
#include "third_party/skia/include/core/SkShader.h"
@@ -242,10 +243,22 @@
// Set up our OLE machinery
scoped_refptr<OSExchangeData> data(new OSExchangeData);
+
+ const FilePath::StringType file_name = download->file_name().value();
if (icon)
- drag_utils::CreateDragImageForFile(download->file_name().ToWStringHack(),
- icon, data);
- data->SetFilename(download->full_path().ToWStringHack());
+ drag_utils::CreateDragImageForFile(file_name, icon, data);
+
+ const FilePath full_path = download->full_path();
+ data->SetFilename(full_path.value());
+
+ std::string mime_type = download->mime_type();
+ if (mime_type.empty())
+ net::GetMimeTypeFromFile(full_path, &mime_type);
+
+ // Add URL so that we can load supported files when dragged to TabContents.
+ if (net::IsSupportedMimeType(mime_type))
+ data->SetURL(GURL(full_path.value()), file_name);
+
scoped_refptr<BaseDragSource> drag_source(new BaseDragSource);
// Run the drag and drop loop
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698