| 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 #import "chrome/browser/ui/cocoa/hover_close_button.h" | 5 #import "chrome/browser/ui/cocoa/hover_close_button.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "chrome/browser/themes/theme_properties.h" | 9 #include "chrome/browser/themes/theme_properties.h" |
| 10 #include "chrome/browser/themes/theme_service.h" | 10 #include "chrome/browser/themes/theme_service.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 - (void)setFadeOutValue:(CGFloat)value { | 154 - (void)setFadeOutValue:(CGFloat)value { |
| 155 [self setNeedsDisplay]; | 155 [self setNeedsDisplay]; |
| 156 } | 156 } |
| 157 | 157 |
| 158 - (TabView *)tabView { | 158 - (TabView *)tabView { |
| 159 return base::mac::ObjCCast<TabView>([self superview]); | 159 return base::mac::ObjCCast<TabView>([self superview]); |
| 160 } | 160 } |
| 161 | 161 |
| 162 - (NSImage*)imageForHoverState:(HoverState)hoverState { | 162 - (NSImage*)imageForHoverState:(HoverState)hoverState { |
| 163 int imageID = IDR_CLOSE_1; | |
| 164 | |
| 165 if (!ui::MaterialDesignController::IsModeMaterial()) { | |
| 166 switch (hoverState) { | |
| 167 case kHoverStateNone: | |
| 168 imageID = IDR_CLOSE_1; | |
| 169 break; | |
| 170 case kHoverStateMouseOver: | |
| 171 imageID = IDR_CLOSE_1_H; | |
| 172 break; | |
| 173 case kHoverStateMouseDown: | |
| 174 imageID = IDR_CLOSE_1_P; | |
| 175 break; | |
| 176 } | |
| 177 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | |
| 178 return bundle.GetNativeImageNamed(imageID).ToNSImage(); | |
| 179 } | |
| 180 | |
| 181 gfx::VectorIconId vectorIconID; | 163 gfx::VectorIconId vectorIconID; |
| 182 SkColor vectorIconColor = gfx::kPlaceholderColor; | 164 SkColor vectorIconColor = gfx::kPlaceholderColor; |
| 183 TabView* tabView = [self tabView]; | 165 TabView* tabView = [self tabView]; |
| 184 | 166 |
| 185 switch (hoverState) { | 167 switch (hoverState) { |
| 186 case kHoverStateNone: | 168 case kHoverStateNone: |
| 187 vectorIconID = gfx::VectorIconId::TAB_CLOSE_NORMAL; | 169 vectorIconID = gfx::VectorIconId::TAB_CLOSE_NORMAL; |
| 188 vectorIconColor = | 170 vectorIconColor = |
| 189 tabView ? [tabView iconColor] : tabs::kDefaultTabTextColor; | 171 tabView ? [tabView iconColor] : tabs::kDefaultTabTextColor; |
| 190 break; | 172 break; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 break; | 267 break; |
| 286 case kHoverStateMouseDown: | 268 case kHoverStateMouseDown: |
| 287 imageID = IDR_CLOSE_DIALOG_P; | 269 imageID = IDR_CLOSE_DIALOG_P; |
| 288 break; | 270 break; |
| 289 } | 271 } |
| 290 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 272 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 291 return bundle.GetNativeImageNamed(imageID).ToNSImage(); | 273 return bundle.GetNativeImageNamed(imageID).ToNSImage(); |
| 292 } | 274 } |
| 293 | 275 |
| 294 @end | 276 @end |
| OLD | NEW |