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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/i18n/number_formatting.h" | 10 #include "base/i18n/number_formatting.h" |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 return GetWidget()->ShouldWindowContentsBeTransparent() ? | 732 return GetWidget()->ShouldWindowContentsBeTransparent() ? |
733 0 : kPopupTopSpacingNonGlass; | 733 0 : kPopupTopSpacingNonGlass; |
734 } | 734 } |
735 | 735 |
736 gfx::Size ToolbarView::SizeForContentSize(gfx::Size size) const { | 736 gfx::Size ToolbarView::SizeForContentSize(gfx::Size size) const { |
737 if (is_display_mode_normal()) { | 737 if (is_display_mode_normal()) { |
738 gfx::ImageSkia* normal_background = | 738 gfx::ImageSkia* normal_background = |
739 GetThemeProvider()->GetImageSkiaNamed(IDR_CONTENT_TOP_CENTER); | 739 GetThemeProvider()->GetImageSkiaNamed(IDR_CONTENT_TOP_CENTER); |
740 size.SetToMax( | 740 size.SetToMax( |
741 gfx::Size(0, normal_background->height() - content_shadow_height())); | 741 gfx::Size(0, normal_background->height() - content_shadow_height())); |
| 742 } else if (size.height() == 0) { |
| 743 // Location mode with a 0 height location bar. If on ash, expand by one |
| 744 // pixel to show a border in the title bar, otherwise leave the size as zero |
| 745 // height. |
| 746 const int kAshBorderSpacing = 1; |
| 747 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) |
| 748 size.Enlarge(0, kAshBorderSpacing); |
742 } else { | 749 } else { |
743 const int kPopupBottomSpacingGlass = 1; | 750 const int kPopupBottomSpacingGlass = 1; |
744 const int kPopupBottomSpacingNonGlass = 2; | 751 const int kPopupBottomSpacingNonGlass = 2; |
745 size.Enlarge( | 752 size.Enlarge( |
746 0, | 753 0, |
747 PopupTopSpacing() + (GetWidget()->ShouldWindowContentsBeTransparent() ? | 754 PopupTopSpacing() + (GetWidget()->ShouldWindowContentsBeTransparent() ? |
748 kPopupBottomSpacingGlass : kPopupBottomSpacingNonGlass)); | 755 kPopupBottomSpacingGlass : kPopupBottomSpacingNonGlass)); |
749 } | 756 } |
750 return size; | 757 return size; |
751 } | 758 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 | 793 |
787 void ToolbarView::OnShowHomeButtonChanged() { | 794 void ToolbarView::OnShowHomeButtonChanged() { |
788 Layout(); | 795 Layout(); |
789 SchedulePaint(); | 796 SchedulePaint(); |
790 } | 797 } |
791 | 798 |
792 int ToolbarView::content_shadow_height() const { | 799 int ToolbarView::content_shadow_height() const { |
793 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? | 800 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? |
794 kContentShadowHeightAsh : kContentShadowHeight; | 801 kContentShadowHeightAsh : kContentShadowHeight; |
795 } | 802 } |
OLD | NEW |