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

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: relocate some constants 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 if (increaseContrast) {
366 [[NSColor colorWithCalibratedWhite:kNormalStrokeGray alpha:1] set]; 368 [[NSColor blackColor] set];
369 } else {
370 const CGFloat kNormalStrokeGray = 168 / 255.;
371 [[NSColor colorWithCalibratedWhite:kNormalStrokeGray alpha:1] set];
372 }
367 } else { 373 } else {
368 const CGFloat k30PercentAlpha = 0.3; 374 if (increaseContrast) {
369 [[NSColor colorWithCalibratedWhite:0 alpha:k30PercentAlpha] set]; 375 [[NSColor whiteColor] set];
376 } else {
377 const CGFloat k30PercentAlpha = 0.3;
378 [[NSColor colorWithCalibratedWhite:0 alpha:k30PercentAlpha] set];
379 }
370 } 380 }
371 [path stroke]; 381 [path stroke];
372 382
373 // Draw the interior contents. We do this after drawing the border as some 383 // Draw the interior contents. We do this after drawing the border as some
374 // of the interior controls draw over it. 384 // of the interior controls draw over it.
375 [self drawInteriorWithFrame:frame inView:controlView]; 385 [self drawInteriorWithFrame:frame inView:controlView];
376 386
377 // Draw the focus ring. 387 // Draw the focus ring.
378 if (showingFirstResponder) { 388 if (showingFirstResponder) {
379 CGFloat alphaComponent = 0.5 / singlePixelLineWidth_; 389 CGFloat alphaComponent = 0.5 / singlePixelLineWidth_;
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 738
729 @end 739 @end
730 740
731 @implementation AutocompleteTextFieldCell (TestingAPI) 741 @implementation AutocompleteTextFieldCell (TestingAPI)
732 742
733 - (const std::vector<LocationBarDecoration*>&)mouseTrackingDecorations { 743 - (const std::vector<LocationBarDecoration*>&)mouseTrackingDecorations {
734 return mouseTrackingDecorations_; 744 return mouseTrackingDecorations_;
735 } 745 }
736 746
737 @end 747 @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