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

Unified Diff: chrome/browser/cocoa/status_bubble_mac.mm

Issue 165499: Updates to clean up default theme and add hover states (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 4 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
Index: chrome/browser/cocoa/status_bubble_mac.mm
===================================================================
--- chrome/browser/cocoa/status_bubble_mac.mm (revision 24798)
+++ chrome/browser/cocoa/status_bubble_mac.mm (working copy)
@@ -9,6 +9,8 @@
#include "base/sys_string_conversions.h"
#include "googleurl/src/gurl.h"
#import "third_party/GTM/AppKit/GTMNSBezierPath+RoundRect.h"
+#import "third_party/GTM/AppKit/GTMNSColor+Luminance.h"
+#import "third_party/GTM/AppKit/GTMTheme.h"
namespace {
@@ -49,10 +51,12 @@
@private
NSString* content_;
BubbleStyle style_;
+ NSWindow* parent_;
}
- (void)setContent:(NSString*)content;
- (void)setStyle:(BubbleStyle)style;
+- (void)setParent:(NSWindow*)parent;
- (NSFont*)font;
@end
@@ -220,6 +224,8 @@
StatusBubbleViewCocoa* view =
[[[StatusBubbleViewCocoa alloc] initWithFrame:NSZeroRect] autorelease];
+ [view setParent:parent_];
+
[window_ setContentView:view];
[parent_ addChildWindow:window_ ordered:NSWindowAbove];
@@ -248,6 +254,7 @@
@implementation StatusBubbleViewCocoa
- (void)dealloc {
+ [parent_ release];
[content_ release];
[super dealloc];
}
@@ -263,6 +270,16 @@
[self setNeedsDisplay:YES];
}
+- (void)setParent:(NSWindow*)parent {
+ [parent_ autorelease];
+ parent_ = [parent retain];
+ [self setNeedsDisplay:YES];
+}
+
+- (GTMTheme*)gtm_theme {
+ return [parent_ gtm_theme];
+}
+
- (NSFont*)font {
return [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
}
@@ -300,13 +317,24 @@
// Background / Edge
NSRect bounds = [self bounds];
+ bounds = NSInsetRect(bounds, 0.5, 0.5);
NSBezierPath *border = [NSBezierPath gtm_bezierPathWithRoundRect:bounds
topLeftCornerRadius:tl_radius
topRightCornerRadius:tr_radius
bottomLeftCornerRadius:bl_radius
bottomRightCornerRadius:br_radius];
- [[NSColor colorWithDeviceWhite:kWindowFill alpha:1.0f] set];
+ NSColor* color =
+ [[self gtm_theme] backgroundColorForStyle:GTMThemeStyleToolBar
+ state:GTMThemeStateActiveWindow];
+
+ // workaround for default theme
+ // TODO(alcor) next GTM update return nil for background color if not set;
+ if ([color isEqual:[NSColor colorWithCalibratedWhite:0.5 alpha:1.0]])
+ color = nil;
+ if (!color)
+ color = [NSColor colorWithCalibratedWhite:0.9 alpha:1.0];
+ [color set];
[border fill];
border = [NSBezierPath gtm_bezierPathWithRoundRect:bounds
@@ -319,11 +347,11 @@
[border stroke];
// Text
-
+ NSColor* textColor = [color gtm_legibleTextColor];
NSFont* textFont = [self font];
NSShadow* textShadow = [[[NSShadow alloc] init] autorelease];
- [textShadow setShadowBlurRadius:1.5f];
- [textShadow setShadowColor:[NSColor whiteColor]];
+ [textShadow setShadowBlurRadius:0.0f];
+ [textShadow setShadowColor:[textColor gtm_legibleTextColor]];
[textShadow setShadowOffset:NSMakeSize(0.0f, -1.0f)];
NSDictionary* textDict = [NSDictionary dictionaryWithObjectsAndKeys:
« no previous file with comments | « chrome/browser/cocoa/gradient_button_cell_unittest.mm ('k') | chrome/browser/cocoa/status_bubble_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698