| 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/browser/autocomplete_match.h" | 5 #include "components/omnibox/browser/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/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 IDR_OMNIBOX_SEARCH, // SEARCH_SUGGEST_PERSONALIZED | 184 IDR_OMNIBOX_SEARCH, // SEARCH_SUGGEST_PERSONALIZED |
| 185 IDR_OMNIBOX_SEARCH, // SEARCH_SUGGEST_PROFILE | 185 IDR_OMNIBOX_SEARCH, // SEARCH_SUGGEST_PROFILE |
| 186 IDR_OMNIBOX_SEARCH, // SEARCH_OTHER_ENGINE | 186 IDR_OMNIBOX_SEARCH, // SEARCH_OTHER_ENGINE |
| 187 IDR_OMNIBOX_EXTENSION_APP, // EXTENSION_APP | 187 IDR_OMNIBOX_EXTENSION_APP, // EXTENSION_APP |
| 188 IDR_OMNIBOX_SEARCH, // CONTACT_DEPRECATED | 188 IDR_OMNIBOX_SEARCH, // CONTACT_DEPRECATED |
| 189 IDR_OMNIBOX_HTTP, // BOOKMARK_TITLE | 189 IDR_OMNIBOX_HTTP, // BOOKMARK_TITLE |
| 190 IDR_OMNIBOX_HTTP, // NAVSUGGEST_PERSONALIZED | 190 IDR_OMNIBOX_HTTP, // NAVSUGGEST_PERSONALIZED |
| 191 IDR_OMNIBOX_CALCULATOR, // CALCULATOR | 191 IDR_OMNIBOX_CALCULATOR, // CALCULATOR |
| 192 IDR_OMNIBOX_HTTP, // CLIPBOARD | 192 IDR_OMNIBOX_HTTP, // CLIPBOARD |
| 193 IDR_OMNIBOX_SEARCH, // VOICE_SEARCH | 193 IDR_OMNIBOX_SEARCH, // VOICE_SEARCH |
| 194 IDR_OMNIBOX_HTTP, // PHYSICAL_WEB |
| 195 IDR_OMNIBOX_HTTP, // PHYSICAL_WEB_OVERFLOW |
| 194 }; | 196 }; |
| 195 #else | 197 #else |
| 196 static const int kIcons[] = { | 198 static const int kIcons[] = { |
| 197 IDR_OMNIBOX_HTTP, // URL_WHAT_YOU_TYPE | 199 IDR_OMNIBOX_HTTP, // URL_WHAT_YOU_TYPE |
| 198 IDR_OMNIBOX_HISTORY, // HISTORY_URL | 200 IDR_OMNIBOX_HISTORY, // HISTORY_URL |
| 199 IDR_OMNIBOX_HISTORY, // HISTORY_TITLE | 201 IDR_OMNIBOX_HISTORY, // HISTORY_TITLE |
| 200 IDR_OMNIBOX_HISTORY, // HISTORY_BODY | 202 IDR_OMNIBOX_HISTORY, // HISTORY_BODY |
| 201 IDR_OMNIBOX_HISTORY, // HISTORY_KEYWORD | 203 IDR_OMNIBOX_HISTORY, // HISTORY_KEYWORD |
| 202 IDR_OMNIBOX_HTTP, // NAVSUGGEST | 204 IDR_OMNIBOX_HTTP, // NAVSUGGEST |
| 203 IDR_OMNIBOX_SEARCH, // SEARCH_WHAT_YOU_TYPED | 205 IDR_OMNIBOX_SEARCH, // SEARCH_WHAT_YOU_TYPED |
| 204 IDR_OMNIBOX_HISTORY, // SEARCH_HISTORY | 206 IDR_OMNIBOX_HISTORY, // SEARCH_HISTORY |
| 205 IDR_OMNIBOX_SEARCH, // SEARCH_SUGGEST | 207 IDR_OMNIBOX_SEARCH, // SEARCH_SUGGEST |
| 206 IDR_OMNIBOX_SEARCH, // SEARCH_SUGGEST_ENTITY | 208 IDR_OMNIBOX_SEARCH, // SEARCH_SUGGEST_ENTITY |
| 207 IDR_OMNIBOX_SEARCH, // SEARCH_SUGGEST_TAIL | 209 IDR_OMNIBOX_SEARCH, // SEARCH_SUGGEST_TAIL |
| 208 IDR_OMNIBOX_SEARCH, // SEARCH_SUGGEST_PERSONALIZED | 210 IDR_OMNIBOX_SEARCH, // SEARCH_SUGGEST_PERSONALIZED |
| 209 IDR_OMNIBOX_SEARCH, // SEARCH_SUGGEST_PROFILE | 211 IDR_OMNIBOX_SEARCH, // SEARCH_SUGGEST_PROFILE |
| 210 IDR_OMNIBOX_SEARCH, // SEARCH_OTHER_ENGINE | 212 IDR_OMNIBOX_SEARCH, // SEARCH_OTHER_ENGINE |
| 211 IDR_OMNIBOX_EXTENSION_APP, // EXTENSION_APP | 213 IDR_OMNIBOX_EXTENSION_APP, // EXTENSION_APP |
| 212 IDR_OMNIBOX_SEARCH, // CONTACT_DEPRECATED | 214 IDR_OMNIBOX_SEARCH, // CONTACT_DEPRECATED |
| 213 IDR_OMNIBOX_HTTP, // BOOKMARK_TITLE | 215 IDR_OMNIBOX_HTTP, // BOOKMARK_TITLE |
| 214 IDR_OMNIBOX_HTTP, // NAVSUGGEST_PERSONALIZED | 216 IDR_OMNIBOX_HTTP, // NAVSUGGEST_PERSONALIZED |
| 215 IDR_OMNIBOX_CALCULATOR, // CALCULATOR | 217 IDR_OMNIBOX_CALCULATOR, // CALCULATOR |
| 216 IDR_OMNIBOX_HTTP, // CLIPBOARD | 218 IDR_OMNIBOX_HTTP, // CLIPBOARD |
| 217 IDR_OMNIBOX_SEARCH, // VOICE_SEARCH | 219 IDR_OMNIBOX_SEARCH, // VOICE_SEARCH |
| 220 IDR_OMNIBOX_HTTP, // PHYSICAL_WEB |
| 221 IDR_OMNIBOX_HTTP, // PHYSICAL_WEB_OVERFLOW |
| 218 }; | 222 }; |
| 219 #endif | 223 #endif |
| 220 static_assert(arraysize(kIcons) == AutocompleteMatchType::NUM_TYPES, | 224 static_assert(arraysize(kIcons) == AutocompleteMatchType::NUM_TYPES, |
| 221 "icons array must have NUM_TYPES elements"); | 225 "icons array must have NUM_TYPES elements"); |
| 222 return kIcons[type]; | 226 return kIcons[type]; |
| 223 } | 227 } |
| 224 | 228 |
| 225 // static | 229 // static |
| 226 gfx::VectorIconId AutocompleteMatch::TypeToVectorIcon(Type type) { | 230 gfx::VectorIconId AutocompleteMatch::TypeToVectorIcon(Type type) { |
| 227 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 231 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 240 gfx::VectorIconId::OMNIBOX_SEARCH, // SEARCH_SUGGEST_PERSONALIZED | 244 gfx::VectorIconId::OMNIBOX_SEARCH, // SEARCH_SUGGEST_PERSONALIZED |
| 241 gfx::VectorIconId::OMNIBOX_SEARCH, // SEARCH_SUGGEST_PROFILE | 245 gfx::VectorIconId::OMNIBOX_SEARCH, // SEARCH_SUGGEST_PROFILE |
| 242 gfx::VectorIconId::OMNIBOX_SEARCH, // SEARCH_OTHER_ENGINE | 246 gfx::VectorIconId::OMNIBOX_SEARCH, // SEARCH_OTHER_ENGINE |
| 243 gfx::VectorIconId::OMNIBOX_EXTENSION_APP, // EXTENSION_APP | 247 gfx::VectorIconId::OMNIBOX_EXTENSION_APP, // EXTENSION_APP |
| 244 gfx::VectorIconId::OMNIBOX_SEARCH, // CONTACT_DEPRECATED | 248 gfx::VectorIconId::OMNIBOX_SEARCH, // CONTACT_DEPRECATED |
| 245 gfx::VectorIconId::OMNIBOX_HTTP, // BOOKMARK_TITLE | 249 gfx::VectorIconId::OMNIBOX_HTTP, // BOOKMARK_TITLE |
| 246 gfx::VectorIconId::OMNIBOX_HTTP, // NAVSUGGEST_PERSONALIZED | 250 gfx::VectorIconId::OMNIBOX_HTTP, // NAVSUGGEST_PERSONALIZED |
| 247 gfx::VectorIconId::OMNIBOX_CALCULATOR, // CALCULATOR | 251 gfx::VectorIconId::OMNIBOX_CALCULATOR, // CALCULATOR |
| 248 gfx::VectorIconId::OMNIBOX_HTTP, // CLIPBOARD | 252 gfx::VectorIconId::OMNIBOX_HTTP, // CLIPBOARD |
| 249 gfx::VectorIconId::OMNIBOX_SEARCH, // VOICE_SEARCH | 253 gfx::VectorIconId::OMNIBOX_SEARCH, // VOICE_SEARCH |
| 254 gfx::VectorIconId::OMNIBOX_HTTP, // PHYSICAL_WEB |
| 255 gfx::VectorIconId::OMNIBOX_HTTP, // PHYSICAL_WEB_OVERFLOW |
| 250 }; | 256 }; |
| 251 static_assert(arraysize(kIcons) == AutocompleteMatchType::NUM_TYPES, | 257 static_assert(arraysize(kIcons) == AutocompleteMatchType::NUM_TYPES, |
| 252 "icons array must have NUM_TYPES elements"); | 258 "icons array must have NUM_TYPES elements"); |
| 253 return kIcons[type]; | 259 return kIcons[type]; |
| 254 #else | 260 #else |
| 255 NOTREACHED(); | 261 NOTREACHED(); |
| 256 return gfx::VectorIconId::VECTOR_ICON_NONE; | 262 return gfx::VectorIconId::VECTOR_ICON_NONE; |
| 257 #endif | 263 #endif |
| 258 } | 264 } |
| 259 | 265 |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 << " is unsorted in relation to last offset of " << last_offset | 663 << " is unsorted in relation to last offset of " << last_offset |
| 658 << ". Provider: " << provider_name << "."; | 664 << ". Provider: " << provider_name << "."; |
| 659 DCHECK_LT(i->offset, text.length()) | 665 DCHECK_LT(i->offset, text.length()) |
| 660 << " Classification of [" << i->offset << "," << text.length() | 666 << " Classification of [" << i->offset << "," << text.length() |
| 661 << "] is out of bounds for \"" << text << "\". Provider: " | 667 << "] is out of bounds for \"" << text << "\". Provider: " |
| 662 << provider_name << "."; | 668 << provider_name << "."; |
| 663 last_offset = i->offset; | 669 last_offset = i->offset; |
| 664 } | 670 } |
| 665 } | 671 } |
| 666 #endif | 672 #endif |
| OLD | NEW |