| 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 int AutocompleteMatch::TypeToLocationBarIcon(Type type) { | 179 int AutocompleteMatch::TypeToLocationBarIcon(Type type) { |
| 178 int id = TypeToIcon(type); | 180 int id = TypeToIcon(type); |
| 179 if (id == IDR_OMNIBOX_HTTP) | 181 if (id == IDR_OMNIBOX_HTTP) |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 << " is unsorted in relation to last offset of " << last_offset | 464 << " is unsorted in relation to last offset of " << last_offset |
| 463 << ". Provider: " << provider_name << "."; | 465 << ". Provider: " << provider_name << "."; |
| 464 DCHECK_LT(i->offset, text.length()) | 466 DCHECK_LT(i->offset, text.length()) |
| 465 << " Classification of [" << i->offset << "," << text.length() | 467 << " Classification of [" << i->offset << "," << text.length() |
| 466 << "] is out of bounds for \"" << text << "\". Provider: " | 468 << "] is out of bounds for \"" << text << "\". Provider: " |
| 467 << provider_name << "."; | 469 << provider_name << "."; |
| 468 last_offset = i->offset; | 470 last_offset = i->offset; |
| 469 } | 471 } |
| 470 } | 472 } |
| 471 #endif | 473 #endif |
| OLD | NEW |