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/property_bag.h" | 9 #include "base/property_bag.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // From the autocomplete popup, or the star icon at the RHS of the | 138 // From the autocomplete popup, or the star icon at the RHS of the |
139 // text field. | 139 // text field. |
140 case IDR_STAR: image_name = @"star.pdf"; break; | 140 case IDR_STAR: image_name = @"star.pdf"; break; |
141 case IDR_STAR_LIT: image_name = @"star_lit.pdf"; break; | 141 case IDR_STAR_LIT: image_name = @"star_lit.pdf"; break; |
142 | 142 |
143 // Values from |AutocompleteMatch::TypeToIcon()|. | 143 // Values from |AutocompleteMatch::TypeToIcon()|. |
144 case IDR_OMNIBOX_SEARCH: | 144 case IDR_OMNIBOX_SEARCH: |
145 image_name = @"omnibox_search.pdf"; break; | 145 image_name = @"omnibox_search.pdf"; break; |
146 case IDR_OMNIBOX_HTTP: | 146 case IDR_OMNIBOX_HTTP: |
147 image_name = @"omnibox_http.pdf"; break; | 147 image_name = @"omnibox_http.pdf"; break; |
148 case IDR_OMNIBOX_HISTORY: | |
149 image_name = @"omnibox_history.pdf"; break; | |
150 case IDR_OMNIBOX_EXTENSION_APP: | 148 case IDR_OMNIBOX_EXTENSION_APP: |
151 image_name = @"omnibox_extension_app.pdf"; break; | 149 image_name = @"omnibox_extension_app.pdf"; break; |
152 | 150 |
153 // Values from |ToolbarModel::GetIcon()|. | 151 // Values from |ToolbarModel::GetIcon()|. |
154 case IDR_OMNIBOX_HTTPS_VALID: | 152 case IDR_OMNIBOX_HTTPS_VALID: |
155 image_name = @"omnibox_https_valid.pdf"; break; | 153 image_name = @"omnibox_https_valid.pdf"; break; |
156 case IDR_OMNIBOX_HTTPS_WARNING: | 154 case IDR_OMNIBOX_HTTPS_WARNING: |
157 image_name = @"omnibox_https_warning.pdf"; break; | 155 image_name = @"omnibox_https_warning.pdf"; break; |
158 case IDR_OMNIBOX_HTTPS_INVALID: | 156 case IDR_OMNIBOX_HTTPS_INVALID: |
159 image_name = @"omnibox_https_invalid.pdf"; break; | 157 image_name = @"omnibox_https_invalid.pdf"; break; |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 | 1121 |
1124 void OmniboxViewMac::PlaceCaretAt(NSUInteger pos) { | 1122 void OmniboxViewMac::PlaceCaretAt(NSUInteger pos) { |
1125 DCHECK(pos <= GetTextLength()); | 1123 DCHECK(pos <= GetTextLength()); |
1126 SetSelectedRange(NSMakeRange(pos, pos)); | 1124 SetSelectedRange(NSMakeRange(pos, pos)); |
1127 } | 1125 } |
1128 | 1126 |
1129 bool OmniboxViewMac::IsCaretAtEnd() const { | 1127 bool OmniboxViewMac::IsCaretAtEnd() const { |
1130 const NSRange selection = GetSelectedRange(); | 1128 const NSRange selection = GetSelectedRange(); |
1131 return selection.length == 0 && selection.location == GetTextLength(); | 1129 return selection.length == 0 && selection.location == GetTextLength(); |
1132 } | 1130 } |
OLD | NEW |