| 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 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 #if defined(OS_WIN) | 681 #if defined(OS_WIN) |
| 682 ConflictingModuleView::MaybeShow(browser_, app_menu_button_); | 682 ConflictingModuleView::MaybeShow(browser_, app_menu_button_); |
| 683 #endif | 683 #endif |
| 684 } | 684 } |
| 685 incompatibility_badge_showing = true; | 685 incompatibility_badge_showing = true; |
| 686 return; | 686 return; |
| 687 } | 687 } |
| 688 } | 688 } |
| 689 | 689 |
| 690 int ToolbarView::PopupTopSpacing() const { | 690 int ToolbarView::PopupTopSpacing() const { |
| 691 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) |
| 692 return 0; |
| 693 |
| 691 const int kAdditionalPopupTopSpacingNonGlass = 2; | 694 const int kAdditionalPopupTopSpacingNonGlass = 2; |
| 692 return views::NonClientFrameView::kClientEdgeThickness + | 695 return views::NonClientFrameView::kClientEdgeThickness + |
| 693 (GetWidget()->ShouldWindowContentsBeTransparent() ? | 696 (GetWidget()->ShouldWindowContentsBeTransparent() ? |
| 694 0 : kAdditionalPopupTopSpacingNonGlass); | 697 0 : kAdditionalPopupTopSpacingNonGlass); |
| 695 } | 698 } |
| 696 | 699 |
| 697 gfx::Size ToolbarView::GetSizeInternal( | 700 gfx::Size ToolbarView::GetSizeInternal( |
| 698 gfx::Size (View::*get_size)() const) const { | 701 gfx::Size (View::*get_size)() const) const { |
| 699 gfx::Size size((location_bar_->*get_size)()); | 702 gfx::Size size((location_bar_->*get_size)()); |
| 700 if (is_display_mode_normal()) { | 703 if (is_display_mode_normal()) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 728 int content_height = std::max(back_->GetPreferredSize().height(), | 731 int content_height = std::max(back_->GetPreferredSize().height(), |
| 729 location_bar_->GetPreferredSize().height()); | 732 location_bar_->GetPreferredSize().height()); |
| 730 int padding = GetLayoutInsets(TOOLBAR).height(); | 733 int padding = GetLayoutInsets(TOOLBAR).height(); |
| 731 size.SetToMax(gfx::Size(0, content_height + padding)); | 734 size.SetToMax(gfx::Size(0, content_height + padding)); |
| 732 } else { | 735 } else { |
| 733 gfx::ImageSkia* normal_background = | 736 gfx::ImageSkia* normal_background = |
| 734 GetThemeProvider()->GetImageSkiaNamed(IDR_CONTENT_TOP_CENTER); | 737 GetThemeProvider()->GetImageSkiaNamed(IDR_CONTENT_TOP_CENTER); |
| 735 size.SetToMax( | 738 size.SetToMax( |
| 736 gfx::Size(0, normal_background->height() - content_shadow_height())); | 739 gfx::Size(0, normal_background->height() - content_shadow_height())); |
| 737 } | 740 } |
| 738 } else if (size.height() == 0) { | 741 } else if (size.height() > 0) { |
| 739 // Location mode with a 0 height location bar. If on ash, expand by one | |
| 740 // pixel to show a border in the title bar, otherwise leave the size as zero | |
| 741 // height. | |
| 742 const int kAshBorderSpacing = 1; | |
| 743 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) | |
| 744 size.Enlarge(0, kAshBorderSpacing); | |
| 745 } else { | |
| 746 size.Enlarge( | 742 size.Enlarge( |
| 747 0, PopupTopSpacing() + views::NonClientFrameView::kClientEdgeThickness); | 743 0, PopupTopSpacing() + views::NonClientFrameView::kClientEdgeThickness); |
| 748 } | 744 } |
| 749 return size; | 745 return size; |
| 750 } | 746 } |
| 751 | 747 |
| 752 void ToolbarView::LoadImages() { | 748 void ToolbarView::LoadImages() { |
| 753 const ui::ThemeProvider* tp = GetThemeProvider(); | 749 const ui::ThemeProvider* tp = GetThemeProvider(); |
| 754 | 750 |
| 755 if (ui::MaterialDesignController::IsModeMaterial()) { | 751 if (ui::MaterialDesignController::IsModeMaterial()) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 void ToolbarView::OnShowHomeButtonChanged() { | 807 void ToolbarView::OnShowHomeButtonChanged() { |
| 812 Layout(); | 808 Layout(); |
| 813 SchedulePaint(); | 809 SchedulePaint(); |
| 814 } | 810 } |
| 815 | 811 |
| 816 int ToolbarView::content_shadow_height() const { | 812 int ToolbarView::content_shadow_height() const { |
| 817 return GetLayoutConstant( | 813 return GetLayoutConstant( |
| 818 (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) ? | 814 (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) ? |
| 819 TOOLBAR_CONTENT_SHADOW_HEIGHT_ASH : TOOLBAR_CONTENT_SHADOW_HEIGHT); | 815 TOOLBAR_CONTENT_SHADOW_HEIGHT_ASH : TOOLBAR_CONTENT_SHADOW_HEIGHT); |
| 820 } | 816 } |
| OLD | NEW |