Index: chrome/browser/ui/views/toolbar/toolbar_view.cc |
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.cc b/chrome/browser/ui/views/toolbar/toolbar_view.cc |
index 4b772d5948836df0e0fbe688d188b7912ef8b240..bd7301d93be92ba1a5b8403c73bb70c0da6351db 100644 |
--- a/chrome/browser/ui/views/toolbar/toolbar_view.cc |
+++ b/chrome/browser/ui/views/toolbar/toolbar_view.cc |
@@ -104,12 +104,10 @@ bool HasAshShell() { |
#endif // OS_CHROMEOS |
// Returns the y-position that will center an element of height |
-// |child_height| inside an element of height |parent_height|. For |
-// material design excess padding is placed below, for non-material |
-// it is placed above. |
+// |child_height| inside an element of height |parent_height|. Excess padding is |
+// placed below. |
int CenteredChildY(int parent_height, int child_height) { |
- int roundoff_amount = ui::MaterialDesignController::IsModeMaterial() ? 0 : 1; |
- return (parent_height - child_height + roundoff_amount) / 2; |
+ return (parent_height - child_height) / 2; |
Peter Kasting
2016/09/22 23:27:25
Nit: I'd just do this inline in the two callers, n
|
} |
} // namespace |
@@ -642,7 +640,7 @@ bool ToolbarView::DoesIntersectRect(const views::View* target, |
// Fall through to the tab strip above us if none of |rect| intersects |
// with this view (intersection with the top shadow edge does not |
// count as intersection with this view). |
Peter Kasting
2016/09/22 23:27:25
Nit: Does this parenthetical have meaning anymore?
|
- if (rect.bottom() < content_shadow_height()) |
+ if (rect.bottom() < 0) |
Peter Kasting
2016/09/22 23:27:25
Hmm, I suspect this was a slight bug? Maybe they
Evan Stade
2016/09/23 00:31:08
in fact I think we can ditch this entire function
|
return false; |
// Otherwise let our superclass take care of it. |
return ViewTargeterDelegate::DoesIntersectRect(this, rect); |
Peter Kasting
2016/09/22 23:27:25
Nit: Simpler:
// Fall through to the tab strip
Evan Stade
2016/09/23 00:31:08
yea, I just came to the same conclusion
|
@@ -715,20 +713,12 @@ gfx::Size ToolbarView::GetSizeInternal( |
gfx::Size ToolbarView::SizeForContentSize(gfx::Size size) const { |
if (is_display_mode_normal()) { |
- // For Material Design the size of the toolbar is computed using the size |
- // of the location bar and constant padding values. For non-material the |
- // size is based on the provided assets. |
- if (ui::MaterialDesignController::IsModeMaterial()) { |
- int content_height = std::max(back_->GetPreferredSize().height(), |
- location_bar_->GetPreferredSize().height()); |
- int padding = GetLayoutInsets(TOOLBAR).height(); |
- size.SetToMax(gfx::Size(0, content_height + padding)); |
- } else { |
- gfx::ImageSkia* normal_background = |
- GetThemeProvider()->GetImageSkiaNamed(IDR_CONTENT_TOP_CENTER); |
- size.SetToMax( |
- gfx::Size(0, normal_background->height() - content_shadow_height())); |
- } |
+ // The size of the toolbar is computed using the size of the location bar |
+ // and constant padding values. |
+ int content_height = std::max(back_->GetPreferredSize().height(), |
+ location_bar_->GetPreferredSize().height()); |
+ int padding = GetLayoutInsets(TOOLBAR).height(); |
+ size.SetToMax(gfx::Size(0, content_height + padding)); |
} |
return size; |
} |
@@ -736,47 +726,34 @@ gfx::Size ToolbarView::SizeForContentSize(gfx::Size size) const { |
void ToolbarView::LoadImages() { |
const ui::ThemeProvider* tp = GetThemeProvider(); |
- if (ui::MaterialDesignController::IsModeMaterial()) { |
- const SkColor normal_color = |
- tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); |
- const SkColor disabled_color = |
- tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON_INACTIVE); |
- |
- back_->SetImage(views::Button::STATE_NORMAL, |
- gfx::CreateVectorIcon(gfx::VectorIconId::NAVIGATE_BACK, |
- normal_color)); |
- back_->SetImage(views::Button::STATE_DISABLED, |
- gfx::CreateVectorIcon(gfx::VectorIconId::NAVIGATE_BACK, |
- disabled_color)); |
- forward_->SetImage( |
- views::Button::STATE_NORMAL, |
- gfx::CreateVectorIcon(gfx::VectorIconId::NAVIGATE_FORWARD, |
- normal_color)); |
- forward_->SetImage( |
- views::Button::STATE_DISABLED, |
- gfx::CreateVectorIcon(gfx::VectorIconId::NAVIGATE_FORWARD, |
- disabled_color)); |
- home_->SetImage(views::Button::STATE_NORMAL, |
- gfx::CreateVectorIcon(gfx::VectorIconId::NAVIGATE_HOME, |
- normal_color)); |
- app_menu_button_->UpdateIcon(); |
- |
- back_->set_ink_drop_base_color(normal_color); |
- forward_->set_ink_drop_base_color(normal_color); |
- home_->set_ink_drop_base_color(normal_color); |
- app_menu_button_->set_ink_drop_base_color(normal_color); |
- } else { |
- back_->SetImage(views::Button::STATE_NORMAL, |
- *(tp->GetImageSkiaNamed(IDR_BACK))); |
- back_->SetImage(views::Button::STATE_DISABLED, |
- *(tp->GetImageSkiaNamed(IDR_BACK_D))); |
- forward_->SetImage(views::Button::STATE_NORMAL, |
- *(tp->GetImageSkiaNamed(IDR_FORWARD))); |
- forward_->SetImage(views::Button::STATE_DISABLED, |
- *(tp->GetImageSkiaNamed(IDR_FORWARD_D))); |
- home_->SetImage(views::Button::STATE_NORMAL, |
- *(tp->GetImageSkiaNamed(IDR_HOME))); |
- } |
+ const SkColor normal_color = |
+ tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); |
+ const SkColor disabled_color = |
+ tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON_INACTIVE); |
+ |
+ back_->SetImage(views::Button::STATE_NORMAL, |
+ gfx::CreateVectorIcon(gfx::VectorIconId::NAVIGATE_BACK, |
+ normal_color)); |
+ back_->SetImage(views::Button::STATE_DISABLED, |
+ gfx::CreateVectorIcon(gfx::VectorIconId::NAVIGATE_BACK, |
+ disabled_color)); |
+ forward_->SetImage( |
+ views::Button::STATE_NORMAL, |
+ gfx::CreateVectorIcon(gfx::VectorIconId::NAVIGATE_FORWARD, |
+ normal_color)); |
+ forward_->SetImage( |
+ views::Button::STATE_DISABLED, |
+ gfx::CreateVectorIcon(gfx::VectorIconId::NAVIGATE_FORWARD, |
+ disabled_color)); |
+ home_->SetImage(views::Button::STATE_NORMAL, |
+ gfx::CreateVectorIcon(gfx::VectorIconId::NAVIGATE_HOME, |
+ normal_color)); |
+ app_menu_button_->UpdateIcon(); |
+ |
+ back_->set_ink_drop_base_color(normal_color); |
+ forward_->set_ink_drop_base_color(normal_color); |
+ home_->set_ink_drop_base_color(normal_color); |
+ app_menu_button_->set_ink_drop_base_color(normal_color); |
reload_->LoadImages(); |
} |
@@ -799,11 +776,3 @@ void ToolbarView::OnShowHomeButtonChanged() { |
Layout(); |
SchedulePaint(); |
} |
- |
-int ToolbarView::content_shadow_height() const { |
-#if defined(USE_ASH) |
- return GetLayoutConstant(TOOLBAR_CONTENT_SHADOW_HEIGHT_ASH); |
-#else |
- return GetLayoutConstant(TOOLBAR_CONTENT_SHADOW_HEIGHT); |
-#endif |
-} |