OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/omnibox/autocomplete_match.h" | 5 #include "components/omnibox/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/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
147 IDR_OMNIBOX_SEARCH, | 147 IDR_OMNIBOX_SEARCH, |
148 IDR_OMNIBOX_SEARCH, | 148 IDR_OMNIBOX_SEARCH, |
149 IDR_OMNIBOX_SEARCH, | 149 IDR_OMNIBOX_SEARCH, |
150 IDR_OMNIBOX_SEARCH, | 150 IDR_OMNIBOX_SEARCH, |
151 IDR_OMNIBOX_SEARCH, | 151 IDR_OMNIBOX_SEARCH, |
152 IDR_OMNIBOX_SEARCH, | 152 IDR_OMNIBOX_SEARCH, |
153 IDR_OMNIBOX_EXTENSION_APP, | 153 IDR_OMNIBOX_EXTENSION_APP, |
154 IDR_OMNIBOX_SEARCH, | 154 IDR_OMNIBOX_SEARCH, |
155 IDR_OMNIBOX_HTTP, | 155 IDR_OMNIBOX_HTTP, |
156 IDR_OMNIBOX_HTTP, | 156 IDR_OMNIBOX_HTTP, |
157 IDR_OMNIBOX_SEARCH, | |
groby-ooo-7-16
2014/12/23 20:15:22
Question: Do we still want answers to have a searc
Justin Donnelly
2014/12/23 21:08:40
The icon type will be determined by the existing t
| |
158 }; | 157 }; |
159 COMPILE_ASSERT(arraysize(icons) == AutocompleteMatchType::NUM_TYPES, | 158 COMPILE_ASSERT(arraysize(icons) == AutocompleteMatchType::NUM_TYPES, |
160 icons_array_must_match_type_enum); | 159 icons_array_must_match_type_enum); |
161 return icons[type]; | 160 return icons[type]; |
162 } | 161 } |
163 | 162 |
164 // static | 163 // static |
165 bool AutocompleteMatch::MoreRelevant(const AutocompleteMatch& elem1, | 164 bool AutocompleteMatch::MoreRelevant(const AutocompleteMatch& elem1, |
166 const AutocompleteMatch& elem2) { | 165 const AutocompleteMatch& elem2) { |
167 // For equal-relevance matches, we sort alphabetically, so that providers | 166 // For equal-relevance matches, we sort alphabetically, so that providers |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
322 type == AutocompleteMatchType::SEARCH_SUGGEST || | 321 type == AutocompleteMatchType::SEARCH_SUGGEST || |
323 type == AutocompleteMatchType::SEARCH_OTHER_ENGINE || | 322 type == AutocompleteMatchType::SEARCH_OTHER_ENGINE || |
324 IsSpecializedSearchType(type); | 323 IsSpecializedSearchType(type); |
325 } | 324 } |
326 | 325 |
327 // static | 326 // static |
328 bool AutocompleteMatch::IsSpecializedSearchType(Type type) { | 327 bool AutocompleteMatch::IsSpecializedSearchType(Type type) { |
329 return type == AutocompleteMatchType::SEARCH_SUGGEST_ENTITY || | 328 return type == AutocompleteMatchType::SEARCH_SUGGEST_ENTITY || |
330 type == AutocompleteMatchType::SEARCH_SUGGEST_INFINITE || | 329 type == AutocompleteMatchType::SEARCH_SUGGEST_INFINITE || |
331 type == AutocompleteMatchType::SEARCH_SUGGEST_PERSONALIZED || | 330 type == AutocompleteMatchType::SEARCH_SUGGEST_PERSONALIZED || |
332 type == AutocompleteMatchType::SEARCH_SUGGEST_PROFILE || | 331 type == AutocompleteMatchType::SEARCH_SUGGEST_PROFILE; |
333 type == AutocompleteMatchType::SEARCH_SUGGEST_ANSWER; | |
334 } | 332 } |
335 | 333 |
336 // static | 334 // static |
337 TemplateURL* AutocompleteMatch::GetTemplateURLWithKeyword( | 335 TemplateURL* AutocompleteMatch::GetTemplateURLWithKeyword( |
338 TemplateURLService* template_url_service, | 336 TemplateURLService* template_url_service, |
339 const base::string16& keyword, | 337 const base::string16& keyword, |
340 const std::string& host) { | 338 const std::string& host) { |
341 if (template_url_service == NULL) | 339 if (template_url_service == NULL) |
342 return NULL; | 340 return NULL; |
343 TemplateURL* template_url = keyword.empty() ? | 341 TemplateURL* template_url = keyword.empty() ? |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
537 << " is unsorted in relation to last offset of " << last_offset | 535 << " is unsorted in relation to last offset of " << last_offset |
538 << ". Provider: " << provider_name << "."; | 536 << ". Provider: " << provider_name << "."; |
539 DCHECK_LT(i->offset, text.length()) | 537 DCHECK_LT(i->offset, text.length()) |
540 << " Classification of [" << i->offset << "," << text.length() | 538 << " Classification of [" << i->offset << "," << text.length() |
541 << "] is out of bounds for \"" << text << "\". Provider: " | 539 << "] is out of bounds for \"" << text << "\". Provider: " |
542 << provider_name << "."; | 540 << provider_name << "."; |
543 last_offset = i->offset; | 541 last_offset = i->offset; |
544 } | 542 } |
545 } | 543 } |
546 #endif | 544 #endif |
OLD | NEW |