Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(464)

Unified Diff: chrome/browser/ui/cocoa/hover_close_button.mm

Issue 2687633002: Fix using theme colors for the download shelf's close button. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/hover_close_button.h ('k') | chrome/browser/ui/cocoa/tabs/tab_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/hover_close_button.mm
diff --git a/chrome/browser/ui/cocoa/hover_close_button.mm b/chrome/browser/ui/cocoa/hover_close_button.mm
index a5e59d57848e26c549d5a57d86894c250f902403..f025a588d8a0e66fcc21c1e5632edd1532124ed4 100644
--- a/chrome/browser/ui/cocoa/hover_close_button.mm
+++ b/chrome/browser/ui/cocoa/hover_close_button.mm
@@ -4,21 +4,12 @@
#import "chrome/browser/ui/cocoa/hover_close_button.h"
-#include "base/mac/foundation_util.h"
#include "base/strings/sys_string_conversions.h"
#include "chrome/app/vector_icons/vector_icons.h"
-#include "chrome/browser/themes/theme_properties.h"
-#include "chrome/browser/themes/theme_service.h"
-#import "chrome/browser/ui/cocoa/browser_window_controller.h"
-#import "chrome/browser/ui/cocoa/tabs/tab_controller.h"
-#import "chrome/browser/ui/cocoa/tabs/tab_view.h"
#include "chrome/grit/generated_resources.h"
-#include "chrome/grit/theme_resources.h"
#include "components/strings/grit/components_strings.h"
#import "third_party/google_toolbox_for_mac/src/AppKit/GTMKeyValueAnimation.h"
-#include "ui/base/cocoa/animation_utils.h"
#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/material_design/material_design_controller.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/image/image_skia_util_mac.h"
@@ -37,6 +28,8 @@ NSString* gTooltip = nil;
// If this string is changed, the setter (currently setFadeOutValue:) must
// be changed as well to match.
NSString* const kFadeOutValueKeyPath = @"fadeOutValue";
+
+const SkColor kDefaultIconColor = SkColorSetARGB(0xA0, 0x00, 0x00, 0x00);
} // namespace
@interface HoverCloseButton ()
@@ -54,6 +47,8 @@ NSString* const kFadeOutValueKeyPath = @"fadeOutValue";
@implementation HoverCloseButton
+@synthesize iconColor = iconColor_;
+
+ (void)initialize {
// Grab some strings that are used by all close buttons.
if (!gBasicAccessibilityTitle) {
@@ -155,20 +150,14 @@ NSString* const kFadeOutValueKeyPath = @"fadeOutValue";
[self setNeedsDisplay];
}
-- (TabView *)tabView {
- return base::mac::ObjCCast<TabView>([self superview]);
-}
-
- (NSImage*)imageForHoverState:(HoverState)hoverState {
const gfx::VectorIcon* vectorIcon = nullptr;
SkColor vectorIconColor = gfx::kPlaceholderColor;
- TabView* tabView = [self tabView];
switch (hoverState) {
case kHoverStateNone:
vectorIcon = &kTabCloseNormalIcon;
- vectorIconColor =
- tabView ? [tabView iconColor] : tabs::kDefaultTabTextColor;
+ vectorIconColor = iconColor_;
break;
case kHoverStateMouseOver:
// For mouse over, the icon color is the fill color of the circle.
@@ -217,8 +206,8 @@ NSString* const kFadeOutValueKeyPath = @"fadeOutValue";
// tooltip contents immediately before showing it.
[self addToolTipRect:[self bounds] owner:self userData:NULL];
- // Initialize previousState.
previousState_ = kHoverStateNone;
+ iconColor_ = kDefaultIconColor;
}
// Called each time a tooltip is about to be shown.
@@ -251,6 +240,13 @@ NSString* const kFadeOutValueKeyPath = @"fadeOutValue";
[super setAccessibilityTitle:extendedTitle];
}
+- (void)setIconColor:(SkColor)iconColor {
+ if (iconColor != iconColor_) {
+ iconColor_ = iconColor;
+ [self setNeedsDisplay:YES];
+ }
+}
+
@end
@implementation WebUIHoverCloseButton
« no previous file with comments | « chrome/browser/ui/cocoa/hover_close_button.h ('k') | chrome/browser/ui/cocoa/tabs/tab_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698