Index: chrome/browser/ui/cocoa/tabs/tab_strip_view.mm |
diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_view.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_view.mm |
index e3ccd72c0400f6ebe53a3b3997ee416a560f2524..fb707046f43fdc735ee130577f9702ba82ed74a9 100644 |
--- a/chrome/browser/ui/cocoa/tabs/tab_strip_view.mm |
+++ b/chrome/browser/ui/cocoa/tabs/tab_strip_view.mm |
@@ -45,6 +45,42 @@ |
return self; |
} |
+- (void)dealloc { |
+ [[NSNotificationCenter defaultCenter] removeObserver:self]; |
+ [super dealloc]; |
+} |
+ |
+- (void)viewWillMoveToWindow:(NSWindow*)window { |
+ [super viewWillMoveToWindow:window]; |
+ |
+ if ([self window]) { |
+ [[NSNotificationCenter defaultCenter] |
+ removeObserver:self |
+ name:NSWindowDidBecomeMainNotification |
+ object:[self window]]; |
+ [[NSNotificationCenter defaultCenter] |
+ removeObserver:self |
+ name:NSWindowDidResignMainNotification |
+ object:[self window]]; |
+ } |
+ if (window) { |
+ [[NSNotificationCenter defaultCenter] |
+ addObserver:self |
+ selector:@selector(windowFocusDidChange:) |
+ name:NSWindowDidBecomeMainNotification |
+ object:window]; |
+ [[NSNotificationCenter defaultCenter] |
+ addObserver:self |
+ selector:@selector(windowFocusDidChange:) |
+ name:NSWindowDidResignMainNotification |
+ object:window]; |
+ } |
+} |
+ |
+- (void)windowFocusDidChange:(NSNotification*)notification { |
+ [self setNeedsDisplay:YES]; |
+} |
+ |
// Draw bottom border bitmap. Each tab is responsible for mimicking this bottom |
// border, unless it's the selected tab. |
- (void)drawBorder:(NSRect)dirtyRect { |
@@ -64,7 +100,7 @@ |
// Themes don't have an inactive image so only look for one if there's no |
// theme. |
- bool active = [[self window] isKeyWindow] || [[self window] isMainWindow] || |
+ bool active = [[self window] isMainWindow] || |
Andre
2015/01/31 01:00:48
A utility window can be key without being main, bu
Robert Sesek
2015/02/02 19:32:16
What about with child windows?
Andre
2015/02/02 21:40:08
I tested that the browser window stays main when s
|
!themeProvider->UsingDefaultTheme(); |
int resource_id = active ? IDR_THEME_TOOLBAR : IDR_THEME_TOOLBAR_INACTIVE; |
[themeProvider->GetNSImageColorNamed(resource_id) set]; |
@@ -81,7 +117,7 @@ |
borderRect.size.height = [image size].height; |
borderRect.origin.y = 0; |
- BOOL focused = [[self window] isKeyWindow] || [[self window] isMainWindow]; |
+ BOOL focused = [[self window] isMainWindow]; |
NSDrawThreePartImage(borderRect, nil, image, nil, /*vertical=*/ NO, |
NSCompositeSourceOver, |
focused ? 1.0 : tabs::kImageNoFocusAlpha, |