| 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/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 range:NSMakeRange(0, [as length])]; | 649 range:NSMakeRange(0, [as length])]; |
| 650 | 650 |
| 651 [as addAttribute:NSForegroundColorAttributeName | 651 [as addAttribute:NSForegroundColorAttributeName |
| 652 value:[field_ displayedTextColor] | 652 value:[field_ displayedTextColor] |
| 653 range:ComponentToNSRange(host)]; | 653 range:ComponentToNSRange(host)]; |
| 654 | 654 |
| 655 if (scheme.len > 0) { | 655 if (scheme.len > 0) { |
| 656 UIColor* color = nil; | 656 UIColor* color = nil; |
| 657 switch (controller_->GetToolbarModel()->GetSecurityLevel(false)) { | 657 switch (controller_->GetToolbarModel()->GetSecurityLevel(false)) { |
| 658 case security_state::NONE: | 658 case security_state::NONE: |
| 659 case security_state::HTTP_SHOW_WARNING: |
| 659 break; | 660 break; |
| 660 case security_state::SECURITY_WARNING: | 661 case security_state::SECURITY_WARNING: |
| 661 // Don't color strikethrough schemes. See https://crbug.com/635004#c6 | 662 // Don't color strikethrough schemes. See https://crbug.com/635004#c6 |
| 662 if (![field_ incognito]) | 663 if (![field_ incognito]) |
| 663 color = WarningTextColor(); | 664 color = WarningTextColor(); |
| 664 [as addAttribute:NSStrikethroughStyleAttributeName | 665 [as addAttribute:NSStrikethroughStyleAttributeName |
| 665 value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] | 666 value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] |
| 666 range:ComponentToNSRange(scheme)]; | 667 range:ComponentToNSRange(scheme)]; |
| 667 break; | 668 break; |
| 668 case security_state::SECURE: | 669 case security_state::SECURE: |
| 669 case security_state::EV_SECURE: | 670 case security_state::EV_SECURE: |
| 670 color = [field_ incognito] ? IncognitoSecureTextColor() | 671 color = [field_ incognito] ? IncognitoSecureTextColor() |
| 671 : SecureTextColor(); | 672 : SecureTextColor(); |
| 672 break; | 673 break; |
| 673 case security_state::DANGEROUS: | 674 case security_state::DANGEROUS: |
| 674 // Don't color strikethrough schemes. See https://crbug.com/635004#c6 | 675 // Don't color strikethrough schemes. See https://crbug.com/635004#c6 |
| 675 if (![field_ incognito]) | 676 if (![field_ incognito]) |
| 676 color = ErrorTextColor(); | 677 color = ErrorTextColor(); |
| 677 [as addAttribute:NSStrikethroughStyleAttributeName | 678 [as addAttribute:NSStrikethroughStyleAttributeName |
| 678 value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] | 679 value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] |
| 679 range:ComponentToNSRange(scheme)]; | 680 range:ComponentToNSRange(scheme)]; |
| 680 break; | 681 break; |
| 681 case security_state::HTTP_SHOW_WARNING: | |
| 682 case security_state::SECURE_WITH_POLICY_INSTALLED_CERT: | 682 case security_state::SECURE_WITH_POLICY_INSTALLED_CERT: |
| 683 NOTREACHED(); | 683 NOTREACHED(); |
| 684 } | 684 } |
| 685 if (color) { | 685 if (color) { |
| 686 [as addAttribute:NSForegroundColorAttributeName | 686 [as addAttribute:NSForegroundColorAttributeName |
| 687 value:color | 687 value:color |
| 688 range:ComponentToNSRange(scheme)]; | 688 range:ComponentToNSRange(scheme)]; |
| 689 } | 689 } |
| 690 } | 690 } |
| 691 } | 691 } |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 // is being left out for now because it was not present before the OmniboxView | 866 // is being left out for now because it was not present before the OmniboxView |
| 867 // rewrite. | 867 // rewrite. |
| 868 #if 0 | 868 #if 0 |
| 869 // When editing is in progress, the url text is not colored, so there is | 869 // When editing is in progress, the url text is not colored, so there is |
| 870 // nothing to emphasize. (Calling SetText() in that situation would also be | 870 // nothing to emphasize. (Calling SetText() in that situation would also be |
| 871 // harmful, as it would reset the carat position to the end of the text.) | 871 // harmful, as it would reset the carat position to the end of the text.) |
| 872 if (!IsEditingOrEmpty()) | 872 if (!IsEditingOrEmpty()) |
| 873 SetText(GetText()); | 873 SetText(GetText()); |
| 874 #endif | 874 #endif |
| 875 } | 875 } |
| OLD | NEW |