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

Side by Side Diff: chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm

Issue 2017103002: [Material][Mac] Removed "single color while editing text" behavior (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" 5 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h"
6 6
7 #include <Carbon/Carbon.h> // kVK_Return 7 #include <Carbon/Carbon.h> // kVK_Return
8 8
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 bool in_dark_mode = [[field_ window] inIncognitoModeWithSystemTheme]; 574 bool in_dark_mode = [[field_ window] inIncognitoModeWithSystemTheme];
575 575
576 ApplyTextStyle(attributedString); 576 ApplyTextStyle(attributedString);
577 577
578 // A kinda hacky way to add breaking at periods. This is what Safari does. 578 // A kinda hacky way to add breaking at periods. This is what Safari does.
579 // This works for IDNs too, despite the "en_US". 579 // This works for IDNs too, despite the "en_US".
580 [attributedString addAttribute:@"NSLanguage" 580 [attributedString addAttribute:@"NSLanguage"
581 value:@"en_US_POSIX" 581 value:@"en_US_POSIX"
582 range:as_entire_string]; 582 range:as_entire_string];
583 583
584 // Under Material Design, force the text to be a single color white editing.
585 if (ui::MaterialDesignController::IsModeMaterial() &&
586 [field_ currentEditor]) {
587 [attributedString addAttribute:NSForegroundColorAttributeName
588 value:HostTextColor(in_dark_mode)
589 range:as_entire_string];
590 return;
591 }
592
593 url::Component scheme, host; 584 url::Component scheme, host;
594 AutocompleteInput::ParseForEmphasizeComponents( 585 AutocompleteInput::ParseForEmphasizeComponents(
595 display_text, ChromeAutocompleteSchemeClassifier(profile_), &scheme, 586 display_text, ChromeAutocompleteSchemeClassifier(profile_), &scheme,
596 &host); 587 &host);
597 bool grey_out_url = display_text.substr(scheme.begin, scheme.len) == 588 bool grey_out_url = display_text.substr(scheme.begin, scheme.len) ==
598 base::UTF8ToUTF16(extensions::kExtensionScheme); 589 base::UTF8ToUTF16(extensions::kExtensionScheme);
599 if (model()->CurrentTextIsURL() && 590 if (model()->CurrentTextIsURL() &&
600 (host.is_nonempty() || grey_out_url)) { 591 (host.is_nonempty() || grey_out_url)) {
601 [attributedString addAttribute:NSForegroundColorAttributeName 592 [attributedString addAttribute:NSForegroundColorAttributeName
602 value:BaseTextColor(in_dark_mode) 593 value:BaseTextColor(in_dark_mode)
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 display_text); 1152 display_text);
1162 NSDictionary* notification_info = @{ 1153 NSDictionary* notification_info = @{
1163 NSAccessibilityAnnouncementKey : announcement, 1154 NSAccessibilityAnnouncementKey : announcement,
1164 NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh) 1155 NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh)
1165 }; 1156 };
1166 NSAccessibilityPostNotificationWithUserInfo( 1157 NSAccessibilityPostNotificationWithUserInfo(
1167 [field_ window], 1158 [field_ window],
1168 NSAccessibilityAnnouncementRequestedNotification, 1159 NSAccessibilityAnnouncementRequestedNotification,
1169 notification_info); 1160 notification_info);
1170 } 1161 }
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