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/autocomplete/autocomplete_match.h" | 5 #include "chrome/browser/autocomplete/autocomplete_match.h" |
6 | 6 |
7 #include "base/i18n/time_formatting.h" | 7 #include "base/i18n/time_formatting.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 "history-title", | 137 "history-title", |
138 "history-body", | 138 "history-body", |
139 "history-keyword", | 139 "history-keyword", |
140 "navsuggest", | 140 "navsuggest", |
141 "search-what-you-typed", | 141 "search-what-you-typed", |
142 "search-history", | 142 "search-history", |
143 "search-suggest", | 143 "search-suggest", |
144 "search-other-engine", | 144 "search-other-engine", |
145 "extension-app", | 145 "extension-app", |
146 "contact", | 146 "contact", |
| 147 "bookmark-title", |
147 }; | 148 }; |
148 COMPILE_ASSERT(arraysize(strings) == NUM_TYPES, | 149 COMPILE_ASSERT(arraysize(strings) == NUM_TYPES, |
149 strings_array_must_match_type_enum); | 150 strings_array_must_match_type_enum); |
150 return strings[type]; | 151 return strings[type]; |
151 } | 152 } |
152 | 153 |
153 // static | 154 // static |
154 int AutocompleteMatch::TypeToIcon(Type type) { | 155 int AutocompleteMatch::TypeToIcon(Type type) { |
155 int icons[] = { | 156 int icons[] = { |
156 IDR_OMNIBOX_HTTP, | 157 IDR_OMNIBOX_HTTP, |
157 IDR_OMNIBOX_HTTP, | 158 IDR_OMNIBOX_HTTP, |
158 IDR_OMNIBOX_HTTP, | 159 IDR_OMNIBOX_HTTP, |
159 IDR_OMNIBOX_HTTP, | 160 IDR_OMNIBOX_HTTP, |
160 IDR_OMNIBOX_HTTP, | 161 IDR_OMNIBOX_HTTP, |
161 IDR_OMNIBOX_HTTP, | 162 IDR_OMNIBOX_HTTP, |
162 IDR_OMNIBOX_SEARCH, | 163 IDR_OMNIBOX_SEARCH, |
163 IDR_OMNIBOX_SEARCH, | 164 IDR_OMNIBOX_SEARCH, |
164 IDR_OMNIBOX_SEARCH, | 165 IDR_OMNIBOX_SEARCH, |
165 IDR_OMNIBOX_SEARCH, | 166 IDR_OMNIBOX_SEARCH, |
166 IDR_OMNIBOX_EXTENSION_APP, | 167 IDR_OMNIBOX_EXTENSION_APP, |
167 // ContactProvider isn't used by the omnibox, so this icon is never | 168 // ContactProvider isn't used by the omnibox, so this icon is never |
168 // displayed. | 169 // displayed. |
169 IDR_OMNIBOX_SEARCH, | 170 IDR_OMNIBOX_SEARCH, |
| 171 IDR_OMNIBOX_HTTP, |
170 }; | 172 }; |
171 COMPILE_ASSERT(arraysize(icons) == NUM_TYPES, | 173 COMPILE_ASSERT(arraysize(icons) == NUM_TYPES, |
172 icons_array_must_match_type_enum); | 174 icons_array_must_match_type_enum); |
173 return icons[type]; | 175 return icons[type]; |
174 } | 176 } |
175 | 177 |
176 // static | 178 // static |
177 bool AutocompleteMatch::MoreRelevant(const AutocompleteMatch& elem1, | 179 bool AutocompleteMatch::MoreRelevant(const AutocompleteMatch& elem1, |
178 const AutocompleteMatch& elem2) { | 180 const AutocompleteMatch& elem2) { |
179 // For equal-relevance matches, we sort alphabetically, so that providers | 181 // For equal-relevance matches, we sort alphabetically, so that providers |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 << " is unsorted in relation to last offset of " << last_offset | 450 << " is unsorted in relation to last offset of " << last_offset |
449 << ". Provider: " << provider_name << "."; | 451 << ". Provider: " << provider_name << "."; |
450 DCHECK_LT(i->offset, text.length()) | 452 DCHECK_LT(i->offset, text.length()) |
451 << " Classification of [" << i->offset << "," << text.length() | 453 << " Classification of [" << i->offset << "," << text.length() |
452 << "] is out of bounds for \"" << text << "\". Provider: " | 454 << "] is out of bounds for \"" << text << "\". Provider: " |
453 << provider_name << "."; | 455 << provider_name << "."; |
454 last_offset = i->offset; | 456 last_offset = i->offset; |
455 } | 457 } |
456 } | 458 } |
457 #endif | 459 #endif |
OLD | NEW |