| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/tabs/tab_strip_background_view.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_background_view.h" |
| 6 | 6 |
| 7 #import "chrome/browser/ui/cocoa/framed_browser_window.h" | 7 #import "chrome/browser/ui/cocoa/framed_browser_window.h" |
| 8 #import "ui/base/cocoa/nsview_additions.h" | 8 #import "ui/base/cocoa/nsview_additions.h" |
| 9 | 9 |
| 10 @implementation TabStripBackgroundView | 10 @implementation TabStripBackgroundView |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 NSRect strokeRect = NSInsetRect(roundedRect, -lineWidth/2, lineWidth/2); | 33 NSRect strokeRect = NSInsetRect(roundedRect, -lineWidth/2, lineWidth/2); |
| 34 NSBezierPath* path = [NSBezierPath bezierPathWithRoundedRect:strokeRect | 34 NSBezierPath* path = [NSBezierPath bezierPathWithRoundedRect:strokeRect |
| 35 xRadius:cornerRadius | 35 xRadius:cornerRadius |
| 36 yRadius:cornerRadius]; | 36 yRadius:cornerRadius]; |
| 37 [path setLineWidth:lineWidth]; | 37 [path setLineWidth:lineWidth]; |
| 38 [[NSColor colorWithCalibratedWhite:1.0 alpha:0.5] set]; | 38 [[NSColor colorWithCalibratedWhite:1.0 alpha:0.5] set]; |
| 39 [path stroke]; | 39 [path stroke]; |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | 42 |
| 43 - (void)viewWillMoveToWindow:(NSWindow*)window { | 43 // ThemedWindowDrawing implementation. |
| 44 if ([self window]) { | |
| 45 [[NSNotificationCenter defaultCenter] | |
| 46 removeObserver:self | |
| 47 name:NSWindowDidBecomeMainNotification | |
| 48 object:[self window]]; | |
| 49 [[NSNotificationCenter defaultCenter] | |
| 50 removeObserver:self | |
| 51 name:NSWindowDidResignMainNotification | |
| 52 object:[self window]]; | |
| 53 } | |
| 54 if (window) { | |
| 55 [[NSNotificationCenter defaultCenter] | |
| 56 addObserver:self | |
| 57 selector:@selector(windowFocusDidChange:) | |
| 58 name:NSWindowDidBecomeMainNotification | |
| 59 object:window]; | |
| 60 [[NSNotificationCenter defaultCenter] | |
| 61 addObserver:self | |
| 62 selector:@selector(windowFocusDidChange:) | |
| 63 name:NSWindowDidResignMainNotification | |
| 64 object:window]; | |
| 65 } | |
| 66 } | |
| 67 | 44 |
| 68 - (void)windowFocusDidChange:(NSNotification*)notification { | 45 - (void)windowDidChangeTheme { |
| 69 // The theme image may depend on the window's active state. | |
| 70 [self setNeedsDisplay:YES]; | 46 [self setNeedsDisplay:YES]; |
| 71 } | 47 } |
| 72 | 48 |
| 49 - (void)windowDidChangeActive { |
| 50 [self setNeedsDisplay:YES]; |
| 51 } |
| 52 |
| 73 @end | 53 @end |
| OLD | NEW |