| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, | 157 IDR_OMNIBOX_SEARCH, |
| 158 }; | 158 }; |
| 159 COMPILE_ASSERT(arraysize(icons) == AutocompleteMatchType::NUM_TYPES, | 159 static_assert(arraysize(icons) == AutocompleteMatchType::NUM_TYPES, |
| 160 icons_array_must_match_type_enum); | 160 "icons array must have NUM_TYPES elements"); |
| 161 return icons[type]; | 161 return icons[type]; |
| 162 } | 162 } |
| 163 | 163 |
| 164 // static | 164 // static |
| 165 bool AutocompleteMatch::MoreRelevant(const AutocompleteMatch& elem1, | 165 bool AutocompleteMatch::MoreRelevant(const AutocompleteMatch& elem1, |
| 166 const AutocompleteMatch& elem2) { | 166 const AutocompleteMatch& elem2) { |
| 167 // For equal-relevance matches, we sort alphabetically, so that providers | 167 // For equal-relevance matches, we sort alphabetically, so that providers |
| 168 // who return multiple elements at the same priority get a "stable" sort | 168 // who return multiple elements at the same priority get a "stable" sort |
| 169 // across multiple updates. | 169 // across multiple updates. |
| 170 return (elem1.relevance == elem2.relevance) ? | 170 return (elem1.relevance == elem2.relevance) ? |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 << " is unsorted in relation to last offset of " << last_offset | 537 << " is unsorted in relation to last offset of " << last_offset |
| 538 << ". Provider: " << provider_name << "."; | 538 << ". Provider: " << provider_name << "."; |
| 539 DCHECK_LT(i->offset, text.length()) | 539 DCHECK_LT(i->offset, text.length()) |
| 540 << " Classification of [" << i->offset << "," << text.length() | 540 << " Classification of [" << i->offset << "," << text.length() |
| 541 << "] is out of bounds for \"" << text << "\". Provider: " | 541 << "] is out of bounds for \"" << text << "\". Provider: " |
| 542 << provider_name << "."; | 542 << provider_name << "."; |
| 543 last_offset = i->offset; | 543 last_offset = i->offset; |
| 544 } | 544 } |
| 545 } | 545 } |
| 546 #endif | 546 #endif |
| OLD | NEW |