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

Side by Side Diff: chrome/browser/cocoa/tab_view.mm

Issue 3152014: Merge 55906 - [Mac] Fix aesthetic issues with themes given the new TopChrome ... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/472/src/
Patch Set: Created 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/cocoa/tab_strip_view.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/cocoa/tab_view.h" 5 #import "chrome/browser/cocoa/tab_view.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #import "base/mac_util.h" 8 #import "base/mac_util.h"
9 #include "base/nsimage_cache_mac.h" 9 #include "base/nsimage_cache_mac.h"
10 #include "base/scoped_cftyperef.h" 10 #include "base/scoped_cftyperef.h"
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 619
620 - (void)drawRect:(NSRect)dirtyRect { 620 - (void)drawRect:(NSRect)dirtyRect {
621 // If this tab is phantom, do not draw the tab background itself. The only UI 621 // If this tab is phantom, do not draw the tab background itself. The only UI
622 // element that will represent this tab is the favicon. 622 // element that will represent this tab is the favicon.
623 if ([controller_ phantom]) 623 if ([controller_ phantom])
624 return; 624 return;
625 625
626 NSGraphicsContext* context = [NSGraphicsContext currentContext]; 626 NSGraphicsContext* context = [NSGraphicsContext currentContext];
627 [context saveGraphicsState]; 627 [context saveGraphicsState];
628 628
629 ThemeProvider* themeProvider = [[self window] themeProvider]; 629 BrowserThemeProvider* themeProvider =
630 static_cast<BrowserThemeProvider*>([[self window] themeProvider]);
630 [context setPatternPhase:[[self window] themePatternPhase]]; 631 [context setPatternPhase:[[self window] themePatternPhase]];
631 632
632 NSRect rect = [self bounds]; 633 NSRect rect = [self bounds];
633 NSBezierPath* path = [self bezierPathForRect:rect]; 634 NSBezierPath* path = [self bezierPathForRect:rect];
634 635
635 BOOL selected = [self state]; 636 BOOL selected = [self state];
636 // Don't draw the window/tab bar background when selected, since the tab 637 // Don't draw the window/tab bar background when selected, since the tab
637 // background overlay drawn over it (see below) will be fully opaque. 638 // background overlay drawn over it (see below) will be fully opaque.
638 BOOL hasBackgroundImage = NO; 639 BOOL hasBackgroundImage = NO;
639 if (!selected) { 640 if (!selected) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 } 709 }
709 } 710 }
710 711
711 CGContextEndTransparencyLayer(cgContext); 712 CGContextEndTransparencyLayer(cgContext);
712 [context restoreGraphicsState]; 713 [context restoreGraphicsState];
713 } 714 }
714 715
715 BOOL active = [[self window] isKeyWindow] || [[self window] isMainWindow]; 716 BOOL active = [[self window] isKeyWindow] || [[self window] isMainWindow];
716 CGFloat borderAlpha = selected ? (active ? 0.3 : 0.2) : 0.2; 717 CGFloat borderAlpha = selected ? (active ? 0.3 : 0.2) : 0.2;
717 NSColor* borderColor = [NSColor colorWithDeviceWhite:0.0 alpha:borderAlpha]; 718 NSColor* borderColor = [NSColor colorWithDeviceWhite:0.0 alpha:borderAlpha];
718 NSColor* highlightColor = [NSColor colorWithCalibratedWhite:0.96 alpha:1.0]; 719 NSColor* highlightColor = themeProvider ? themeProvider->GetNSColor(
720 themeProvider->UsingDefaultTheme() ?
721 BrowserThemeProvider::COLOR_TOOLBAR_BEZEL :
722 BrowserThemeProvider::COLOR_TOOLBAR, true) : nil;
719 723
720 // Draw the top inner highlight within the currently selected tab. 724 // Draw the top inner highlight within the currently selected tab if using
721 if (selected) { 725 // the default theme.
726 if (selected && themeProvider && themeProvider->UsingDefaultTheme()) {
722 NSAffineTransform* highlightTransform = [NSAffineTransform transform]; 727 NSAffineTransform* highlightTransform = [NSAffineTransform transform];
723 [highlightTransform translateXBy:1.0 yBy:-1.0]; 728 [highlightTransform translateXBy:1.0 yBy:-1.0];
724 scoped_nsobject<NSBezierPath> highlightPath([path copy]); 729 scoped_nsobject<NSBezierPath> highlightPath([path copy]);
725 [highlightPath transformUsingAffineTransform:highlightTransform]; 730 [highlightPath transformUsingAffineTransform:highlightTransform];
726 [highlightColor setStroke]; 731 [highlightColor setStroke];
727 [highlightPath setLineWidth:1.0]; 732 [highlightPath setLineWidth:1.0];
728 [highlightPath stroke]; 733 [highlightPath stroke];
729 highlightTransform = [NSAffineTransform transform]; 734 highlightTransform = [NSAffineTransform transform];
730 [highlightTransform translateXBy:-2.0 yBy:0.0]; 735 [highlightTransform translateXBy:-2.0 yBy:0.0];
731 [highlightPath transformUsingAffineTransform:highlightTransform]; 736 [highlightPath transformUsingAffineTransform:highlightTransform];
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 controlPoint1:NSMakePoint(topRight.x + bottomControlPointInset, 1037 controlPoint1:NSMakePoint(topRight.x + bottomControlPointInset,
1033 topRight.y) 1038 topRight.y)
1034 controlPoint2:NSMakePoint(bottomRight.x - baseControlPointOutset, 1039 controlPoint2:NSMakePoint(bottomRight.x - baseControlPointOutset,
1035 bottomRight.y)]; 1040 bottomRight.y)];
1036 [path lineToPoint:NSMakePoint(bottomRight.x + 1, bottomRight.y)]; 1041 [path lineToPoint:NSMakePoint(bottomRight.x + 1, bottomRight.y)];
1037 [path lineToPoint:NSMakePoint(bottomRight.x + 1, bottomRight.y - 2)]; 1042 [path lineToPoint:NSMakePoint(bottomRight.x + 1, bottomRight.y - 2)];
1038 return path; 1043 return path;
1039 } 1044 }
1040 1045
1041 @end // @implementation TabView(Private) 1046 @end // @implementation TabView(Private)
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/tab_strip_view.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698