| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_editor.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" |
| 6 | 6 |
| 7 #include "base/mac/sdk_forward_declarations.h" | 7 #include "base/mac/sdk_forward_declarations.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" // IDC_* | 10 #include "chrome/app/chrome_command_ids.h" // IDC_* |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 } | 77 } |
| 78 return self; | 78 return self; |
| 79 } | 79 } |
| 80 | 80 |
| 81 - (void)updateColorsToMatchTheme { | 81 - (void)updateColorsToMatchTheme { |
| 82 if (![[self window] inIncognitoMode]) { | 82 if (![[self window] inIncognitoMode]) { |
| 83 return; | 83 return; |
| 84 } | 84 } |
| 85 | 85 |
| 86 bool inDarkMode = [[self window] inIncognitoModeWithSystemTheme]; | 86 bool inDarkMode = [[self window] inIncognitoModeWithSystemTheme]; |
| 87 // Draw a light insertion point for MD Incognito. | 87 // Draw a white insertion point for MD Incognito. |
| 88 NSColor* insertionPointColor = | 88 NSColor* insertionPointColor = |
| 89 inDarkMode ? [NSColor colorWithCalibratedWhite:1 alpha:0.75] | 89 inDarkMode ? [NSColor whiteColor] : [NSColor blackColor]; |
| 90 : [NSColor blackColor]; | |
| 91 [self setInsertionPointColor:insertionPointColor]; | 90 [self setInsertionPointColor:insertionPointColor]; |
| 92 | 91 |
| 93 NSColor* textSelectionColor = [NSColor selectedTextBackgroundColor]; | 92 NSColor* textSelectionColor = [NSColor selectedTextBackgroundColor]; |
| 94 if (inDarkMode) { | 93 if (inDarkMode) { |
| 95 // In MD Incognito the text is light gray against a dark background. When | 94 // In MD Incognito the text is light gray against a dark background. When |
| 96 // selected, the light gray text against the selection color is illegible. | 95 // selected, the light gray text against the selection color is illegible. |
| 97 // Rather than tweak or change the selection color, make the text black when | 96 // Rather than tweak or change the selection color, make the text black when |
| 98 // selected. | 97 // selected. |
| 99 [self setSelectedTextAttributes:@{ | 98 [self setSelectedTextAttributes:@{ |
| 100 NSForegroundColorAttributeName : [NSColor blackColor], | 99 NSForegroundColorAttributeName : [NSColor blackColor], |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 if (!ui::MaterialDesignController::IsModeMaterial()) { | 608 if (!ui::MaterialDesignController::IsModeMaterial()) { |
| 610 return; | 609 return; |
| 611 } | 610 } |
| 612 [self updateColorsToMatchTheme]; | 611 [self updateColorsToMatchTheme]; |
| 613 } | 612 } |
| 614 | 613 |
| 615 - (void)windowDidChangeActive { | 614 - (void)windowDidChangeActive { |
| 616 } | 615 } |
| 617 | 616 |
| 618 @end | 617 @end |
| OLD | NEW |