Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_view.cc

Issue 1636703002: Implement MD specs for non-tabbed windows in Ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: latest comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 #if defined(OS_WIN) 676 #if defined(OS_WIN)
677 ConflictingModuleView::MaybeShow(browser_, app_menu_button_); 677 ConflictingModuleView::MaybeShow(browser_, app_menu_button_);
678 #endif 678 #endif
679 } 679 }
680 incompatibility_badge_showing = true; 680 incompatibility_badge_showing = true;
681 return; 681 return;
682 } 682 }
683 } 683 }
684 684
685 int ToolbarView::PopupTopSpacing() const { 685 int ToolbarView::PopupTopSpacing() const {
686 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH)
687 return 0;
688
686 const int kAdditionalPopupTopSpacingNonGlass = 2; 689 const int kAdditionalPopupTopSpacingNonGlass = 2;
687 return views::NonClientFrameView::kClientEdgeThickness + 690 return views::NonClientFrameView::kClientEdgeThickness +
688 (GetWidget()->ShouldWindowContentsBeTransparent() ? 691 (GetWidget()->ShouldWindowContentsBeTransparent() ?
689 0 : kAdditionalPopupTopSpacingNonGlass); 692 0 : kAdditionalPopupTopSpacingNonGlass);
690 } 693 }
691 694
692 gfx::Size ToolbarView::GetSizeInternal( 695 gfx::Size ToolbarView::GetSizeInternal(
693 gfx::Size (View::*get_size)() const) const { 696 gfx::Size (View::*get_size)() const) const {
694 gfx::Size size((location_bar_->*get_size)()); 697 gfx::Size size((location_bar_->*get_size)());
695 if (is_display_mode_normal()) { 698 if (is_display_mode_normal()) {
(...skipping 27 matching lines...) Expand all
723 int content_height = std::max(back_->GetPreferredSize().height(), 726 int content_height = std::max(back_->GetPreferredSize().height(),
724 location_bar_->GetPreferredSize().height()); 727 location_bar_->GetPreferredSize().height());
725 int padding = GetLayoutInsets(TOOLBAR).height(); 728 int padding = GetLayoutInsets(TOOLBAR).height();
726 size.SetToMax(gfx::Size(0, content_height + padding)); 729 size.SetToMax(gfx::Size(0, content_height + padding));
727 } else { 730 } else {
728 gfx::ImageSkia* normal_background = 731 gfx::ImageSkia* normal_background =
729 GetThemeProvider()->GetImageSkiaNamed(IDR_CONTENT_TOP_CENTER); 732 GetThemeProvider()->GetImageSkiaNamed(IDR_CONTENT_TOP_CENTER);
730 size.SetToMax( 733 size.SetToMax(
731 gfx::Size(0, normal_background->height() - content_shadow_height())); 734 gfx::Size(0, normal_background->height() - content_shadow_height()));
732 } 735 }
733 } else if (size.height() == 0) { 736 } else if (size.height() > 0) {
734 // Location mode with a 0 height location bar. If on ash, expand by one
735 // pixel to show a border in the title bar, otherwise leave the size as zero
736 // height.
737 const int kAshBorderSpacing = 1;
738 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH)
739 size.Enlarge(0, kAshBorderSpacing);
740 } else {
741 size.Enlarge( 737 size.Enlarge(
742 0, PopupTopSpacing() + views::NonClientFrameView::kClientEdgeThickness); 738 0, PopupTopSpacing() + views::NonClientFrameView::kClientEdgeThickness);
743 } 739 }
744 return size; 740 return size;
745 } 741 }
746 742
747 void ToolbarView::LoadImages() { 743 void ToolbarView::LoadImages() {
748 const ui::ThemeProvider* tp = GetThemeProvider(); 744 const ui::ThemeProvider* tp = GetThemeProvider();
749 745
750 if (ui::MaterialDesignController::IsModeMaterial()) { 746 if (ui::MaterialDesignController::IsModeMaterial()) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 void ToolbarView::OnShowHomeButtonChanged() { 802 void ToolbarView::OnShowHomeButtonChanged() {
807 Layout(); 803 Layout();
808 SchedulePaint(); 804 SchedulePaint();
809 } 805 }
810 806
811 int ToolbarView::content_shadow_height() const { 807 int ToolbarView::content_shadow_height() const {
812 return GetLayoutConstant( 808 return GetLayoutConstant(
813 (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) ? 809 (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) ?
814 TOOLBAR_CONTENT_SHADOW_HEIGHT_ASH : TOOLBAR_CONTENT_SHADOW_HEIGHT); 810 TOOLBAR_CONTENT_SHADOW_HEIGHT_ASH : TOOLBAR_CONTENT_SHADOW_HEIGHT);
815 } 811 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698