diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-24 02:59:14 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-24 02:59:14 +0000 |
commit | c4eaca55f090aa2d3b5b61b604f456b7dbcfd99e (patch) | |
tree | 6ed8985fe2c88d2892d5e3088212736072085cf0 /chrome/browser/views/download_item_view.cc | |
parent | 40ecd8a10372b6be9a2cb830dd1fe004b51ca2ec (diff) | |
download | chromium_src-c4eaca55f090aa2d3b5b61b604f456b7dbcfd99e.zip chromium_src-c4eaca55f090aa2d3b5b61b604f456b7dbcfd99e.tar.gz chromium_src-c4eaca55f090aa2d3b5b61b604f456b7dbcfd99e.tar.bz2 |
Remove deprecated file_util::GetFilenameWithoutExtensionFromPath(), also convert ElideFilename() to take a FilePath.
Review URL: http://codereview.chromium.org/92060
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14409 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/download_item_view.cc')
-rw-r--r-- | chrome/browser/views/download_item_view.cc | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc index fb2c1a7..ffef0a6 100644 --- a/chrome/browser/views/download_item_view.cc +++ b/chrome/browser/views/download_item_view.cc @@ -6,7 +6,7 @@ #include <vector> -#include "base/file_util.h" +#include "base/file_path.h" #include "base/string_util.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/download/download_item_model.h" @@ -266,14 +266,17 @@ DownloadItemView::DownloadItemView(DownloadItem* download, discard_button_->set_ignore_minimum_size(true); AddChildView(save_button_); AddChildView(discard_button_); - std::wstring file_name = download->original_name().ToWStringHack(); // Ensure the file name is not too long. // Extract the file extension (if any). - std::wstring extension = file_util::GetFileExtensionFromPath(file_name); - std::wstring rootname = - file_util::GetFilenameWithoutExtensionFromPath(file_name); + FilePath filepath(download->original_name()); + std::wstring extension = filepath.Extension(); + + // Remove leading '.' + if (extension.length() > 0) + extension = extension.substr(1); + std::wstring rootname = filepath.BaseName().RemoveExtension().value(); // Elide giant extensions (this shouldn't currently be hit, but might // in future, should we ever notice unsafe giant extensions). @@ -532,13 +535,12 @@ void DownloadItemView::Paint(ChromeCanvas* canvas) { if (!IsDangerousMode()) { std::wstring filename; if (!disabled_while_opening_) { - filename = gfx::ElideFilename(download_->GetFileName().ToWStringHack(), + filename = gfx::ElideFilename(download_->GetFileName(), font_, kTextWidth); } else { - filename = - l10n_util::GetStringF(IDS_DOWNLOAD_STATUS_OPENING, - download_->GetFileName().ToWStringHack()); - filename = gfx::ElideFilename(filename, font_, kTextWidth); + FilePath filepath(l10n_util::GetStringF(IDS_DOWNLOAD_STATUS_OPENING, + download_->GetFileName().ToWStringHack())); + filename = gfx::ElideFilename(filepath, font_, kTextWidth); } if (show_status_text_) { |