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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 "history-url", | 125 "history-url", |
126 "history-title", | 126 "history-title", |
127 "history-body", | 127 "history-body", |
128 "history-keyword", | 128 "history-keyword", |
129 "navsuggest", | 129 "navsuggest", |
130 "search-what-you-typed", | 130 "search-what-you-typed", |
131 "search-history", | 131 "search-history", |
132 "search-suggest", | 132 "search-suggest", |
133 "search-other-engine", | 133 "search-other-engine", |
134 "extension-app", | 134 "extension-app", |
| 135 "contact", |
135 }; | 136 }; |
136 COMPILE_ASSERT(arraysize(strings) == NUM_TYPES, | 137 COMPILE_ASSERT(arraysize(strings) == NUM_TYPES, |
137 strings_array_must_match_type_enum); | 138 strings_array_must_match_type_enum); |
138 return strings[type]; | 139 return strings[type]; |
139 } | 140 } |
140 | 141 |
141 // static | 142 // static |
142 int AutocompleteMatch::TypeToIcon(Type type) { | 143 int AutocompleteMatch::TypeToIcon(Type type) { |
143 int icons[] = { | 144 int icons[] = { |
144 IDR_OMNIBOX_HTTP, | 145 IDR_OMNIBOX_HTTP, |
145 IDR_OMNIBOX_HTTP, | 146 IDR_OMNIBOX_HTTP, |
146 IDR_OMNIBOX_HTTP, | 147 IDR_OMNIBOX_HTTP, |
147 IDR_OMNIBOX_HTTP, | 148 IDR_OMNIBOX_HTTP, |
148 IDR_OMNIBOX_HTTP, | 149 IDR_OMNIBOX_HTTP, |
149 IDR_OMNIBOX_HTTP, | 150 IDR_OMNIBOX_HTTP, |
150 IDR_OMNIBOX_SEARCH, | 151 IDR_OMNIBOX_SEARCH, |
151 IDR_OMNIBOX_SEARCH, | 152 IDR_OMNIBOX_SEARCH, |
152 IDR_OMNIBOX_SEARCH, | 153 IDR_OMNIBOX_SEARCH, |
153 IDR_OMNIBOX_SEARCH, | 154 IDR_OMNIBOX_SEARCH, |
154 IDR_OMNIBOX_EXTENSION_APP, | 155 IDR_OMNIBOX_EXTENSION_APP, |
| 156 IDR_OMNIBOX_SEARCH, |
155 }; | 157 }; |
156 COMPILE_ASSERT(arraysize(icons) == NUM_TYPES, | 158 COMPILE_ASSERT(arraysize(icons) == NUM_TYPES, |
157 icons_array_must_match_type_enum); | 159 icons_array_must_match_type_enum); |
158 return icons[type]; | 160 return icons[type]; |
159 } | 161 } |
160 | 162 |
161 // static | 163 // static |
162 bool AutocompleteMatch::MoreRelevant(const AutocompleteMatch& elem1, | 164 bool AutocompleteMatch::MoreRelevant(const AutocompleteMatch& elem1, |
163 const AutocompleteMatch& elem2) { | 165 const AutocompleteMatch& elem2) { |
164 // For equal-relevance matches, we sort alphabetically, so that providers | 166 // For equal-relevance matches, we sort alphabetically, so that providers |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 << " is unsorted in relation to last offset of " << last_offset | 376 << " is unsorted in relation to last offset of " << last_offset |
375 << ". Provider: " << (provider ? provider->name() : "None") << "."; | 377 << ". Provider: " << (provider ? provider->name() : "None") << "."; |
376 DCHECK_LT(i->offset, text.length()) | 378 DCHECK_LT(i->offset, text.length()) |
377 << " Classification of [" << i->offset << "," << text.length() | 379 << " Classification of [" << i->offset << "," << text.length() |
378 << "] is out of bounds for \"" << text << "\". Provider: " | 380 << "] is out of bounds for \"" << text << "\". Provider: " |
379 << (provider ? provider->name() : "None") << "."; | 381 << (provider ? provider->name() : "None") << "."; |
380 last_offset = i->offset; | 382 last_offset = i->offset; |
381 } | 383 } |
382 } | 384 } |
383 #endif | 385 #endif |
OLD | NEW |