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

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: refactor 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 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 #if defined(OS_WIN) 692 #if defined(OS_WIN)
693 ConflictingModuleView::MaybeShow(browser_, app_menu_button_); 693 ConflictingModuleView::MaybeShow(browser_, app_menu_button_);
694 #endif 694 #endif
695 } 695 }
696 incompatibility_badge_showing = true; 696 incompatibility_badge_showing = true;
697 return; 697 return;
698 } 698 }
699 } 699 }
700 700
701 int ToolbarView::PopupTopSpacing() const { 701 int ToolbarView::PopupTopSpacing() const {
702 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH)
703 return 0;
704
702 const int kAdditionalPopupTopSpacingNonGlass = 2; 705 const int kAdditionalPopupTopSpacingNonGlass = 2;
703 return views::NonClientFrameView::kClientEdgeThickness + 706 return views::NonClientFrameView::kClientEdgeThickness +
704 (GetWidget()->ShouldWindowContentsBeTransparent() ? 707 (GetWidget()->ShouldWindowContentsBeTransparent() ?
705 0 : kAdditionalPopupTopSpacingNonGlass); 708 0 : kAdditionalPopupTopSpacingNonGlass);
706 } 709 }
707 710
708 gfx::Size ToolbarView::GetSizeInternal( 711 gfx::Size ToolbarView::GetSizeInternal(
709 gfx::Size (View::*get_size)() const) const { 712 gfx::Size (View::*get_size)() const) const {
710 gfx::Size size((location_bar_->*get_size)()); 713 gfx::Size size((location_bar_->*get_size)());
711 if (is_display_mode_normal()) { 714 if (is_display_mode_normal()) {
(...skipping 27 matching lines...) Expand all
739 int content_height = std::max(back_->GetPreferredSize().height(), 742 int content_height = std::max(back_->GetPreferredSize().height(),
740 location_bar_->GetPreferredSize().height()); 743 location_bar_->GetPreferredSize().height());
741 int padding = GetLayoutInsets(TOOLBAR).height(); 744 int padding = GetLayoutInsets(TOOLBAR).height();
742 size.SetToMax(gfx::Size(0, content_height + padding)); 745 size.SetToMax(gfx::Size(0, content_height + padding));
743 } else { 746 } else {
744 gfx::ImageSkia* normal_background = 747 gfx::ImageSkia* normal_background =
745 GetThemeProvider()->GetImageSkiaNamed(IDR_CONTENT_TOP_CENTER); 748 GetThemeProvider()->GetImageSkiaNamed(IDR_CONTENT_TOP_CENTER);
746 size.SetToMax( 749 size.SetToMax(
747 gfx::Size(0, normal_background->height() - content_shadow_height())); 750 gfx::Size(0, normal_background->height() - content_shadow_height()));
748 } 751 }
749 } else if (size.height() == 0) { 752 } else if (size.height() > 0) {
750 // Location mode with a 0 height location bar. If on ash, expand by one
751 // pixel to show a border in the title bar, otherwise leave the size as zero
752 // height.
753 const int kAshBorderSpacing = 1;
754 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH)
tdanderson 2016/01/29 22:28:43 This change makes the frame header flush with the
Peter Kasting 2016/01/30 02:53:37 That sounds like a bug where views is not sending
tdanderson 2016/02/01 22:17:51 Still looking into this.
tdanderson 2016/02/02 19:22:36 Turns out this was a recent regression unrelated t
755 size.Enlarge(0, kAshBorderSpacing);
756 } else {
757 size.Enlarge( 753 size.Enlarge(
758 0, PopupTopSpacing() + views::NonClientFrameView::kClientEdgeThickness); 754 0, PopupTopSpacing() + views::NonClientFrameView::kClientEdgeThickness);
759 } 755 }
760 return size; 756 return size;
761 } 757 }
762 758
763 void ToolbarView::LoadImages() { 759 void ToolbarView::LoadImages() {
764 const ui::ThemeProvider* tp = GetThemeProvider(); 760 const ui::ThemeProvider* tp = GetThemeProvider();
765 761
766 if (ui::MaterialDesignController::IsModeMaterial()) { 762 if (ui::MaterialDesignController::IsModeMaterial()) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 void ToolbarView::OnShowHomeButtonChanged() { 818 void ToolbarView::OnShowHomeButtonChanged() {
823 Layout(); 819 Layout();
824 SchedulePaint(); 820 SchedulePaint();
825 } 821 }
826 822
827 int ToolbarView::content_shadow_height() const { 823 int ToolbarView::content_shadow_height() const {
828 return GetLayoutConstant( 824 return GetLayoutConstant(
829 (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) ? 825 (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) ?
830 TOOLBAR_CONTENT_SHADOW_HEIGHT_ASH : TOOLBAR_CONTENT_SHADOW_HEIGHT); 826 TOOLBAR_CONTENT_SHADOW_HEIGHT_ASH : TOOLBAR_CONTENT_SHADOW_HEIGHT);
831 } 827 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698