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

Unified Diff: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm

Issue 1680773006: Implement Material Design for Mac toolbar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@md_master
Patch Set: Change button hover and pressed styles. Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
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..86303014acea83a5152c4932743979a40ed20563 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,31 @@ 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
+ }];
+}
+
// 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

Powered by Google App Engine
This is Rietveld 408576698