Chromium Code Reviews| Index: chrome/browser/ui/infobar_container_delegate.cc |
| diff --git a/chrome/browser/ui/infobar_container_delegate.cc b/chrome/browser/ui/infobar_container_delegate.cc |
| index 866557653ae8fe86f104719bb837d42246dc7d7f..1fe2e5e34d020db262a04400285598571a661d58 100644 |
| --- a/chrome/browser/ui/infobar_container_delegate.cc |
| +++ b/chrome/browser/ui/infobar_container_delegate.cc |
| @@ -5,58 +5,29 @@ |
| #include "chrome/browser/ui/infobar_container_delegate.h" |
| #include "build/build_config.h" |
| -#include "ui/base/material_design/material_design_controller.h" |
| #include "ui/gfx/animation/slide_animation.h" |
| #if defined(TOOLKIT_VIEWS) |
| #include "ui/views/window/non_client_view.h" |
| #endif |
| -namespace { |
| - |
| -int GetDefaultArrowTargetHeight() { |
| - return ui::MaterialDesignController::IsModeMaterial() |
| - ? InfoBarContainerDelegate::kDefaultArrowTargetHeightMd |
| - : InfoBarContainerDelegate::kDefaultArrowTargetHeight; |
| -} |
| - |
| -int GetDefaultArrowTargetHalfWidth() { |
| - return ui::MaterialDesignController::IsModeMaterial() |
| - ? InfoBarContainerDelegate::kDefaultArrowTargetHalfWidthMd |
| - : InfoBarContainerDelegate::kDefaultArrowTargetHalfWidth; |
| -} |
| - |
| -int GetSeparatorLineHeightForLayout() { |
| - return ui::MaterialDesignController::IsModeMaterial() |
| - ? 0 |
| - : InfoBarContainerDelegate::kSeparatorLineHeight; |
| -} |
| - |
| -} // namespace |
| - |
| // static |
| #if defined(OS_MACOSX) |
| const int InfoBarContainerDelegate::kSeparatorLineHeight = 1; |
| -const int InfoBarContainerDelegate::kDefaultArrowTargetHeight = 11; |
| -#elif defined(TOOLKIT_VIEWS) |
| -// Views comes second until the Mac browser is Views-based. |
| +#else |
| const int InfoBarContainerDelegate::kSeparatorLineHeight = |
| views::NonClientFrameView::kClientEdgeThickness; |
| -const int InfoBarContainerDelegate::kDefaultArrowTargetHeight = 9; |
| #endif |
| -const int InfoBarContainerDelegate::kDefaultArrowTargetHeightMd = 11; |
| +const int InfoBarContainerDelegate::kDefaultArrowTargetHeight = 11; |
| -const int InfoBarContainerDelegate::kDefaultBarTargetHeight = 36; |
| -const int InfoBarContainerDelegate::kDefaultBarTargetHeightMd = 40; |
| +const int InfoBarContainerDelegate::kDefaultBarTargetHeight = 40; |
| const int InfoBarContainerDelegate::kMaximumArrowTargetHeight = 24; |
| const int InfoBarContainerDelegate::kDefaultArrowTargetHalfWidth = |
| kDefaultArrowTargetHeight; |
| -const int InfoBarContainerDelegate::kDefaultArrowTargetHalfWidthMd = |
| - kDefaultArrowTargetHeightMd; |
| const int InfoBarContainerDelegate::kMaximumArrowTargetHalfWidth = 14; |
| InfoBarContainerDelegate::InfoBarContainerDelegate() |
| - : top_arrow_target_height_(GetDefaultArrowTargetHeight()) {} |
| + : top_arrow_target_height_(kDefaultArrowTargetHeight) {} |
| InfoBarContainerDelegate::~InfoBarContainerDelegate() { |
| } |
| @@ -65,8 +36,7 @@ void InfoBarContainerDelegate::SetMaxTopArrowHeight( |
| int height, |
| infobars::InfoBarContainer* container) { |
| top_arrow_target_height_ = |
| - std::min(std::max(height - GetSeparatorLineHeightForLayout(), 0), |
| - kMaximumArrowTargetHeight); |
| + std::min(std::max(height, 0), kMaximumArrowTargetHeight); |
| container->UpdateInfoBarArrowTargetHeights(); |
| } |
| @@ -78,13 +48,13 @@ int InfoBarContainerDelegate::ArrowTargetHeightForInfoBar( |
| if (index == 0) |
| return top_arrow_target_height_; |
| if ((index > 1) || animation.IsShowing()) |
| - return GetDefaultArrowTargetHeight(); |
| + return kDefaultArrowTargetHeight; |
| // When the first infobar is animating closed, we animate the second infobar's |
| // arrow target height from the default to the top target height. Note that |
| // the animation values here are going from 1.0 -> 0.0 as the top bar closes. |
| return top_arrow_target_height_ + |
| static_cast<int>( |
| - (GetDefaultArrowTargetHeight() - top_arrow_target_height_) * |
| + (kDefaultArrowTargetHeight - top_arrow_target_height_) * |
| animation.GetCurrentValue()); |
| } |
| @@ -111,22 +81,12 @@ void InfoBarContainerDelegate::ComputeInfoBarElementSizes( |
| // half-width to be proportionally the same distance between its default and |
| // maximum values as the height is between its. |
| *arrow_half_width = |
| - GetDefaultArrowTargetHalfWidth() + |
| - ((kMaximumArrowTargetHalfWidth - GetDefaultArrowTargetHalfWidth()) * |
| + kDefaultArrowTargetHalfWidth + |
| + ((kMaximumArrowTargetHalfWidth - kDefaultArrowTargetHalfWidth) * |
| ((*arrow_height - kDefaultArrowTargetHeight) / |
| (kMaximumArrowTargetHeight - kDefaultArrowTargetHeight))); |
| } |
| - // Add pixels for the stroke, if the arrow is to be visible at all. Without |
| - // this, changing the arrow height from 0 to kSeparatorLineHeight would |
| - // produce no visible effect, because the stroke would paint atop the divider |
| - // line above the infobar. |
| - if (*arrow_height && !ui::MaterialDesignController::IsModeMaterial()) |
| - *arrow_height += GetSeparatorLineHeightForLayout(); |
| - |
| - int target_height = bar_target_height != -1 |
| - ? bar_target_height |
| - : ui::MaterialDesignController::IsModeMaterial() |
| - ? kDefaultBarTargetHeightMd |
| - : kDefaultBarTargetHeight; |
| + int target_height = |
| + bar_target_height != -1 ? bar_target_height : kDefaultBarTargetHeight; |
|
Peter Kasting
2016/10/24 23:49:56
Nit: Reverse condition and arms so second arm does
Evan Stade
2016/10/25 16:22:56
Done.
|
| *bar_height = animation.CurrentValueBetween(0, target_height); |
| } |