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

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

Issue 2102853002: [Mac][Material Design] Adjust (i) and lock Omnibox icons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: 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 | « chrome/browser/ui/cocoa/location_bar/ev_bubble_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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 break; 166 break;
167 default: 167 default:
168 // Make it obvious that there's a problem. 168 // Make it obvious that there's a problem.
169 [[NSColor redColor] set]; 169 [[NSColor redColor] set];
170 NSRectFill(NSMakeRect(0, 0, kDefaultIconSize, kDefaultIconSize)); 170 NSRectFill(NSMakeRect(0, 0, kDefaultIconSize, kDefaultIconSize));
171 break; 171 break;
172 } 172 }
173 } 173 }
174 174
175 + (void)drawLocationBarIconHTTPForScale:(int)scaleFactor { 175 + (void)drawLocationBarIconHTTPForScale:(int)scaleFactor {
176 NSBezierPath* circlePath = 176 if (scaleFactor > 1) {
177 [NSBezierPath bezierPathWithOvalInRect:NSMakeRect(2, 2, 12, 12)]; 177 NSRect ovalRect = NSMakeRect(2.25, 1.75, 12, 12);
178 [circlePath setLineWidth:1.5]; 178 NSBezierPath* circlePath =
179 [circlePath stroke]; 179 [NSBezierPath bezierPathWithOvalInRect:ovalRect];
180 [circlePath setLineWidth:1.5];
181 [circlePath stroke];
180 182
181 NSRectFill(NSMakeRect(7, 4, 2, 5)); 183 NSRectFill(NSMakeRect(7.5, 4.5, 1.5, 4));
182 NSRectFill(NSMakeRect(7, 10, 2, 2)); 184 NSRectFill(NSMakeRect(7.5, 9.5, 1.5, 1.5));
185 } else {
186 NSRect ovalRect = NSMakeRect(2, 2, 12, 12);
187 NSBezierPath* circlePath =
188 [NSBezierPath bezierPathWithOvalInRect:ovalRect];
189 [circlePath setLineWidth:1.5];
190 [circlePath stroke];
191
192 NSRectFill(NSMakeRect(7, 4, 2, 5));
193 NSRectFill(NSMakeRect(7, 10, 2, 2));
194 }
183 } 195 }
184 196
185 + (void)drawLocationBarIconHTTPSInvalidForScale:(int)scaleFactor { 197 + (void)drawLocationBarIconHTTPSInvalidForScale:(int)scaleFactor {
186 // The vector icon is upside down relative to the default OS X coordinate 198 // The vector icon is upside down relative to the default OS X coordinate
187 // system so rotate by 180 degrees. 199 // system so rotate by 180 degrees.
188 CGContextRef context = static_cast<CGContextRef>( 200 CGContextRef context = static_cast<CGContextRef>(
189 [[NSGraphicsContext currentContext] graphicsPort]); 201 [[NSGraphicsContext currentContext] graphicsPort]);
190 const int kHalfDefaultIconSize = kDefaultIconSize / 2; 202 const int kHalfDefaultIconSize = kDefaultIconSize / 2;
191 CGContextTranslateCTM(context, kHalfDefaultIconSize, kHalfDefaultIconSize); 203 CGContextTranslateCTM(context, kHalfDefaultIconSize, kHalfDefaultIconSize);
192 CGContextRotateCTM(context, M_PI); 204 CGContextRotateCTM(context, M_PI);
(...skipping 22 matching lines...) Expand all
215 [cutOutPath relativeLineToPoint:NSMakePoint(0, -3)]; 227 [cutOutPath relativeLineToPoint:NSMakePoint(0, -3)];
216 [cutOutPath relativeLineToPoint:NSMakePoint(2, 0)]; 228 [cutOutPath relativeLineToPoint:NSMakePoint(2, 0)];
217 [cutOutPath relativeLineToPoint:NSMakePoint(0, 3)]; 229 [cutOutPath relativeLineToPoint:NSMakePoint(0, 3)];
218 [cutOutPath closePath]; 230 [cutOutPath closePath];
219 231
220 [trianglePath appendBezierPath:cutOutPath]; 232 [trianglePath appendBezierPath:cutOutPath];
221 [trianglePath fill]; 233 [trianglePath fill];
222 } 234 }
223 235
224 + (void)drawLocationBarIconHTTPSValidForScale:(int)scaleFactor { 236 + (void)drawLocationBarIconHTTPSValidForScale:(int)scaleFactor {
237 NSAffineTransform* transform = [NSAffineTransform transform];
238 // Adjust down 1px in Retina, so that the lock sits on the text baseline.
239 if (scaleFactor > 1) {
240 [transform translateXBy:0 yBy:-0.5];
241 }
242
225 NSBezierPath* rectPath = 243 NSBezierPath* rectPath =
226 [NSBezierPath bezierPathWithRoundedRect:NSMakeRect(4, 3, 8, 7) 244 [NSBezierPath bezierPathWithRoundedRect:NSMakeRect(4, 3, 8, 7)
227 xRadius:1 245 xRadius:1
228 yRadius:1]; 246 yRadius:1];
247 [rectPath transformUsingAffineTransform:transform];
229 [rectPath fill]; 248 [rectPath fill];
230 249
231 NSBezierPath* curvePath = [NSBezierPath bezierPath]; 250 NSBezierPath* curvePath = [NSBezierPath bezierPath];
232 [curvePath moveToPoint:NSMakePoint(5.5, 9.75)]; 251 [curvePath moveToPoint:NSMakePoint(5.5, 9.75)];
233 [curvePath lineToPoint:NSMakePoint(5.5, 10)]; 252 [curvePath lineToPoint:NSMakePoint(5.5, 10)];
234 [curvePath curveToPoint:NSMakePoint(8, 13) 253 [curvePath curveToPoint:NSMakePoint(8, 13)
235 controlPoint1:NSMakePoint(5.5, 13) 254 controlPoint1:NSMakePoint(5.5, 13)
236 controlPoint2:NSMakePoint(7.5, 13)]; 255 controlPoint2:NSMakePoint(7.5, 13)];
237 [curvePath curveToPoint:NSMakePoint(10.5, 10) 256 [curvePath curveToPoint:NSMakePoint(10.5, 10)
238 controlPoint1:NSMakePoint(8.5, 13) 257 controlPoint1:NSMakePoint(8.5, 13)
239 controlPoint2:NSMakePoint(10.5, 13)]; 258 controlPoint2:NSMakePoint(10.5, 13)];
240 [curvePath lineToPoint:NSMakePoint(10.5, 9.75)]; 259 [curvePath lineToPoint:NSMakePoint(10.5, 9.75)];
241 [curvePath setLineWidth:1.25]; 260 [curvePath setLineWidth:1.25];
261 [curvePath transformUsingAffineTransform:transform];
242 [curvePath stroke]; 262 [curvePath stroke];
243 } 263 }
244 264
245 @end 265 @end
246 266
247 // TODO(shess): This code is mostly copied from the gtk 267 // TODO(shess): This code is mostly copied from the gtk
248 // implementation. Make sure it's all appropriate and flesh it out. 268 // implementation. Make sure it's all appropriate and flesh it out.
249 269
250 LocationBarViewMac::LocationBarViewMac(AutocompleteTextField* field, 270 LocationBarViewMac::LocationBarViewMac(AutocompleteTextField* field,
251 CommandUpdater* command_updater, 271 CommandUpdater* command_updater,
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 992
973 return zoom_decoration_->UpdateIfNecessary( 993 return zoom_decoration_->UpdateIfNecessary(
974 ui_zoom::ZoomController::FromWebContents(web_contents), 994 ui_zoom::ZoomController::FromWebContents(web_contents),
975 default_zoom_changed, IsLocationBarDark()); 995 default_zoom_changed, IsLocationBarDark());
976 } 996 }
977 997
978 void LocationBarViewMac::OnDefaultZoomLevelChanged() { 998 void LocationBarViewMac::OnDefaultZoomLevelChanged() {
979 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) 999 if (UpdateZoomDecoration(/*default_zoom_changed=*/true))
980 OnDecorationsChanged(); 1000 OnDecorationsChanged();
981 } 1001 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698