Chromium Code Reviews| Index: chrome/browser/ui/views/toolbar/toolbar_view.cc |
| diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.cc b/chrome/browser/ui/views/toolbar/toolbar_view.cc |
| index bfd33b1c02337ce3971497dd575a3fac0b81e07b..e3b1afcd93e6fb8331c94d8e380dbe40d5a5015e 100644 |
| --- a/chrome/browser/ui/views/toolbar/toolbar_view.cc |
| +++ b/chrome/browser/ui/views/toolbar/toolbar_view.cc |
| @@ -244,6 +244,8 @@ void ToolbarView::Init() { |
| location_bar_->Init(); |
| site_chip_view_->Init(); |
| + if (site_chip_view_->ShouldShow()) |
| + location_bar_->set_site_chip_view(site_chip_view_); |
| show_home_button_.Init(prefs::kShowHomeButton, |
|
Peter Kasting
2013/12/10 03:28:39
Nit: Blank line above this
Greg Billock
2013/12/10 17:37:59
Done.
|
| browser_->profile()->GetPrefs(), |
| base::Bind(&ToolbarView::OnShowHomeButtonChanged, |
| @@ -569,18 +571,16 @@ void ToolbarView::Layout() { |
| int browser_actions_width = browser_actions_->GetPreferredSize().width(); |
| - // Note: spacing from location bar to site chip is 1 pixel less than |
| - // kStandardSpacing given the edge thickness of the chip. |
| - int site_chip_width = |
| - (site_chip_view_->ShouldShow() ? |
| - site_chip_view_->GetPreferredSize().width() + |
| - kStandardSpacing : 0); |
| int app_menu_width = app_menu_->GetPreferredSize().width(); |
| int location_x = home_->x() + home_->width() + kStandardSpacing; |
| int available_width = std::max(0, width() - kRightEdgeSpacing - |
| app_menu_width - browser_actions_width - location_x); |
| // Cap site chip width at 1/2 the size available to the location bar. |
| + int site_chip_width = |
| + (site_chip_view_->ShouldShow() ? |
| + site_chip_view_->GetPreferredSize().width() + |
|
Peter Kasting
2013/12/10 03:28:39
Nit: This fits on fewer lines (and reads better):
Greg Billock
2013/12/10 17:37:59
I don't think the bug obtains -- I don't think sit
Peter Kasting
2013/12/10 19:44:31
No, but (available_width - kStandardSpacing) possi
Greg Billock
2013/12/10 20:36:23
Yeah, but I thought I'd accounted for that. Anyway
|
| + kStandardSpacing : 0); |
| site_chip_width = std::min(site_chip_width, available_width / 2); |
| available_width -= site_chip_width; |
| @@ -588,17 +588,15 @@ void ToolbarView::Layout() { |
| int location_y = (height() - location_height + 1) / 2; |
| location_bar_->SetBounds(location_x, location_y, std::max(available_width, 0), |
| location_height); |
| - |
| int browser_actions_x = location_bar_->x() + location_bar_->width(); |
| site_chip_view_->SetVisible(site_chip_view_->ShouldShow()); |
| if (site_chip_view_->ShouldShow()) { |
| site_chip_view_->SetBounds(browser_actions_x + kStandardSpacing, |
| child_y, |
| - site_chip_view_->GetPreferredSize().width(), |
| + std::max(0, site_chip_width - kStandardSpacing), |
| child_height); |
| - browser_actions_x += |
| - site_chip_view_->GetPreferredSize().width() + kStandardSpacing; |
| + browser_actions_x += site_chip_width; |
| } |
| browser_actions_->SetBounds(browser_actions_x, 0, |