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

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

Issue 2687633002: Fix using theme colors for the download shelf's close button. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_view.h ('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) 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_view.h" 5 #import "chrome/browser/ui/cocoa/tabs/tab_view.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/mac/sdk_forward_declarations.h" 9 #include "base/mac/sdk_forward_declarations.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 606
607 - (NSColor*)titleColor { 607 - (NSColor*)titleColor {
608 return [titleView_ textColor]; 608 return [titleView_ textColor];
609 } 609 }
610 610
611 - (void)setTitleColor:(NSColor*)titleColor { 611 - (void)setTitleColor:(NSColor*)titleColor {
612 if ([titleColor isEqual:[titleView_ textColor]]) 612 if ([titleColor isEqual:[titleView_ textColor]])
613 return; 613 return;
614 [titleView_ setTextColor:titleColor]; 614 [titleView_ setTextColor:titleColor];
615 [self setNeedsDisplayInRect:[titleView_ frame]]; 615 [self setNeedsDisplayInRect:[titleView_ frame]];
616 [self updateAppearance];
616 } 617 }
617 618
618 - (BOOL)titleHidden { 619 - (BOOL)titleHidden {
619 return [titleView_ isHidden]; 620 return [titleView_ isHidden];
620 } 621 }
621 622
622 - (void)setTitleHidden:(BOOL)titleHidden { 623 - (void)setTitleHidden:(BOOL)titleHidden {
623 if (titleHidden == [titleView_ isHidden]) 624 if (titleHidden == [titleView_ isHidden])
624 return; 625 return;
625 [titleView_ setHidden:titleHidden]; 626 [titleView_ setHidden:titleHidden];
(...skipping 13 matching lines...) Expand all
639 ? themeProvider->GetColor(ThemeProperties::COLOR_TAB_TEXT) 640 ? themeProvider->GetColor(ThemeProperties::COLOR_TAB_TEXT)
640 : themeProvider->GetColor( 641 : themeProvider->GetColor(
641 ThemeProperties::COLOR_BACKGROUND_TAB_TEXT); 642 ThemeProperties::COLOR_BACKGROUND_TAB_TEXT);
642 return SkColorSetA(titleColor, 0xA0); 643 return SkColorSetA(titleColor, 0xA0);
643 } 644 }
644 645
645 return tabs::kDefaultTabTextColor; 646 return tabs::kDefaultTabTextColor;
646 } 647 }
647 648
648 - (void)accessibilityOptionsDidChange:(id)ignored { 649 - (void)accessibilityOptionsDidChange:(id)ignored {
649 [self updateLabelFont]; 650 [self updateAppearance];
650 [self setNeedsDisplay:YES]; 651 [self setNeedsDisplay:YES];
651 } 652 }
652 653
653 - (void)updateLabelFont { 654 - (void)updateAppearance {
654 CGFloat fontSize = [titleViewCell_ font].pointSize; 655 CGFloat fontSize = [titleViewCell_ font].pointSize;
655 const ui::ThemeProvider* provider = [[self window] themeProvider]; 656 const ui::ThemeProvider* provider = [[self window] themeProvider];
656 if (provider && provider->ShouldIncreaseContrast() && state_ == NSOnState) { 657 if (provider && provider->ShouldIncreaseContrast() && state_ == NSOnState) {
657 [titleViewCell_ setFont:[NSFont boldSystemFontOfSize:fontSize]]; 658 [titleViewCell_ setFont:[NSFont boldSystemFontOfSize:fontSize]];
658 } else { 659 } else {
659 [titleViewCell_ setFont:[NSFont systemFontOfSize:fontSize]]; 660 [titleViewCell_ setFont:[NSFont systemFontOfSize:fontSize]];
660 } 661 }
662
663 [closeButton_ setIconColor:[self iconColor]];
661 } 664 }
662 665
663 - (void)setState:(NSCellStateValue)state { 666 - (void)setState:(NSCellStateValue)state {
664 if (state_ == state) 667 if (state_ == state)
665 return; 668 return;
666 state_ = state; 669 state_ = state;
667 [self updateLabelFont]; 670 [self updateAppearance];
668 [self setNeedsDisplay:YES]; 671 [self setNeedsDisplay:YES];
669 [closeButton_ setNeedsDisplay:YES];
670 } 672 }
671 673
672 - (void)setClosing:(BOOL)closing { 674 - (void)setClosing:(BOOL)closing {
673 closing_ = closing; // Safe because the property is nonatomic. 675 closing_ = closing; // Safe because the property is nonatomic.
674 // When closing, ensure clicks to the close button go nowhere. 676 // When closing, ensure clicks to the close button go nowhere.
675 if (closing) { 677 if (closing) {
676 [closeButton_ setTarget:nil]; 678 [closeButton_ setTarget:nil];
677 [closeButton_ setAction:nil]; 679 [closeButton_ setAction:nil];
678 } 680 }
679 } 681 }
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 1022
1021 // For "Increase Contrast" mode, use flat black instead of semitransparent black 1023 // For "Increase Contrast" mode, use flat black instead of semitransparent black
1022 // for the tab edge stroke. 1024 // for the tab edge stroke.
1023 + (void)setTabEdgeStrokeColor { 1025 + (void)setTabEdgeStrokeColor {
1024 static NSColor* heavyStrokeColor = 1026 static NSColor* heavyStrokeColor =
1025 [skia::SkColorToSRGBNSColor(SK_ColorBLACK) retain]; 1027 [skia::SkColorToSRGBNSColor(SK_ColorBLACK) retain];
1026 [heavyStrokeColor set]; 1028 [heavyStrokeColor set];
1027 } 1029 }
1028 1030
1029 @end 1031 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698