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

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

Issue 16533: Convert download manager to FilePath. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/download/download_manager_unittest.cc ('k') | chrome/browser/download/save_file.cc » ('j') | 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 7599)
+++ chrome/browser/download/download_util.cc (working copy)
@@ -47,7 +47,7 @@
case OPEN_WHEN_COMPLETE:
return download_->open_when_complete();
case ALWAYS_OPEN_TYPE: {
- const std::wstring extension =
+ const FilePath::StringType extension =
file_util::GetFileExtensionFromPath(download_->full_path());
return download_->manager()->ShouldOpenFileExtension(extension);
}
@@ -115,17 +115,17 @@
scw.WriteText(download_->url());
break;
case COPY_PATH:
- scw.WriteText(download_->full_path());
+ scw.WriteText(download_->full_path().ToWStringHack());
break;
case COPY_FILE:
// TODO(paulg): Move to OSExchangeData when implementing drag and drop?
- scw.WriteFile(download_->full_path());
+ scw.WriteFile(download_->full_path().ToWStringHack());
break;
case OPEN_WHEN_COMPLETE:
OpenDownload(download_);
break;
case ALWAYS_OPEN_TYPE: {
- const std::wstring extension =
+ const FilePath::StringType extension =
file_util::GetFileExtensionFromPath(download_->full_path());
download_->manager()->OpenFilesOfExtension(
extension, !IsItemChecked(ALWAYS_OPEN_TYPE));
@@ -221,11 +221,11 @@
// Download opening ------------------------------------------------------------
bool CanOpenDownload(DownloadItem* download) {
- std::wstring file_to_use = download->full_path();
- if (!download->original_name().empty())
+ FilePath file_to_use = download->full_path();
+ if (!download->original_name().value().empty())
file_to_use = download->original_name();
- const std::wstring extension =
+ const FilePath::StringType extension =
file_util::GetFileExtensionFromPath(file_to_use);
return !download->manager()->IsExecutable(extension);
}
@@ -416,8 +416,9 @@
// Set up our OLE machinery
scoped_refptr<OSExchangeData> data(new OSExchangeData);
if (icon)
- drag_utils::CreateDragImageForFile(download->file_name(), icon, data);
- data->SetFilename(download->full_path());
+ drag_utils::CreateDragImageForFile(download->file_name().ToWStringHack(),
+ icon, data);
+ data->SetFilename(download->full_path().ToWStringHack());
scoped_refptr<BaseDragSource> drag_source(new BaseDragSource);
// Run the drag and drop loop
@@ -426,6 +427,4 @@
&effects);
}
-
} // namespace download_util
-
« no previous file with comments | « chrome/browser/download/download_manager_unittest.cc ('k') | chrome/browser/download/save_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698