Chromium Code Reviews| 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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 575 home_->SetVisible(false); | 575 home_->SetVisible(false); |
| 576 home_->SetBounds(next_element_x, child_y, 0, child_height); | 576 home_->SetBounds(next_element_x, child_y, 0, child_height); |
| 577 } | 577 } |
| 578 next_element_x = home_->bounds().right() + kStandardSpacing; | 578 next_element_x = home_->bounds().right() + kStandardSpacing; |
| 579 | 579 |
| 580 int browser_actions_width = browser_actions_->GetPreferredSize().width(); | 580 int browser_actions_width = browser_actions_->GetPreferredSize().width(); |
| 581 int app_menu_width = app_menu_->GetPreferredSize().width(); | 581 int app_menu_width = app_menu_->GetPreferredSize().width(); |
| 582 int available_width = std::max(0, width() - kRightEdgeSpacing - | 582 int available_width = std::max(0, width() - kRightEdgeSpacing - |
| 583 app_menu_width - browser_actions_width - next_element_x); | 583 app_menu_width - browser_actions_width - next_element_x); |
| 584 | 584 |
| 585 // Cap site chip width at 1/2 the size available to the location bar. | |
| 586 site_chip_view_->SetVisible(site_chip_view_->ShouldShow()); | 585 site_chip_view_->SetVisible(site_chip_view_->ShouldShow()); |
| 587 int site_chip_width = site_chip_view_->GetPreferredSize().width(); | 586 int site_chip_width = site_chip_view_->ElideDomainTarget(available_width/2); |
|
Peter Kasting
2014/02/05 00:42:49
Nit: Spaces around operators
| |
| 588 site_chip_width = std::max(0, std::min(site_chip_width, | |
| 589 (available_width - kStandardSpacing) / 2)); | |
| 590 if (site_chip_view_->visible()) | 587 if (site_chip_view_->visible()) |
| 591 available_width -= site_chip_width + kStandardSpacing; | 588 available_width -= site_chip_width + kStandardSpacing; |
| 592 | 589 |
| 593 chrome::OriginChipPosition origin_chip_position = | 590 chrome::OriginChipPosition origin_chip_position = |
| 594 chrome::GetOriginChipPosition(); | 591 chrome::GetOriginChipPosition(); |
| 595 if (origin_chip_position == chrome::ORIGIN_CHIP_LEADING_LOCATION_BAR) { | 592 if (origin_chip_position == chrome::ORIGIN_CHIP_LEADING_LOCATION_BAR) { |
| 596 site_chip_view_->SetBounds(next_element_x, child_y, | 593 site_chip_view_->SetBounds(next_element_x, child_y, |
| 597 site_chip_width, child_height); | 594 site_chip_width, child_height); |
| 598 next_element_x = site_chip_view_->bounds().right() + kStandardSpacing; | 595 next_element_x = site_chip_view_->bounds().right() + kStandardSpacing; |
| 599 } | 596 } |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 826 | 823 |
| 827 void ToolbarView::OnShowHomeButtonChanged() { | 824 void ToolbarView::OnShowHomeButtonChanged() { |
| 828 Layout(); | 825 Layout(); |
| 829 SchedulePaint(); | 826 SchedulePaint(); |
| 830 } | 827 } |
| 831 | 828 |
| 832 int ToolbarView::content_shadow_height() const { | 829 int ToolbarView::content_shadow_height() const { |
| 833 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? | 830 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? |
| 834 kContentShadowHeightAsh : kContentShadowHeight; | 831 kContentShadowHeightAsh : kContentShadowHeight; |
| 835 } | 832 } |
| OLD | NEW |