| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |