| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 5 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/i18n/number_formatting.h" | 9 #include "base/i18n/number_formatting.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 home_->SetVisible(false); | 580 home_->SetVisible(false); |
| 581 home_->SetBounds(next_element_x, child_y, 0, child_height); | 581 home_->SetBounds(next_element_x, child_y, 0, child_height); |
| 582 } | 582 } |
| 583 next_element_x = home_->bounds().right() + kStandardSpacing; | 583 next_element_x = home_->bounds().right() + kStandardSpacing; |
| 584 | 584 |
| 585 int browser_actions_width = browser_actions_->GetPreferredSize().width(); | 585 int browser_actions_width = browser_actions_->GetPreferredSize().width(); |
| 586 int app_menu_width = app_menu_->GetPreferredSize().width(); | 586 int app_menu_width = app_menu_->GetPreferredSize().width(); |
| 587 int available_width = std::max(0, width() - kRightEdgeSpacing - | 587 int available_width = std::max(0, width() - kRightEdgeSpacing - |
| 588 app_menu_width - browser_actions_width - next_element_x); | 588 app_menu_width - browser_actions_width - next_element_x); |
| 589 | 589 |
| 590 // Cap site chip width at 1/2 the size available to the location bar. | |
| 591 site_chip_view_->SetVisible(site_chip_view_->ShouldShow()); | 590 site_chip_view_->SetVisible(site_chip_view_->ShouldShow()); |
| 592 int site_chip_width = site_chip_view_->GetPreferredSize().width(); | 591 int site_chip_width = site_chip_view_->ElideDomainTarget(available_width/2); |
| 593 site_chip_width = std::max(0, std::min(site_chip_width, | |
| 594 (available_width - kStandardSpacing) / 2)); | |
| 595 if (site_chip_view_->visible()) | 592 if (site_chip_view_->visible()) |
| 596 available_width -= site_chip_width + kStandardSpacing; | 593 available_width -= site_chip_width + kStandardSpacing; |
| 597 | 594 |
| 598 chrome::OriginChipPosition origin_chip_position = | 595 chrome::OriginChipPosition origin_chip_position = |
| 599 chrome::GetOriginChipPosition(); | 596 chrome::GetOriginChipPosition(); |
| 600 if (origin_chip_position == chrome::ORIGIN_CHIP_LEADING_LOCATION_BAR) { | 597 if (origin_chip_position == chrome::ORIGIN_CHIP_LEADING_LOCATION_BAR) { |
| 601 site_chip_view_->SetBounds(next_element_x, child_y, | 598 site_chip_view_->SetBounds(next_element_x, child_y, |
| 602 site_chip_width, child_height); | 599 site_chip_width, child_height); |
| 603 next_element_x = site_chip_view_->bounds().right() + kStandardSpacing; | 600 next_element_x = site_chip_view_->bounds().right() + kStandardSpacing; |
| 604 } | 601 } |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 | 828 |
| 832 void ToolbarView::OnShowHomeButtonChanged() { | 829 void ToolbarView::OnShowHomeButtonChanged() { |
| 833 Layout(); | 830 Layout(); |
| 834 SchedulePaint(); | 831 SchedulePaint(); |
| 835 } | 832 } |
| 836 | 833 |
| 837 int ToolbarView::content_shadow_height() const { | 834 int ToolbarView::content_shadow_height() const { |
| 838 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? | 835 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? |
| 839 kContentShadowHeightAsh : kContentShadowHeight; | 836 kContentShadowHeightAsh : kContentShadowHeight; |
| 840 } | 837 } |
| OLD | NEW |