Chromium Code Reviews| 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 "ios/chrome/browser/ui/omnibox/omnibox_view_ios.h" | 5 #include "ios/chrome/browser/ui/omnibox/omnibox_view_ios.h" |
| 6 | 6 |
| 7 #import <CoreText/CoreText.h> | 7 #import <CoreText/CoreText.h> |
| 8 #import <MobileCoreServices/MobileCoreServices.h> | 8 #import <MobileCoreServices/MobileCoreServices.h> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 664 | 664 |
| 665 if ((security_level == security_state::NONE) || | 665 if ((security_level == security_state::NONE) || |
| 666 (security_level == security_state::HTTP_SHOW_WARNING)) { | 666 (security_level == security_state::HTTP_SHOW_WARNING)) { |
| 667 return; | 667 return; |
| 668 } | 668 } |
| 669 | 669 |
| 670 DCHECK_NE(security_state::SECURITY_WARNING, security_level); | 670 DCHECK_NE(security_state::SECURITY_WARNING, security_level); |
| 671 DCHECK_NE(security_state::SECURE_WITH_POLICY_INSTALLED_CERT, security_level); | 671 DCHECK_NE(security_state::SECURE_WITH_POLICY_INSTALLED_CERT, security_level); |
| 672 | 672 |
| 673 if (security_level == security_state::DANGEROUS) { | 673 if (security_level == security_state::DANGEROUS) { |
| 674 // Workaround: Add an attribute to allow strikethough to apply on iOS 10.3. | |
|
rohitrao (ping after 24h)
2017/04/06 14:51:21
Should we only apply this attribute if running on
| |
| 675 // See https://crbug.com/699702 for discussion. | |
| 676 [attributing_display_string_ | |
| 677 addAttribute:NSBaselineOffsetAttributeName | |
| 678 value:@0 | |
| 679 range:NSMakeRange(0, [attributing_display_string_ length])]; | |
| 680 | |
| 674 // Add a strikethrough through the scheme. | 681 // Add a strikethrough through the scheme. |
| 675 [attributing_display_string_ | 682 [attributing_display_string_ |
| 676 addAttribute:NSStrikethroughStyleAttributeName | 683 addAttribute:NSStrikethroughStyleAttributeName |
| 677 value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] | 684 value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] |
| 678 range:range.ToNSRange()]; | 685 range:range.ToNSRange()]; |
| 679 } | 686 } |
| 680 | 687 |
| 681 UIColor* color = GetSecureTextColor(security_level, [field_ incognito]); | 688 UIColor* color = GetSecureTextColor(security_level, [field_ incognito]); |
| 682 if (color) { | 689 if (color) { |
| 683 [attributing_display_string_ addAttribute:NSForegroundColorAttributeName | 690 [attributing_display_string_ addAttribute:NSForegroundColorAttributeName |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 873 // is being left out for now because it was not present before the OmniboxView | 880 // is being left out for now because it was not present before the OmniboxView |
| 874 // rewrite. | 881 // rewrite. |
| 875 #if 0 | 882 #if 0 |
| 876 // When editing is in progress, the url text is not colored, so there is | 883 // When editing is in progress, the url text is not colored, so there is |
| 877 // nothing to emphasize. (Calling SetText() in that situation would also be | 884 // nothing to emphasize. (Calling SetText() in that situation would also be |
| 878 // harmful, as it would reset the carat position to the end of the text.) | 885 // harmful, as it would reset the carat position to the end of the text.) |
| 879 if (!IsEditingOrEmpty()) | 886 if (!IsEditingOrEmpty()) |
| 880 SetText(GetText()); | 887 SetText(GetText()); |
| 881 #endif | 888 #endif |
| 882 } | 889 } |
| OLD | NEW |