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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm

Issue 2083813005: [Material][Mac] Update the incognito vector icon color to white (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comment 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
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/location_bar_decoration.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/location_bar/location_bar_view_mac.h" 5 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #import "base/mac/mac_util.h" 9 #import "base/mac/mac_util.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 namespace { 82 namespace {
83 83
84 // Vertical space between the bottom edge of the location_bar and the first run 84 // Vertical space between the bottom edge of the location_bar and the first run
85 // bubble arrow point. 85 // bubble arrow point.
86 const static int kFirstRunBubbleYOffset = 1; 86 const static int kFirstRunBubbleYOffset = 1;
87 87
88 const int kDefaultIconSize = 16; 88 const int kDefaultIconSize = 16;
89 89
90 // Color of the vector graphic icons when the location bar is dark. 90 // Color of the vector graphic icons when the location bar is dark.
91 // SkColorSetARGB(0xCC, 0xFF, 0xFF 0xFF); 91 // SkColorSetARGB(0xCC, 0xFF, 0xFF 0xFF);
92 const SkColor kMaterialDarkVectorIconColor = 0xCCFFFFFF; 92 const SkColor kMaterialDarkVectorIconColor = SK_ColorWHITE;
93 93
94 } // namespace 94 } // namespace
95 95
96 // A temporary class that draws hardcoded HTTP graphic icons for Material 96 // A temporary class that draws hardcoded HTTP graphic icons for Material
97 // design. This class will be removed once the Material icons are available 97 // design. This class will be removed once the Material icons are available
98 // in M53. 98 // in M53.
99 @interface LocationBarImageRep : NSCustomImageRep 99 @interface LocationBarImageRep : NSCustomImageRep
100 @property(assign, nonatomic) gfx::VectorIconId iconId; 100 @property(assign, nonatomic) gfx::VectorIconId iconId;
101 @property(retain, nonatomic) NSColor* fillColor; 101 @property(retain, nonatomic) NSColor* fillColor;
102 102
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 Update(nullptr); 715 Update(nullptr);
716 } 716 }
717 717
718 void LocationBarViewMac::UpdateLocationIcon() { 718 void LocationBarViewMac::UpdateLocationIcon() {
719 bool in_dark_mode = IsLocationBarDark(); 719 bool in_dark_mode = IsLocationBarDark();
720 720
721 SkColor vector_icon_color = gfx::kPlaceholderColor; 721 SkColor vector_icon_color = gfx::kPlaceholderColor;
722 gfx::VectorIconId vector_icon_id = gfx::VectorIconId::VECTOR_ICON_NONE; 722 gfx::VectorIconId vector_icon_id = gfx::VectorIconId::VECTOR_ICON_NONE;
723 if (ShouldShowEVBubble()) { 723 if (ShouldShowEVBubble()) {
724 vector_icon_id = gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID; 724 vector_icon_id = gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID;
725 vector_icon_color = in_dark_mode 725 vector_icon_color = gfx::kGoogleGreen700;
726 ? LocationBarDecoration::kMaterialDarkModeTextColor
727 : gfx::kGoogleGreen700;
728 } else { 726 } else {
729 vector_icon_id = omnibox_view_->GetVectorIcon(); 727 vector_icon_id = omnibox_view_->GetVectorIcon();
730 if (in_dark_mode) { 728 security_state::SecurityStateModel::SecurityLevel security_level =
731 vector_icon_color = LocationBarDecoration::kMaterialDarkModeTextColor; 729 GetToolbarModel()->GetSecurityLevel(false);
730 if (security_level == security_state::SecurityStateModel::NONE) {
731 vector_icon_color = gfx::kChromeIconGrey;
732 } else { 732 } else {
733 security_state::SecurityStateModel::SecurityLevel security_level = 733 NSColor* sRGBColor =
734 GetToolbarModel()->GetSecurityLevel(false); 734 OmniboxViewMac::GetSecureTextColor(security_level, in_dark_mode);
735 if (security_level == security_state::SecurityStateModel::NONE) { 735 NSColor* deviceColor =
736 vector_icon_color = OmniboxViewMac::BaseTextColorSkia(in_dark_mode); 736 [sRGBColor colorUsingColorSpace:[NSColorSpace deviceRGBColorSpace]];
737 } else { 737 vector_icon_color = skia::NSDeviceColorToSkColor(deviceColor);
738 NSColor* sRGBColor =
739 OmniboxViewMac::GetSecureTextColor(security_level, in_dark_mode);
740 NSColor* deviceColor =
741 [sRGBColor colorUsingColorSpace:[NSColorSpace deviceRGBColorSpace]];
742 vector_icon_color = skia::NSDeviceColorToSkColor(deviceColor);
743 }
744 } 738 }
745 } 739 }
746 740
741 // If the theme is dark, then the color should always be
742 // kMaterialDarkVectorIconColor.
743 if (in_dark_mode)
744 vector_icon_color = kMaterialDarkVectorIconColor;
745
747 DCHECK(vector_icon_id != gfx::VectorIconId::VECTOR_ICON_NONE); 746 DCHECK(vector_icon_id != gfx::VectorIconId::VECTOR_ICON_NONE);
748 NSImage* image = 747 NSImage* image =
749 [LocationBarImageRep imageForId:vector_icon_id color:vector_icon_color]; 748 [LocationBarImageRep imageForId:vector_icon_id color:vector_icon_color];
750 749
751 location_icon_decoration_->SetImage(image); 750 location_icon_decoration_->SetImage(image);
752 ev_bubble_decoration_->SetImage(image); 751 ev_bubble_decoration_->SetImage(image);
753 Layout(); 752 Layout();
754 } 753 }
755 754
756 void LocationBarViewMac::UpdateColorsToMatchTheme() { 755 void LocationBarViewMac::UpdateColorsToMatchTheme() {
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 968
970 return zoom_decoration_->UpdateIfNecessary( 969 return zoom_decoration_->UpdateIfNecessary(
971 zoom::ZoomController::FromWebContents(web_contents), default_zoom_changed, 970 zoom::ZoomController::FromWebContents(web_contents), default_zoom_changed,
972 IsLocationBarDark()); 971 IsLocationBarDark());
973 } 972 }
974 973
975 void LocationBarViewMac::OnDefaultZoomLevelChanged() { 974 void LocationBarViewMac::OnDefaultZoomLevelChanged() {
976 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) 975 if (UpdateZoomDecoration(/*default_zoom_changed=*/true))
977 OnDecorationsChanged(); 976 OnDecorationsChanged();
978 } 977 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/location_bar_decoration.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698