| 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..e7e5986f4de647b58553deb739a6f538bc35e51b 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,22 @@ 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();
|
| +
|
| + host_label_->SetText(ElideHost(
|
| + toolbar_view_->GetToolbarModel()->GetURL(),
|
| + host_label_->font_list(), target_max_width - padding_width));
|
| + return GetPreferredSize().width();
|
| +}
|
| +
|
| // TODO(gbillock): Make the LocationBarView or OmniboxView the listener for
|
| // this button.
|
| void SiteChipView::ButtonPressed(views::Button* sender,
|
|
|