| 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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 } else if (security_level == | 587 } else if (security_level == |
| 588 security_state::SecurityStateModel::SECURITY_WARNING) { | 588 security_state::SecurityStateModel::SECURITY_WARNING) { |
| 589 color = SecurityWarningSchemeColor(inDarkMode); | 589 color = SecurityWarningSchemeColor(inDarkMode); |
| 590 } else { | 590 } else { |
| 591 NOTREACHED(); | 591 NOTREACHED(); |
| 592 color = BaseTextColor(inDarkMode); | 592 color = BaseTextColor(inDarkMode); |
| 593 } | 593 } |
| 594 [attributedString addAttribute:NSForegroundColorAttributeName | 594 [attributedString addAttribute:NSForegroundColorAttributeName |
| 595 value:color | 595 value:color |
| 596 range:ComponentToNSRange(scheme)]; | 596 range:ComponentToNSRange(scheme)]; |
| 597 } else if (as_length) { | |
| 598 [attributedString addAttribute:NSForegroundColorAttributeName | |
| 599 value:BaseTextColor(inDarkMode) | |
| 600 range:as_entire_string]; | |
| 601 } | 597 } |
| 602 } | 598 } |
| 603 | 599 |
| 604 void OmniboxViewMac::OnTemporaryTextMaybeChanged( | 600 void OmniboxViewMac::OnTemporaryTextMaybeChanged( |
| 605 const base::string16& display_text, | 601 const base::string16& display_text, |
| 606 bool save_original_selection, | 602 bool save_original_selection, |
| 607 bool notify_text_changed) { | 603 bool notify_text_changed) { |
| 608 if (save_original_selection) | 604 if (save_original_selection) |
| 609 saved_temporary_selection_ = GetSelectedRange(); | 605 saved_temporary_selection_ = GetSelectedRange(); |
| 610 | 606 |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1101 | 1097 |
| 1102 NSUInteger OmniboxViewMac::GetTextLength() const { | 1098 NSUInteger OmniboxViewMac::GetTextLength() const { |
| 1103 return [field_ currentEditor] ? [[[field_ currentEditor] string] length] : | 1099 return [field_ currentEditor] ? [[[field_ currentEditor] string] length] : |
| 1104 [[field_ stringValue] length]; | 1100 [[field_ stringValue] length]; |
| 1105 } | 1101 } |
| 1106 | 1102 |
| 1107 bool OmniboxViewMac::IsCaretAtEnd() const { | 1103 bool OmniboxViewMac::IsCaretAtEnd() const { |
| 1108 const NSRange selection = GetSelectedRange(); | 1104 const NSRange selection = GetSelectedRange(); |
| 1109 return NSMaxRange(selection) == GetTextLength(); | 1105 return NSMaxRange(selection) == GetTextLength(); |
| 1110 } | 1106 } |
| OLD | NEW |