Chromium Code Reviews| Index: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm |
| diff --git a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm |
| index 33fbafada12f324a28644c25b1e305aba2f03a69..11fd0544395eb399031cc60b891639efbd271d60 100644 |
| --- a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm |
| +++ b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm |
| @@ -7,6 +7,7 @@ |
| #include "base/strings/string_util.h" |
| #include "base/strings/sys_string_conversions.h" |
| #include "chrome/app/chrome_command_ids.h" // IDC_* |
| +#include "chrome/browser/themes/theme_service.h" |
| #include "chrome/browser/ui/browser_list.h" |
| #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" |
| @@ -15,6 +16,7 @@ |
| #include "chrome/grit/generated_resources.h" |
| #import "ui/base/cocoa/find_pasteboard.h" |
| #include "ui/base/l10n/l10n_util_mac.h" |
| +#include "ui/base/material_design/material_design_controller.h" |
| namespace { |
| @@ -67,6 +69,30 @@ BOOL ThePasteboardIsTooDamnBig() { |
| return self; |
| } |
| +- (void)viewDidMoveToWindow { |
| + // Only care about landing in a window when in Material Design mode. |
| + if (![self window] || !ui::MaterialDesignController::IsModeMaterial()) { |
| + return; |
| + } |
| + |
| + // Only care about Incognito mode with a non-custom theme. |
| + if (![[self window] inIncognitoModeWithSystemTheme]) { |
| + return; |
| + } |
| + |
| + // Draw a light insertion point for MD Incognito. |
| + [self setInsertionPointColor: |
| + [NSColor colorWithCalibratedWhite:1 alpha:0.75]]; |
| + // In MD Incognito the text is light gray against a dark background. When |
| + // selected, the light gray text against the selection color is illegible. |
| + // Rather than tweak or change the selection color, make the text black when |
| + // selected. |
| + NSColor* textSelectionColor = [NSColor selectedTextBackgroundColor]; |
| + [self setSelectedTextAttributes: |
| + @{NSForegroundColorAttributeName : [NSColor blackColor], |
| + NSBackgroundColorAttributeName : textSelectionColor}]; |
|
Avi (use Gerrit)
2016/03/01 19:59:06
This isn't quite the container literal style that
shrike
2016/03/01 20:30:14
Acknowledged. Thank you. I think it's correct now,
|
| +} |
| + |
| // If the entire field is selected, drag the same data as would be |
| // dragged from the field's location icon. In some cases the textual |
| // contents will not contain relevant data (for instance, "http://" is |