Chromium Code Reviews| Index: chrome/browser/ui/views/toolbar/site_chip_view.cc |
| diff --git a/chrome/browser/ui/views/toolbar/site_chip_view.cc b/chrome/browser/ui/views/toolbar/site_chip_view.cc |
| index d6511ef0f84e96921d5b5c7ac503a3a995d6ce07..a4ecb8cebae56e643f81904c50d6dbd8275791a9 100644 |
| --- a/chrome/browser/ui/views/toolbar/site_chip_view.cc |
| +++ b/chrome/browser/ui/views/toolbar/site_chip_view.cc |
| @@ -21,6 +21,7 @@ |
| #include "chrome/browser/search/search.h" |
| #include "chrome/browser/themes/theme_properties.h" |
| #include "chrome/browser/ui/browser.h" |
| +#include "chrome/browser/ui/elide_url.h" |
| #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| #include "chrome/browser/ui/toolbar/toolbar_model.h" |
| #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| @@ -366,6 +367,7 @@ void SiteChipView::Update(content::WebContents* web_contents) { |
| host_label_->SetText(host); |
| host_label_->SetTooltipText(host); |
| host_label_->SetBackgroundColor(label_background); |
| + host_label_->SetElideBehavior(views::Label::NO_ELIDE); |
| int icon = toolbar_view_->GetToolbarModel()->GetIconForSecurityLevel( |
| security_level_); |
| @@ -449,6 +451,23 @@ void SiteChipView::OnPaint(gfx::Canvas* canvas) { |
| ToolbarButton::OnPaint(canvas); |
| } |
| +int SiteChipView::ElideDomainTarget(int target_max_width) { |
| + base::string16 host = SiteLabelFromURL(url_displayed_); |
| + host_label_->SetText(host); |
| + int width = GetPreferredSize().width(); |
| + if (width <= target_max_width) |
| + return width; |
| + |
| + gfx::Size label_size = host_label_->GetPreferredSize(); |
| + int padding_width = width - label_size.width(); |
| + |
| + base::string16 elided_host = ElideHost( |
|
Peter Kasting
2014/02/05 00:42:49
What is ElideHost() a reference to?
Nit: I'd just
Greg Billock
2014/02/05 18:32:05
This is the new functionality I've placed in the t
Peter Kasting
2014/02/05 21:08:08
OK. I don't know that I'm hugely keen on it being
Greg Billock
2014/02/06 17:38:51
It shares a great deal of code with ElideUrl, as y
|
| + toolbar_view_->GetToolbarModel()->GetURL(), |
| + host_label_->font_list(), target_max_width - padding_width); |
| + host_label_->SetText(elided_host); |
| + return GetPreferredSize().width(); |
| +} |
| + |
| // TODO(gbillock): Make the LocationBarView or OmniboxView the listener for |
| // this button. |
| void SiteChipView::ButtonPressed(views::Button* sender, |