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/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "chrome/browser/autocomplete/autocomplete_provider.h" | 10 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 "history-url", | 118 "history-url", |
119 "history-title", | 119 "history-title", |
120 "history-body", | 120 "history-body", |
121 "history-keyword", | 121 "history-keyword", |
122 "navsuggest", | 122 "navsuggest", |
123 "search-what-you-typed", | 123 "search-what-you-typed", |
124 "search-history", | 124 "search-history", |
125 "search-suggest", | 125 "search-suggest", |
126 "search-other-engine", | 126 "search-other-engine", |
127 "extension-app", | 127 "extension-app", |
| 128 "contact", |
128 }; | 129 }; |
129 COMPILE_ASSERT(arraysize(strings) == NUM_TYPES, | 130 COMPILE_ASSERT(arraysize(strings) == NUM_TYPES, |
130 strings_array_must_match_type_enum); | 131 strings_array_must_match_type_enum); |
131 return strings[type]; | 132 return strings[type]; |
132 } | 133 } |
133 | 134 |
134 // static | 135 // static |
135 int AutocompleteMatch::TypeToIcon(Type type) { | 136 int AutocompleteMatch::TypeToIcon(Type type) { |
136 int icons[] = { | 137 int icons[] = { |
137 IDR_OMNIBOX_HTTP, | 138 IDR_OMNIBOX_HTTP, |
138 IDR_OMNIBOX_HTTP, | 139 IDR_OMNIBOX_HTTP, |
139 IDR_OMNIBOX_HTTP, | 140 IDR_OMNIBOX_HTTP, |
140 IDR_OMNIBOX_HTTP, | 141 IDR_OMNIBOX_HTTP, |
141 IDR_OMNIBOX_HTTP, | 142 IDR_OMNIBOX_HTTP, |
142 IDR_OMNIBOX_HTTP, | 143 IDR_OMNIBOX_HTTP, |
143 IDR_OMNIBOX_SEARCH, | 144 IDR_OMNIBOX_SEARCH, |
144 IDR_OMNIBOX_SEARCH, | 145 IDR_OMNIBOX_SEARCH, |
145 IDR_OMNIBOX_SEARCH, | 146 IDR_OMNIBOX_SEARCH, |
146 IDR_OMNIBOX_SEARCH, | 147 IDR_OMNIBOX_SEARCH, |
147 IDR_OMNIBOX_EXTENSION_APP, | 148 IDR_OMNIBOX_EXTENSION_APP, |
| 149 IDR_OMNIBOX_HTTP, // FIXME |
148 }; | 150 }; |
149 COMPILE_ASSERT(arraysize(icons) == NUM_TYPES, | 151 COMPILE_ASSERT(arraysize(icons) == NUM_TYPES, |
150 icons_array_must_match_type_enum); | 152 icons_array_must_match_type_enum); |
151 return icons[type]; | 153 return icons[type]; |
152 } | 154 } |
153 | 155 |
154 // static | 156 // static |
155 bool AutocompleteMatch::MoreRelevant(const AutocompleteMatch& elem1, | 157 bool AutocompleteMatch::MoreRelevant(const AutocompleteMatch& elem1, |
156 const AutocompleteMatch& elem2) { | 158 const AutocompleteMatch& elem2) { |
157 // For equal-relevance matches, we sort alphabetically, so that providers | 159 // For equal-relevance matches, we sort alphabetically, so that providers |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 << " is unsorted in relation to last offset of " << last_offset | 351 << " is unsorted in relation to last offset of " << last_offset |
350 << ". Provider: " << (provider ? provider->name() : "None") << "."; | 352 << ". Provider: " << (provider ? provider->name() : "None") << "."; |
351 DCHECK_LT(i->offset, text.length()) | 353 DCHECK_LT(i->offset, text.length()) |
352 << " Classification of [" << i->offset << "," << text.length() | 354 << " Classification of [" << i->offset << "," << text.length() |
353 << "] is out of bounds for \"" << text << "\". Provider: " | 355 << "] is out of bounds for \"" << text << "\". Provider: " |
354 << (provider ? provider->name() : "None") << "."; | 356 << (provider ? provider->name() : "None") << "."; |
355 last_offset = i->offset; | 357 last_offset = i->offset; |
356 } | 358 } |
357 } | 359 } |
358 #endif | 360 #endif |
OLD | NEW |