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 |
11 #if defined(TOOLKIT_VIEWS) | 11 #if defined(TOOLKIT_VIEWS) |
12 #include "ui/views/window/non_client_view.h" | 12 #include "ui/views/window/non_client_view.h" |
13 #endif | 13 #endif |
14 | 14 |
15 // static | 15 // static |
16 #if defined(OS_MACOSX) | 16 #if defined(OS_MACOSX) |
17 const int InfoBarContainerDelegate::kSeparatorLineHeight = 1; | 17 const int InfoBarContainerDelegate::kSeparatorLineHeight = 1; |
18 const int InfoBarContainerDelegate::kDefaultArrowTargetHeight = 11; | 18 const int InfoBarContainerDelegate::kDefaultArrowTargetHeight = 11; |
19 #elif defined(TOOLKIT_VIEWS) | 19 #elif defined(TOOLKIT_VIEWS) |
20 // Views comes second until the Mac browser is Views-based. | 20 // Views comes second until the Mac browser is Views-based. |
21 const int InfoBarContainerDelegate::kSeparatorLineHeight = | 21 const int InfoBarContainerDelegate::kSeparatorLineHeight = |
22 views::NonClientFrameView::kClientEdgeThickness; | 22 views::NonClientFrameView::kClientEdgeThickness; |
23 const int InfoBarContainerDelegate::kDefaultArrowTargetHeight = 9; | 23 const int InfoBarContainerDelegate::kDefaultArrowTargetHeight = 9; |
24 #endif | 24 #endif |
25 | 25 |
26 const int InfoBarContainerDelegate::kDefaultBarTargetHeight = 36; | 26 const int InfoBarContainerDelegate::kDefaultBarTargetHeight = 36; |
27 const int InfoBarContainerDelegate::kDefaultBarTargetHeightMd = 40; | 27 const int InfoBarContainerDelegate::kDefaultBarTargetHeightMd = 39; |
28 const int InfoBarContainerDelegate::kMaximumArrowTargetHeight = 24; | 28 const int InfoBarContainerDelegate::kMaximumArrowTargetHeight = 24; |
29 const int InfoBarContainerDelegate::kDefaultArrowTargetHalfWidth = | 29 const int InfoBarContainerDelegate::kDefaultArrowTargetHalfWidth = |
30 kDefaultArrowTargetHeight; | 30 kDefaultArrowTargetHeight; |
31 const int InfoBarContainerDelegate::kMaximumArrowTargetHalfWidth = 14; | 31 const int InfoBarContainerDelegate::kMaximumArrowTargetHalfWidth = 14; |
32 | 32 |
33 InfoBarContainerDelegate::InfoBarContainerDelegate() | 33 InfoBarContainerDelegate::InfoBarContainerDelegate() |
34 : top_arrow_target_height_(kDefaultArrowTargetHeight) { | 34 : top_arrow_target_height_(kDefaultArrowTargetHeight) { |
35 } | 35 } |
36 | 36 |
37 InfoBarContainerDelegate::~InfoBarContainerDelegate() { | 37 InfoBarContainerDelegate::~InfoBarContainerDelegate() { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 if (*arrow_height) | 98 if (*arrow_height) |
99 *arrow_height += kSeparatorLineHeight; | 99 *arrow_height += kSeparatorLineHeight; |
100 | 100 |
101 int target_height = bar_target_height != -1 | 101 int target_height = bar_target_height != -1 |
102 ? bar_target_height | 102 ? bar_target_height |
103 : ui::MaterialDesignController::IsModeMaterial() | 103 : ui::MaterialDesignController::IsModeMaterial() |
104 ? kDefaultBarTargetHeightMd | 104 ? kDefaultBarTargetHeightMd |
105 : kDefaultBarTargetHeight; | 105 : kDefaultBarTargetHeight; |
106 *bar_height = animation.CurrentValueBetween(0, target_height); | 106 *bar_height = animation.CurrentValueBetween(0, target_height); |
107 } | 107 } |
OLD | NEW |