| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/infobar_container_delegate.h" | 5 #include "chrome/browser/ui/infobar_container_delegate.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "ui/base/material_design/material_design_controller.h" | 8 #include "ui/base/material_design/material_design_controller.h" |
| 9 #include "ui/gfx/animation/slide_animation.h" | 9 #include "ui/gfx/animation/slide_animation.h" |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 void InfoBarContainerDelegate::SetMaxTopArrowHeight( | 64 void InfoBarContainerDelegate::SetMaxTopArrowHeight( |
| 65 int height, | 65 int height, |
| 66 infobars::InfoBarContainer* container) { | 66 infobars::InfoBarContainer* container) { |
| 67 top_arrow_target_height_ = | 67 top_arrow_target_height_ = |
| 68 std::min(std::max(height - GetSeparatorLineHeightForLayout(), 0), | 68 std::min(std::max(height - GetSeparatorLineHeightForLayout(), 0), |
| 69 kMaximumArrowTargetHeight); | 69 kMaximumArrowTargetHeight); |
| 70 container->UpdateInfoBarArrowTargetHeights(); | 70 container->UpdateInfoBarArrowTargetHeights(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 int InfoBarContainerDelegate::DefaultMaxTopArrowHeight() const { |
| 74 return GetDefaultArrowTargetHeight(); |
| 75 } |
| 76 |
| 73 int InfoBarContainerDelegate::ArrowTargetHeightForInfoBar( | 77 int InfoBarContainerDelegate::ArrowTargetHeightForInfoBar( |
| 74 size_t index, | 78 size_t index, |
| 75 const gfx::SlideAnimation& animation) const { | 79 const gfx::SlideAnimation& animation) const { |
| 76 if (!DrawInfoBarArrows(nullptr)) | 80 if (!DrawInfoBarArrows(nullptr)) |
| 77 return 0; | 81 return 0; |
| 78 if (index == 0) | 82 if (index == 0) |
| 79 return top_arrow_target_height_; | 83 return top_arrow_target_height_; |
| 80 if ((index > 1) || animation.IsShowing()) | 84 if ((index > 1) || animation.IsShowing()) |
| 81 return GetDefaultArrowTargetHeight(); | 85 return GetDefaultArrowTargetHeight(); |
| 82 // When the first infobar is animating closed, we animate the second infobar's | 86 // When the first infobar is animating closed, we animate the second infobar's |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 if (*arrow_height && !ui::MaterialDesignController::IsModeMaterial()) | 127 if (*arrow_height && !ui::MaterialDesignController::IsModeMaterial()) |
| 124 *arrow_height += GetSeparatorLineHeightForLayout(); | 128 *arrow_height += GetSeparatorLineHeightForLayout(); |
| 125 | 129 |
| 126 int target_height = bar_target_height != -1 | 130 int target_height = bar_target_height != -1 |
| 127 ? bar_target_height | 131 ? bar_target_height |
| 128 : ui::MaterialDesignController::IsModeMaterial() | 132 : ui::MaterialDesignController::IsModeMaterial() |
| 129 ? kDefaultBarTargetHeightMd | 133 ? kDefaultBarTargetHeightMd |
| 130 : kDefaultBarTargetHeight; | 134 : kDefaultBarTargetHeight; |
| 131 *bar_height = animation.CurrentValueBetween(0, target_height); | 135 *bar_height = animation.CurrentValueBetween(0, target_height); |
| 132 } | 136 } |
| OLD | NEW |