diff options
Diffstat (limited to 'chrome/browser/cocoa')
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); |