| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tabs/tab_strip.h" | 5 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <iterator> | 10 #include <iterator> |
| (...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1086 newtab_button_->set_background_offset(offset); | 1086 newtab_button_->set_background_offset(offset); |
| 1087 } | 1087 } |
| 1088 | 1088 |
| 1089 void TabStrip::SetImmersiveStyle(bool enable) { | 1089 void TabStrip::SetImmersiveStyle(bool enable) { |
| 1090 if (immersive_style_ == enable) | 1090 if (immersive_style_ == enable) |
| 1091 return; | 1091 return; |
| 1092 immersive_style_ = enable; | 1092 immersive_style_ = enable; |
| 1093 } | 1093 } |
| 1094 | 1094 |
| 1095 SkAlpha TabStrip::GetInactiveAlpha(bool for_new_tab_button) const { | 1095 SkAlpha TabStrip::GetInactiveAlpha(bool for_new_tab_button) const { |
| 1096 static const SkAlpha kInactiveTabAlphaAsh = 230; | |
| 1097 static const SkAlpha kInactiveTabAlphaGlass = 200; | |
| 1098 static const SkAlpha kInactiveTabAlphaOpaque = 255; | 1096 static const SkAlpha kInactiveTabAlphaOpaque = 255; |
| 1099 static const double kMultiSelectionMultiplier = 0.6; | 1097 static const double kMultiSelectionMultiplier = 0.6; |
| 1100 | 1098 |
| 1101 const chrome::HostDesktopType host_desktop_type = | |
| 1102 chrome::GetHostDesktopTypeForNativeView(GetWidget()->GetNativeView()); | |
| 1103 SkAlpha base_alpha = kInactiveTabAlphaOpaque; | 1099 SkAlpha base_alpha = kInactiveTabAlphaOpaque; |
| 1104 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) | 1100 #if defined(USE_ASH) |
| 1105 base_alpha = kInactiveTabAlphaAsh; | 1101 static const SkAlpha kInactiveTabAlphaAsh = 230; |
| 1106 else if (GetWidget()->ShouldWindowContentsBeTransparent()) | 1102 base_alpha = kInactiveTabAlphaAsh; |
| 1103 #else |
| 1104 static const SkAlpha kInactiveTabAlphaGlass = 200; |
| 1105 if (GetWidget()->ShouldWindowContentsBeTransparent()) |
| 1107 base_alpha = kInactiveTabAlphaGlass; | 1106 base_alpha = kInactiveTabAlphaGlass; |
| 1107 #endif // USE_ASH |
| 1108 return (for_new_tab_button || (GetSelectionModel().size() <= 1)) ? | 1108 return (for_new_tab_button || (GetSelectionModel().size() <= 1)) ? |
| 1109 base_alpha : static_cast<SkAlpha>(kMultiSelectionMultiplier * base_alpha); | 1109 base_alpha : static_cast<SkAlpha>(kMultiSelectionMultiplier * base_alpha); |
| 1110 } | 1110 } |
| 1111 | 1111 |
| 1112 bool TabStrip::IsAnimating() const { | 1112 bool TabStrip::IsAnimating() const { |
| 1113 return bounds_animator_.IsAnimating(); | 1113 return bounds_animator_.IsAnimating(); |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 void TabStrip::StopAnimating(bool layout) { | 1116 void TabStrip::StopAnimating(bool layout) { |
| 1117 if (!IsAnimating()) | 1117 if (!IsAnimating()) |
| (...skipping 1753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2871 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); | 2871 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); |
| 2872 if (view) | 2872 if (view) |
| 2873 return view; | 2873 return view; |
| 2874 } | 2874 } |
| 2875 Tab* tab = FindTabForEvent(point); | 2875 Tab* tab = FindTabForEvent(point); |
| 2876 if (tab) | 2876 if (tab) |
| 2877 return ConvertPointToViewAndGetEventHandler(this, tab, point); | 2877 return ConvertPointToViewAndGetEventHandler(this, tab, point); |
| 2878 } | 2878 } |
| 2879 return this; | 2879 return this; |
| 2880 } | 2880 } |
| OLD | NEW |