summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
authorkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-08 20:49:18 +0000
committerkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-08 20:49:18 +0000
commit44b94b8f2d7a1b9a4990f0ad5c0805397215813a (patch)
treefb8201abcab9f56750cc08aeac2412c7ebb08fcd /chrome/browser/cocoa
parent2c93f6f808ee1987c863ea1fbe74a21cde9e6911 (diff)
downloadchromium_src-44b94b8f2d7a1b9a4990f0ad5c0805397215813a.zip
chromium_src-44b94b8f2d7a1b9a4990f0ad5c0805397215813a.tar.gz
chromium_src-44b94b8f2d7a1b9a4990f0ad5c0805397215813a.tar.bz2
Use .crdownload file path for 'Show In Folder' while download is in progress
BUG=57037 TEST=download a huge file and click 'Show In Folder' during the download Review URL: http://codereview.chromium.org/4460002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65418 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/download/download_item_cell.mm2
-rw-r--r--chrome/browser/cocoa/download/download_item_controller.mm15
-rw-r--r--chrome/browser/cocoa/download/download_item_mac.h2
-rw-r--r--chrome/browser/cocoa/download/download_item_mac.mm8
4 files changed, 13 insertions, 14 deletions
diff --git a/chrome/browser/cocoa/download/download_item_cell.mm b/chrome/browser/cocoa/download/download_item_cell.mm
index c286669..2f5d856 100644
--- a/chrome/browser/cocoa/download/download_item_cell.mm
+++ b/chrome/browser/cocoa/download/download_item_cell.mm
@@ -235,7 +235,7 @@ NSGradient* BackgroundTheme::GetNSGradient(int id) const {
- (void)setStateFromDownload:(BaseDownloadItemModel*)downloadModel {
// Set the name of the download.
- downloadPath_ = downloadModel->download()->GetFileName();
+ downloadPath_ = downloadModel->download()->GetFileNameToReportUser();
std::wstring statusText = downloadModel->GetStatusText();
if (statusText.empty()) {
diff --git a/chrome/browser/cocoa/download/download_item_controller.mm b/chrome/browser/cocoa/download/download_item_controller.mm
index d061e93..c210a3b 100644
--- a/chrome/browser/cocoa/download/download_item_controller.mm
+++ b/chrome/browser/cocoa/download/download_item_controller.mm
@@ -181,8 +181,8 @@ class DownloadShelfContextMenuMac : public DownloadShelfContextMenu {
// This basic fixup copies Windows DownloadItemView::DownloadItemView().
// Extract the file extension (if any).
- FilePath filepath(downloadModel->download()->original_name());
- FilePath::StringType extension = filepath.Extension();
+ FilePath filename(downloadModel->download()->target_name());
+ FilePath::StringType extension = filename.Extension();
// Remove leading '.' from the extension
if (extension.length() > 0)
@@ -197,15 +197,14 @@ class DownloadShelfContextMenuMac : public DownloadShelfContextMenu {
}
// Rebuild the filename.extension.
- std::wstring rootname =
- UTF8ToWide(filepath.BaseName().RemoveExtension().value());
+ std::wstring rootname = UTF8ToWide(filename.RemoveExtension().value());
ElideString(rootname, kFileNameMaxLength - extension.length(), &rootname);
- std::string filename = WideToUTF8(rootname);
+ std::string new_filename = WideToUTF8(rootname);
if (extension.length())
- filename += std::string(".") + extension;
+ new_filename += std::string(".") + extension;
dangerousWarning = l10n_util::GetNSStringFWithFixup(
- IDS_PROMPT_DANGEROUS_DOWNLOAD, UTF8ToUTF16(filename));
+ IDS_PROMPT_DANGEROUS_DOWNLOAD, UTF8ToUTF16(new_filename));
confirmButtonTitle = l10n_util::GetNSStringWithFixup(IDS_SAVE_DOWNLOAD);
}
[dangerousDownloadLabel_ setStringValue:dangerousWarning];
@@ -268,7 +267,7 @@ class DownloadShelfContextMenuMac : public DownloadShelfContextMenu {
- (void)updateToolTip {
string16 elidedFilename = gfx::ElideFilename(
- [self download]->GetFileName(),
+ [self download]->GetFileNameToReportUser(),
gfx::Font(), kToolTipMaxWidth);
[progressView_ setToolTip:base::SysUTF16ToNSString(elidedFilename)];
}
diff --git a/chrome/browser/cocoa/download/download_item_mac.h b/chrome/browser/cocoa/download/download_item_mac.h
index d5f013e..1a27549 100644
--- a/chrome/browser/cocoa/download/download_item_mac.h
+++ b/chrome/browser/cocoa/download/download_item_mac.h
@@ -55,7 +55,7 @@ class DownloadItemMac : DownloadItem::Observer {
CancelableRequestConsumerT<int, 0> icon_consumer_;
// Stores the last known name where the file will be saved.
- FilePath lastFilePath_;
+ FilePath lastFileName_;
DISALLOW_COPY_AND_ASSIGN(DownloadItemMac);
};
diff --git a/chrome/browser/cocoa/download/download_item_mac.mm b/chrome/browser/cocoa/download/download_item_mac.mm
index b647655..0f8c5b7 100644
--- a/chrome/browser/cocoa/download/download_item_mac.mm
+++ b/chrome/browser/cocoa/download/download_item_mac.mm
@@ -34,12 +34,12 @@ void DownloadItemMac::OnDownloadUpdated(DownloadItem* download) {
[item_controller_ clearDangerousMode];
}
- if (download->full_path() != lastFilePath_) {
- // Turns out the file path is "unconfirmed %d.download" for dangerous
+ if (download->GetUserVerifiedFileName() != lastFileName_) {
+ // Turns out the file path is "unconfirmed %d.crdownload" for dangerous
// downloads. When the download is confirmed, the file is renamed on
// another thread, so reload the icon if the download filename changes.
LoadIcon();
- lastFilePath_ = download->full_path();
+ lastFileName_ = download->GetUserVerifiedFileName();
[item_controller_ updateToolTip];
}
@@ -72,7 +72,7 @@ void DownloadItemMac::LoadIcon() {
}
// We may already have this particular image cached.
- FilePath file = download_model_->download()->full_path();
+ FilePath file = download_model_->download()->GetUserVerifiedFileName();
SkBitmap* icon_bitmap = icon_manager->LookupIcon(file, IconLoader::SMALL);
if (icon_bitmap) {
NSImage* icon = gfx::SkBitmapToNSImage(*icon_bitmap);