diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete.cc | 2 | ||||
-rw-r--r-- | chrome/browser/autocomplete/history_url_provider.cc | 2 | ||||
-rw-r--r-- | chrome/browser/jsmessage_box_handler.cc | 2 | ||||
-rw-r--r-- | chrome/browser/printing/page_overlays.cc | 2 | ||||
-rw-r--r-- | chrome/browser/printing/printed_document.cc | 2 | ||||
-rw-r--r-- | chrome/browser/toolbar_model.cc | 2 | ||||
-rw-r--r-- | chrome/browser/url_fixer_upper.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/bookmark_bar_view.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/constrained_window_impl.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/download_item_view.cc | 51 | ||||
-rw-r--r-- | chrome/browser/views/download_tab_view.cc | 20 | ||||
-rw-r--r-- | chrome/browser/views/password_manager_view.h | 2 | ||||
-rw-r--r-- | chrome/browser/views/shelf_item_dialog.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/status_bubble.cc | 2 |
14 files changed, 38 insertions, 57 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc index 603b0a9..4a49481 100644 --- a/chrome/browser/autocomplete/autocomplete.cc +++ b/chrome/browser/autocomplete/autocomplete.cc @@ -16,7 +16,7 @@ #include "chrome/browser/history_tab_ui.h" #include "chrome/browser/profile.h" #include "chrome/browser/url_fixer_upper.h" -#include "chrome/common/gfx/url_elider.h" +#include "chrome/common/gfx/text_elider.h" #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" diff --git a/chrome/browser/autocomplete/history_url_provider.cc b/chrome/browser/autocomplete/history_url_provider.cc index cdbc82d..01293db 100644 --- a/chrome/browser/autocomplete/history_url_provider.cc +++ b/chrome/browser/autocomplete/history_url_provider.cc @@ -14,7 +14,7 @@ #include "chrome/browser/history/history_database.h" #include "chrome/browser/profile.h" #include "chrome/browser/url_fixer_upper.h" -#include "chrome/common/gfx/url_elider.h" +#include "chrome/common/gfx/text_elider.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "chrome/common/sqlite_utils.h" diff --git a/chrome/browser/jsmessage_box_handler.cc b/chrome/browser/jsmessage_box_handler.cc index df740cc..e161d14 100644 --- a/chrome/browser/jsmessage_box_handler.cc +++ b/chrome/browser/jsmessage_box_handler.cc @@ -7,7 +7,7 @@ #include "chrome/browser/app_modal_dialog_queue.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/web_contents.h" -#include "chrome/common/gfx/url_elider.h" +#include "chrome/common/gfx/text_elider.h" #include "chrome/common/l10n_util.h" #include "chrome/common/notification_service.h" #include "chrome/common/notification_types.h" diff --git a/chrome/browser/printing/page_overlays.cc b/chrome/browser/printing/page_overlays.cc index a02ed24..714f194 100644 --- a/chrome/browser/printing/page_overlays.cc +++ b/chrome/browser/printing/page_overlays.cc @@ -8,7 +8,7 @@ #include "base/string_util.h" #include "chrome/browser/printing/printed_document.h" #include "chrome/browser/printing/printed_page.h" -#include "chrome/common/gfx/url_elider.h" +#include "chrome/common/gfx/text_elider.h" namespace { diff --git a/chrome/browser/printing/printed_document.cc b/chrome/browser/printing/printed_document.cc index 466ff00..b5eecb3 100644 --- a/chrome/browser/printing/printed_document.cc +++ b/chrome/browser/printing/printed_document.cc @@ -16,7 +16,7 @@ #include "chrome/browser/printing/units.h" #include "chrome/common/gfx/chrome_font.h" #include "chrome/common/gfx/emf.h" -#include "chrome/common/gfx/url_elider.h" +#include "chrome/common/gfx/text_elider.h" #include "chrome/common/time_format.h" #include "chrome/common/notification_service.h" #include "chrome/common/win_util.h" diff --git a/chrome/browser/toolbar_model.cc b/chrome/browser/toolbar_model.cc index 9f83ed2..e2cf9a5 100644 --- a/chrome/browser/toolbar_model.cc +++ b/chrome/browser/toolbar_model.cc @@ -9,7 +9,7 @@ #include "chrome/browser/navigation_entry.h" #include "chrome/browser/ssl_error_info.h" #include "chrome/browser/tab_contents.h" -#include "chrome/common/gfx/url_elider.h" +#include "chrome/common/gfx/text_elider.h" #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" diff --git a/chrome/browser/url_fixer_upper.cc b/chrome/browser/url_fixer_upper.cc index b903186..a62694d 100644 --- a/chrome/browser/url_fixer_upper.cc +++ b/chrome/browser/url_fixer_upper.cc @@ -10,7 +10,7 @@ #include "base/file_util.h" #include "base/logging.h" #include "base/string_util.h" -#include "chrome/common/gfx/url_elider.h" +#include "chrome/common/gfx/text_elider.h" #include "googleurl/src/gurl.h" #include "googleurl/src/url_canon.h" #include "googleurl/src/url_file.h" diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index 3e514ba..66d1ccd 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -30,7 +30,7 @@ #include "chrome/browser/views/input_window.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/favicon_size.h" -#include "chrome/common/gfx/url_elider.h" +#include "chrome/common/gfx/text_elider.h" #include "chrome/common/l10n_util.h" #include "chrome/common/notification_service.h" #include "chrome/common/notification_types.h" diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc index a1da56c..d504585 100644 --- a/chrome/browser/views/constrained_window_impl.cc +++ b/chrome/browser/views/constrained_window_impl.cc @@ -19,7 +19,7 @@ #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/chrome_font.h" #include "chrome/common/gfx/path.h" -#include "chrome/common/gfx/url_elider.h" +#include "chrome/common/gfx/text_elider.h" #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc index 01efbd6..60a13f5 100644 --- a/chrome/browser/views/download_item_view.cc +++ b/chrome/browser/views/download_item_view.cc @@ -13,6 +13,7 @@ #include "chrome/browser/download/download_util.h" #include "chrome/browser/views/download_shelf_view.h" #include "chrome/common/gfx/chrome_canvas.h" +#include "chrome/common/gfx/text_elider.h" #include "chrome/common/l10n_util.h" #include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" @@ -455,47 +456,19 @@ void DownloadItemView::Paint(ChromeCanvas* canvas) { // Last value of x was the end of the right image, just before the button. // Note that in dangerous mode we use a label (as the text is multi-line). if (!IsDangerousMode()) { - // Because just drawing the filename using DrawStringInt results in - // Windows eliding the text and potentially chopping off the file - // extension, we need to draw the file's name and extension separately. - - // Extract the file extension (if any). - std::wstring extension = L"." + - file_util::GetFileExtensionFromPath(download_->GetFileName()); - std::wstring rootname = file_util::GetFilenameWithoutExtensionFromPath( - download_->GetFileName()); - - // Figure out the width of the extension. - int ext_width = 0; - int file_width = 0; - int h = 0; - canvas->SizeStringInt(extension, font_, &ext_width, &h, - ChromeCanvas::NO_ELLIPSIS); - canvas->SizeStringInt(rootname, font_, &file_width, &h, - ChromeCanvas::NO_ELLIPSIS); - - // If the extension is ridiculously long, truncate it. - if (ext_width > kTextWidth / 2) - ext_width = kTextWidth / 2; - - // Expand the extension width to fill any spare space so that - // it is aligned to the right edge of the file. - if (file_width < kTextWidth - ext_width) - ext_width = kTextWidth - file_width; + std::wstring filename = + gfx::ElideFilename(download_->GetFileName(), + font_, + kTextWidth); if (show_status_text_) { int y = box_y_ + kVerticalPadding; // Draw the file's name. - canvas->DrawStringInt(rootname, font_, kFileNameColor, + canvas->DrawStringInt(filename, font_, kFileNameColor, download_util::kSmallProgressIconSize, y, - kTextWidth - ext_width, font_.height()); + kTextWidth, font_.height()); - // Draw the file's extension. - canvas->DrawStringInt(extension, font_, kFileNameColor, - download_util::kSmallProgressIconSize + - kTextWidth - ext_width, y, - ext_width, font_.height()); y += font_.height() + kVerticalTextPadding; canvas->DrawStringInt(status_text_, font_, kStatusColor, @@ -505,15 +478,9 @@ void DownloadItemView::Paint(ChromeCanvas* canvas) { int y = box_y_ + (box_height_ - font_.height()) / 2; // Draw the file's name. - canvas->DrawStringInt(rootname, font_, kFileNameColor, + canvas->DrawStringInt(filename, font_, kFileNameColor, download_util::kSmallProgressIconSize, y, - kTextWidth - ext_width, font_.height()); - - // Draw the file's extension. - canvas->DrawStringInt(extension, font_, kFileNameColor, - download_util::kSmallProgressIconSize + - kTextWidth - ext_width, y, - ext_width, font_.height()); + kTextWidth, font_.height()); } } diff --git a/chrome/browser/views/download_tab_view.cc b/chrome/browser/views/download_tab_view.cc index 1098aa2..6736ff6 100644 --- a/chrome/browser/views/download_tab_view.cc +++ b/chrome/browser/views/download_tab_view.cc @@ -20,6 +20,7 @@ #include "chrome/browser/user_metrics.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/chrome_font.h" +#include "chrome/common/gfx/text_elider.h" #include "chrome/common/l10n_util.h" #include "chrome/common/resource_bundle.h" #include "chrome/common/stl_util-inl.h" @@ -281,8 +282,13 @@ void DownloadItemTabView::LayoutComplete() { parent_->big_icon_size() + kInfoPadding; // File name and URL - file_name_->SetText(model_->GetFileName()); + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ChromeFont font = rb.GetFont(ResourceBundle::WebFont); + file_name_->SetText( + gfx::ElideFilename(model_->GetFileName(), font, kFilenameSize)); + gfx::Size file_name_size = file_name_->GetPreferredSize(); + file_name_->SetBounds(dx, parent_->big_icon_offset(), std::min(kFilenameSize, static_cast<int>(file_name_size.width())), @@ -331,7 +337,11 @@ void DownloadItemTabView::LayoutCancelled() { parent_->big_icon_size() + kInfoPadding; // File name and URL, truncated to show cancelled status - file_name_->SetText(model_->GetFileName()); + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ChromeFont font = rb.GetFont(ResourceBundle::WebFont); + file_name_->SetText(gfx::ElideFilename(model_->GetFileName(), + font, + kFilenameSize)); gfx::Size file_name_size = file_name_->GetPreferredSize(); file_name_->SetBounds(dx, parent_->big_icon_offset(), kFilenameSize - kProgressSize - kSpacer, @@ -418,7 +428,11 @@ void DownloadItemTabView::LayoutInProgress() { parent_->big_icon_size() + kInfoPadding; // File name and URL, truncated to show progress status - file_name_->SetText(model_->GetFileName()); + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ChromeFont font = rb.GetFont(ResourceBundle::WebFont); + file_name_->SetText(gfx::ElideFilename(model_->GetFileName(), + font, + kFilenameSize)); gfx::Size file_name_size = file_name_->GetPreferredSize(); file_name_->SetBounds(dx, parent_->big_icon_offset(), kFilenameSize - kProgressSize - kSpacer, diff --git a/chrome/browser/views/password_manager_view.h b/chrome/browser/views/password_manager_view.h index 8f84aa1..1a02914 100644 --- a/chrome/browser/views/password_manager_view.h +++ b/chrome/browser/views/password_manager_view.h @@ -10,7 +10,7 @@ #include "base/scoped_ptr.h" #include "chrome/browser/webdata/web_data_service.h" #include "chrome/common/stl_util-inl.h" -#include "chrome/common/gfx/url_elider.h" +#include "chrome/common/gfx/text_elider.h" #include "chrome/views/dialog_delegate.h" #include "chrome/views/label.h" #include "chrome/views/native_button.h" diff --git a/chrome/browser/views/shelf_item_dialog.cc b/chrome/browser/views/shelf_item_dialog.cc index 5ea98a3..f32ce79 100644 --- a/chrome/browser/views/shelf_item_dialog.cc +++ b/chrome/browser/views/shelf_item_dialog.cc @@ -12,7 +12,7 @@ #include "chrome/browser/tab_contents.h" #include "chrome/browser/url_fixer_upper.h" #include "chrome/browser/views/standard_layout.h" -#include "chrome/common/gfx/url_elider.h" +#include "chrome/common/gfx/text_elider.h" #include "chrome/common/l10n_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" diff --git a/chrome/browser/views/status_bubble.cc b/chrome/browser/views/status_bubble.cc index 31c675f..526e9b3 100644 --- a/chrome/browser/views/status_bubble.cc +++ b/chrome/browser/views/status_bubble.cc @@ -11,7 +11,7 @@ #include "chrome/app/theme/theme_resources.h" #include "chrome/common/animation.h" #include "chrome/common/gfx/chrome_canvas.h" -#include "chrome/common/gfx/url_elider.h" +#include "chrome/common/gfx/text_elider.h" #include "chrome/common/l10n_util.h" #include "chrome/common/resource_bundle.h" #include "chrome/views/label.h" |