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

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

Issue 2056093002: [Material][Mac] Fix text color in incognito omnibox (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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 bool in_dark_mode = [[field_ window] inIncognitoModeWithSystemTheme]; 581 bool in_dark_mode = [[field_ window] inIncognitoModeWithSystemTheme];
582 582
583 ApplyTextStyle(attributedString); 583 ApplyTextStyle(attributedString);
584 584
585 // A kinda hacky way to add breaking at periods. This is what Safari does. 585 // A kinda hacky way to add breaking at periods. This is what Safari does.
586 // This works for IDNs too, despite the "en_US". 586 // This works for IDNs too, despite the "en_US".
587 [attributedString addAttribute:@"NSLanguage" 587 [attributedString addAttribute:@"NSLanguage"
588 value:@"en_US_POSIX" 588 value:@"en_US_POSIX"
589 range:as_entire_string]; 589 range:as_entire_string];
590 590
591 if (ui::MaterialDesignController::IsModeMaterial()) {
592 [attributedString addAttribute:NSForegroundColorAttributeName
593 value:HostTextColor(in_dark_mode)
594 range:as_entire_string];
595 }
596
591 url::Component scheme, host; 597 url::Component scheme, host;
592 AutocompleteInput::ParseForEmphasizeComponents( 598 AutocompleteInput::ParseForEmphasizeComponents(
593 display_text, ChromeAutocompleteSchemeClassifier(profile_), &scheme, 599 display_text, ChromeAutocompleteSchemeClassifier(profile_), &scheme,
594 &host); 600 &host);
595 bool grey_out_url = display_text.substr(scheme.begin, scheme.len) == 601 bool grey_out_url = display_text.substr(scheme.begin, scheme.len) ==
596 base::UTF8ToUTF16(extensions::kExtensionScheme); 602 base::UTF8ToUTF16(extensions::kExtensionScheme);
597 if (model()->CurrentTextIsURL() && 603 if (model()->CurrentTextIsURL() &&
598 (host.is_nonempty() || grey_out_url)) { 604 (host.is_nonempty() || grey_out_url)) {
599 [attributedString addAttribute:NSForegroundColorAttributeName 605 [attributedString addAttribute:NSForegroundColorAttributeName
600 value:BaseTextColor(in_dark_mode) 606 value:BaseTextColor(in_dark_mode)
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 display_text); 1175 display_text);
1170 NSDictionary* notification_info = @{ 1176 NSDictionary* notification_info = @{
1171 NSAccessibilityAnnouncementKey : announcement, 1177 NSAccessibilityAnnouncementKey : announcement,
1172 NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh) 1178 NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh)
1173 }; 1179 };
1174 NSAccessibilityPostNotificationWithUserInfo( 1180 NSAccessibilityPostNotificationWithUserInfo(
1175 [field_ window], 1181 [field_ window],
1176 NSAccessibilityAnnouncementRequestedNotification, 1182 NSAccessibilityAnnouncementRequestedNotification,
1177 notification_info); 1183 notification_info);
1178 } 1184 }
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