| 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/memory/scoped_nsobject.h" | 7 #include "base/memory/scoped_nsobject.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #import "chrome/browser/ui/cocoa/animation_utils.h" | 9 #import "chrome/browser/ui/cocoa/animation_utils.h" |
| 10 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
| 11 #include "grit/theme_resources.h" | 11 #include "grit/theme_resources.h" |
| 12 #include "grit/ui_resources.h" |
| 12 #import "third_party/GTM/AppKit/GTMKeyValueAnimation.h" | 13 #import "third_party/GTM/AppKit/GTMKeyValueAnimation.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 14 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| 17 const CGFloat kFramesPerSecond = 16; // Determined experimentally to look good. | 18 const CGFloat kFramesPerSecond = 16; // Determined experimentally to look good. |
| 18 const CGFloat kCloseAnimationDuration = 0.1; | 19 const CGFloat kCloseAnimationDuration = 0.1; |
| 19 | 20 |
| 20 // Strings that are used for all close buttons. Set up in +initialize. | 21 // Strings that are used for all close buttons. Set up in +initialize. |
| 21 NSString* gTooltip = nil; | 22 NSString* gTooltip = nil; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 } | 213 } |
| 213 | 214 |
| 214 return nil; // Do not show the tooltip. | 215 return nil; // Do not show the tooltip. |
| 215 } | 216 } |
| 216 | 217 |
| 217 @end | 218 @end |
| 218 | 219 |
| 219 @implementation WebUIHoverCloseButton | 220 @implementation WebUIHoverCloseButton |
| 220 | 221 |
| 221 - (NSImage*)imageForHoverState:(HoverState)hoverState { | 222 - (NSImage*)imageForHoverState:(HoverState)hoverState { |
| 222 int imageID = IDR_WEB_UI_CLOSE; | 223 int imageID = IDR_CLOSE_DIALOG; |
| 223 switch (hoverState) { | 224 switch (hoverState) { |
| 224 case kHoverStateNone: | 225 case kHoverStateNone: |
| 225 imageID = IDR_WEB_UI_CLOSE; | 226 imageID = IDR_CLOSE_DIALOG; |
| 226 break; | 227 break; |
| 227 case kHoverStateMouseOver: | 228 case kHoverStateMouseOver: |
| 228 imageID = IDR_WEB_UI_CLOSE_HOVER; | 229 imageID = IDR_CLOSE_DIALOG_H; |
| 229 break; | 230 break; |
| 230 case kHoverStateMouseDown: | 231 case kHoverStateMouseDown: |
| 231 imageID = IDR_WEB_UI_CLOSE_PRESSED; | 232 imageID = IDR_CLOSE_DIALOG_P; |
| 232 break; | 233 break; |
| 233 } | 234 } |
| 234 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 235 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 235 return bundle.GetNativeImageNamed(imageID).ToNSImage(); | 236 return bundle.GetNativeImageNamed(imageID).ToNSImage(); |
| 236 } | 237 } |
| 237 | 238 |
| 238 @end | 239 @end |
| OLD | NEW |