Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6523)

Unified Diff: chrome/browser/ui/views/toolbar/site_chip_view.cc

Issue 141333004: [SiteChip] Remove 50% width cap for site chip (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/toolbar/site_chip_view.h ('k') | chrome/browser/ui/views/toolbar/toolbar_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « chrome/browser/ui/views/toolbar/site_chip_view.h ('k') | chrome/browser/ui/views/toolbar/toolbar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698