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

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_strip_view.mm

Issue 2087893002: [cocoa] increase tab strip contrast in "Increase Contrast" mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix 10.9 detection & themeless windows Created 4 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_view.h" 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h"
6 6
7 #include <cmath> // floor 7 #include <cmath> // floor
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 BOOL focused = [window isMainWindow]; 76 BOOL focused = [window isMainWindow];
77 NSDrawThreePartImage(borderRect, nil, image, nil, /*vertical=*/ NO, 77 NSDrawThreePartImage(borderRect, nil, image, nil, /*vertical=*/ NO,
78 NSCompositeSourceOver, 78 NSCompositeSourceOver,
79 focused ? 1.0 : tabs::kImageNoFocusAlpha, 79 focused ? 1.0 : tabs::kImageNoFocusAlpha,
80 /*flipped=*/ NO); 80 /*flipped=*/ NO);
81 } 81 }
82 82
83 return; 83 return;
84 } 84 }
85 85
86 NSColor* strokeColor;
86 if (themeProvider->HasCustomImage(IDR_THEME_TOOLBAR) || 87 if (themeProvider->HasCustomImage(IDR_THEME_TOOLBAR) ||
87 themeProvider->HasCustomColor(ThemeProperties::COLOR_TOOLBAR)) { 88 themeProvider->HasCustomColor(ThemeProperties::COLOR_TOOLBAR)) {
88 // First draw the toolbar bitmap, so that theme colors can shine through. 89 // First draw the toolbar bitmap, so that theme colors can shine through.
89 NSRect backgroundRect = [self bounds]; 90 NSRect backgroundRect = [self bounds];
90 backgroundRect.size.height = [self cr_lineWidth]; 91 backgroundRect.size.height = [self cr_lineWidth];
91 if (NSIntersectsRect(backgroundRect, dirtyRect)) { 92 if (NSIntersectsRect(backgroundRect, dirtyRect)) {
92 [self drawBackground:backgroundRect]; 93 [self drawBackground:backgroundRect];
93 } 94 }
94 95
95 // Pre-MD the IDR_TOOLBAR_SHADE_TOP image would lay down a light highlight 96 // Pre-MD the IDR_TOOLBAR_SHADE_TOP image would lay down a light highlight
96 // which helped dark toolbars stand out from dark frames. Lay down a thin 97 // which helped dark toolbars stand out from dark frames. Lay down a thin
97 // highlight in MD also. 98 // highlight in MD also.
98 if ([window isMainWindow]) { 99 if ([window isMainWindow]) {
99 [themeProvider->GetNSColor( 100 strokeColor = themeProvider->GetNSColor(
100 ThemeProperties::COLOR_TOOLBAR_STROKE_THEME) set]; 101 ThemeProperties::COLOR_TOOLBAR_STROKE_THEME);
101 } else { 102 } else {
102 [themeProvider->GetNSColor( 103 strokeColor = themeProvider->GetNSColor(
103 ThemeProperties::COLOR_TOOLBAR_STROKE_THEME_INACTIVE) set]; 104 ThemeProperties::COLOR_TOOLBAR_STROKE_THEME_INACTIVE);
104 } 105 }
105 } else { 106 } else {
106 [themeProvider->GetNSColor(ThemeProperties::COLOR_TOOLBAR_STROKE) set]; 107 strokeColor =
108 themeProvider->GetNSColor(ThemeProperties::COLOR_TOOLBAR_STROKE);
107 } 109 }
110
111 if (themeProvider->ShouldIncreaseContrast())
112 strokeColor = [strokeColor colorWithAlphaComponent:100];
113 [strokeColor set];
114
108 NSRect borderRect = NSMakeRect(0.0, 0.0, self.bounds.size.width, 115 NSRect borderRect = NSMakeRect(0.0, 0.0, self.bounds.size.width,
109 [self cr_lineWidth]); 116 [self cr_lineWidth]);
110 NSRectFillUsingOperation(NSIntersectionRect(dirtyRect, borderRect), 117 NSRectFillUsingOperation(NSIntersectionRect(dirtyRect, borderRect),
111 NSCompositeSourceOver); 118 NSCompositeSourceOver);
112 } 119 }
113 120
114 - (void)drawRect:(NSRect)dirtyRect { 121 - (void)drawRect:(NSRect)dirtyRect {
115 const ui::ThemeProvider* themeProvider = [[self window] themeProvider]; 122 const ui::ThemeProvider* themeProvider = [[self window] themeProvider];
116 bool hasCustomThemeImage = themeProvider && 123 bool hasCustomThemeImage = themeProvider &&
117 themeProvider->HasCustomImage(IDR_THEME_FRAME); 124 themeProvider->HasCustomImage(IDR_THEME_FRAME);
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 } else { 425 } else {
419 [visualEffectView setState:NSVisualEffectStateFollowsWindowActiveState]; 426 [visualEffectView setState:NSVisualEffectStateFollowsWindowActiveState];
420 } 427 }
421 } 428 }
422 429
423 - (void)windowDidChangeActive { 430 - (void)windowDidChangeActive {
424 [self setNeedsDisplay:YES]; 431 [self setNeedsDisplay:YES];
425 } 432 }
426 433
427 @end 434 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/download/background_theme.mm ('k') | chrome/browser/ui/cocoa/tabs/tab_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698