| 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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 | 597 |
| 598 // TODO(shess): GTK has this as a member var, figure out why. | 598 // TODO(shess): GTK has this as a member var, figure out why. |
| 599 // [Could it be to not change if no change? If so, I'm guessing | 599 // [Could it be to not change if no change? If so, I'm guessing |
| 600 // AppKit may already handle that.] | 600 // AppKit may already handle that.] |
| 601 const security_state::SecurityStateModel::SecurityLevel security_level = | 601 const security_state::SecurityStateModel::SecurityLevel security_level = |
| 602 controller()->GetToolbarModel()->GetSecurityLevel(false); | 602 controller()->GetToolbarModel()->GetSecurityLevel(false); |
| 603 | 603 |
| 604 // Emphasize the scheme for security UI display purposes (if necessary). | 604 // Emphasize the scheme for security UI display purposes (if necessary). |
| 605 if (!model()->user_input_in_progress() && model()->CurrentTextIsURL() && | 605 if (!model()->user_input_in_progress() && model()->CurrentTextIsURL() && |
| 606 scheme.is_nonempty() && | 606 scheme.is_nonempty() && |
| 607 (security_level != security_state::SecurityStateModel::NONE)) { | 607 (security_level != security_state::SecurityStateModel::NONE) && |
| 608 (security_level != |
| 609 security_state::SecurityStateModel::HTTP_SHOW_WARNING)) { |
| 608 if (security_level == security_state::SecurityStateModel::DANGEROUS) { | 610 if (security_level == security_state::SecurityStateModel::DANGEROUS) { |
| 609 // Add a strikethrough through the scheme. | 611 // Add a strikethrough through the scheme. |
| 610 [attributedString addAttribute:NSStrikethroughStyleAttributeName | 612 [attributedString addAttribute:NSStrikethroughStyleAttributeName |
| 611 value:[NSNumber numberWithInt:NSUnderlineStyleSingle] | 613 value:[NSNumber numberWithInt:NSUnderlineStyleSingle] |
| 612 range:ComponentToNSRange(scheme)]; | 614 range:ComponentToNSRange(scheme)]; |
| 613 } | 615 } |
| 614 [attributedString | 616 [attributedString |
| 615 addAttribute:NSForegroundColorAttributeName | 617 addAttribute:NSForegroundColorAttributeName |
| 616 value:GetSecureTextColor(security_level, in_dark_mode) | 618 value:GetSecureTextColor(security_level, in_dark_mode) |
| 617 range:ComponentToNSRange(scheme)]; | 619 range:ComponentToNSRange(scheme)]; |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 display_text); | 1114 display_text); |
| 1113 NSDictionary* notification_info = @{ | 1115 NSDictionary* notification_info = @{ |
| 1114 NSAccessibilityAnnouncementKey : announcement, | 1116 NSAccessibilityAnnouncementKey : announcement, |
| 1115 NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh) | 1117 NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh) |
| 1116 }; | 1118 }; |
| 1117 NSAccessibilityPostNotificationWithUserInfo( | 1119 NSAccessibilityPostNotificationWithUserInfo( |
| 1118 [field_ window], | 1120 [field_ window], |
| 1119 NSAccessibilityAnnouncementRequestedNotification, | 1121 NSAccessibilityAnnouncementRequestedNotification, |
| 1120 notification_info); | 1122 notification_info); |
| 1121 } | 1123 } |
| OLD | NEW |