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

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

Issue 2710003003: omnibox: use dark border stroke in Increase Contrast mode (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 | « 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 (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/location_bar/autocomplete_text_field_cell.h" 5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 354
355 // Fill the background. 355 // Fill the background.
356 [[self backgroundColor] set]; 356 [[self backgroundColor] set];
357 if (isPopupMode_) { 357 if (isPopupMode_) {
358 NSRectFillUsingOperation(NSInsetRect(frame, 1, 1), NSCompositeSourceOver); 358 NSRectFillUsingOperation(NSInsetRect(frame, 1, 1), NSCompositeSourceOver);
359 } else { 359 } else {
360 [path fill]; 360 [path fill];
361 } 361 }
362 362
363 // Draw the border. 363 // Draw the border.
364 const ui::ThemeProvider* provider = [[controlView window] themeProvider];
365 bool increaseContrast = provider && provider->ShouldIncreaseContrast();
364 if (!inDarkMode) { 366 if (!inDarkMode) {
365 const CGFloat kNormalStrokeGray = 168 / 255.; 367 const CGFloat kNormalStrokeGray = 168 / 255.;
Mark Mentovai 2017/02/23 01:57:28 Scope tightly to where it’s used, inside the else
Elly Fong-Jones 2017/02/23 17:32:16 Done.
366 [[NSColor colorWithCalibratedWhite:kNormalStrokeGray alpha:1] set]; 368 if (increaseContrast)
369 [[NSColor blackColor] set];
370 else
371 [[NSColor colorWithCalibratedWhite:kNormalStrokeGray alpha:1] set];
367 } else { 372 } else {
368 const CGFloat k30PercentAlpha = 0.3; 373 const CGFloat k30PercentAlpha = 0.3;
Mark Mentovai 2017/02/23 01:57:28 Me too.
Elly Fong-Jones 2017/02/23 17:32:16 Done.
369 [[NSColor colorWithCalibratedWhite:0 alpha:k30PercentAlpha] set]; 374 if (increaseContrast)
375 [[NSColor whiteColor] set];
376 else
377 [[NSColor colorWithCalibratedWhite:0 alpha:k30PercentAlpha] set];
370 } 378 }
Mark Mentovai 2017/02/23 01:57:28 Not required, but consider factoring the -set out
Elly Fong-Jones 2017/02/23 17:32:16 I thought about doing this but I don't think it's
371 [path stroke]; 379 [path stroke];
372 380
373 // Draw the interior contents. We do this after drawing the border as some 381 // Draw the interior contents. We do this after drawing the border as some
374 // of the interior controls draw over it. 382 // of the interior controls draw over it.
375 [self drawInteriorWithFrame:frame inView:controlView]; 383 [self drawInteriorWithFrame:frame inView:controlView];
376 384
377 // Draw the focus ring. 385 // Draw the focus ring.
378 if (showingFirstResponder) { 386 if (showingFirstResponder) {
379 CGFloat alphaComponent = 0.5 / singlePixelLineWidth_; 387 CGFloat alphaComponent = 0.5 / singlePixelLineWidth_;
380 if (inDarkMode) { 388 if (inDarkMode) {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 736
729 @end 737 @end
730 738
731 @implementation AutocompleteTextFieldCell (TestingAPI) 739 @implementation AutocompleteTextFieldCell (TestingAPI)
732 740
733 - (const std::vector<LocationBarDecoration*>&)mouseTrackingDecorations { 741 - (const std::vector<LocationBarDecoration*>&)mouseTrackingDecorations {
734 return mouseTrackingDecorations_; 742 return mouseTrackingDecorations_;
735 } 743 }
736 744
737 @end 745 @end
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