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

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

Issue 2108193004: [Material][Mac] Fixed HTTP and HTTPS icons in dark mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: removed extra icon Created 4 years, 5 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 | « no previous file | 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 - (void)dealloc { 115 - (void)dealloc {
116 [fillColor_ release]; 116 [fillColor_ release];
117 [super dealloc]; 117 [super dealloc];
118 } 118 }
119 119
120 + (NSImage*)imageForId:(gfx::VectorIconId)vectorIconId 120 + (NSImage*)imageForId:(gfx::VectorIconId)vectorIconId
121 color:(SkColor)vectorIconColor { 121 color:(SkColor)vectorIconColor {
122 if (vectorIconId != gfx::VectorIconId::LOCATION_BAR_HTTP && 122 if (vectorIconId != gfx::VectorIconId::LOCATION_BAR_HTTP &&
123 vectorIconId != gfx::VectorIconId::LOCATION_BAR_HTTPS_INVALID && 123 vectorIconId != gfx::VectorIconId::LOCATION_BAR_HTTPS_INVALID &&
124 vectorIconId != gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID) { 124 vectorIconId != gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID &&
125 vectorIconId != gfx::VectorIconId::LOCATION_BAR_HTTPS_INVALID_INVERT &&
126 vectorIconId != gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID_INVERT) {
125 return NSImageFromImageSkiaWithColorSpace( 127 return NSImageFromImageSkiaWithColorSpace(
126 gfx::CreateVectorIcon(vectorIconId, kDefaultIconSize, vectorIconColor), 128 gfx::CreateVectorIcon(vectorIconId, kDefaultIconSize, vectorIconColor),
127 base::mac::GetSRGBColorSpace()); 129 base::mac::GetSRGBColorSpace());
128 } 130 }
129 131
130 base::scoped_nsobject<LocationBarImageRep> imageRep = 132 base::scoped_nsobject<LocationBarImageRep> imageRep =
131 [[LocationBarImageRep alloc] 133 [[LocationBarImageRep alloc]
132 initWithDrawSelector:@selector(drawLocationBarIcon:) 134 initWithDrawSelector:@selector(drawLocationBarIcon:)
133 delegate:[LocationBarImageRep class]]; 135 delegate:[LocationBarImageRep class]];
134 [imageRep setIconId:vectorIconId]; 136 [imageRep setIconId:vectorIconId];
(...skipping 17 matching lines...) Expand all
152 [[NSGraphicsContext currentContext] graphicsPort]); 154 [[NSGraphicsContext currentContext] graphicsPort]);
153 CGRect unitRect = CGRectMake(0.0, 0.0, 1.0, 1.0); 155 CGRect unitRect = CGRectMake(0.0, 0.0, 1.0, 1.0);
154 CGRect deviceRect = CGContextConvertRectToDeviceSpace(context, unitRect); 156 CGRect deviceRect = CGContextConvertRectToDeviceSpace(context, unitRect);
155 int scaleFactor = deviceRect.size.height; 157 int scaleFactor = deviceRect.size.height;
156 158
157 switch ([imageRep iconId]) { 159 switch ([imageRep iconId]) {
158 case gfx::VectorIconId::LOCATION_BAR_HTTP: 160 case gfx::VectorIconId::LOCATION_BAR_HTTP:
159 [self drawLocationBarIconHTTPForScale:scaleFactor]; 161 [self drawLocationBarIconHTTPForScale:scaleFactor];
160 break; 162 break;
161 case gfx::VectorIconId::LOCATION_BAR_HTTPS_INVALID: 163 case gfx::VectorIconId::LOCATION_BAR_HTTPS_INVALID:
164 case gfx::VectorIconId::LOCATION_BAR_HTTPS_INVALID_INVERT:
162 [self drawLocationBarIconHTTPSInvalidForScale:scaleFactor]; 165 [self drawLocationBarIconHTTPSInvalidForScale:scaleFactor];
163 break; 166 break;
167 case gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID_INVERT:
164 case gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID: 168 case gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID:
165 [self drawLocationBarIconHTTPSValidForScale:scaleFactor]; 169 [self drawLocationBarIconHTTPSValidForScale:scaleFactor];
166 break; 170 break;
167 default: 171 default:
168 // Make it obvious that there's a problem. 172 // Make it obvious that there's a problem.
169 [[NSColor redColor] set]; 173 [[NSColor redColor] set];
170 NSRectFill(NSMakeRect(0, 0, kDefaultIconSize, kDefaultIconSize)); 174 NSRectFill(NSMakeRect(0, 0, kDefaultIconSize, kDefaultIconSize));
171 break; 175 break;
172 } 176 }
173 } 177 }
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 992
989 return zoom_decoration_->UpdateIfNecessary( 993 return zoom_decoration_->UpdateIfNecessary(
990 ui_zoom::ZoomController::FromWebContents(web_contents), 994 ui_zoom::ZoomController::FromWebContents(web_contents),
991 default_zoom_changed, IsLocationBarDark()); 995 default_zoom_changed, IsLocationBarDark());
992 } 996 }
993 997
994 void LocationBarViewMac::OnDefaultZoomLevelChanged() { 998 void LocationBarViewMac::OnDefaultZoomLevelChanged() {
995 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) 999 if (UpdateZoomDecoration(/*default_zoom_changed=*/true))
996 OnDecorationsChanged(); 1000 OnDecorationsChanged();
997 } 1001 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698