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/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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 (offset > classifications->back().offset)); | 321 (offset > classifications->back().offset)); |
322 classifications->push_back(ACMatchClassification(offset, style)); | 322 classifications->push_back(ACMatchClassification(offset, style)); |
323 } | 323 } |
324 } | 324 } |
325 | 325 |
326 // static | 326 // static |
327 base::string16 AutocompleteMatch::SanitizeString(const base::string16& text) { | 327 base::string16 AutocompleteMatch::SanitizeString(const base::string16& text) { |
328 // NOTE: This logic is mirrored by |sanitizeString()| in | 328 // NOTE: This logic is mirrored by |sanitizeString()| in |
329 // omnibox_custom_bindings.js. | 329 // omnibox_custom_bindings.js. |
330 base::string16 result; | 330 base::string16 result; |
331 TrimWhitespace(text, TRIM_LEADING, &result); | 331 base::TrimWhitespace(text, base::TRIM_LEADING, &result); |
332 base::RemoveChars(result, kInvalidChars, &result); | 332 base::RemoveChars(result, kInvalidChars, &result); |
333 return result; | 333 return result; |
334 } | 334 } |
335 | 335 |
336 // static | 336 // static |
337 bool AutocompleteMatch::IsSearchType(Type type) { | 337 bool AutocompleteMatch::IsSearchType(Type type) { |
338 return type == AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED || | 338 return type == AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED || |
339 type == AutocompleteMatchType::SEARCH_HISTORY || | 339 type == AutocompleteMatchType::SEARCH_HISTORY || |
340 type == AutocompleteMatchType::SEARCH_SUGGEST || | 340 type == AutocompleteMatchType::SEARCH_SUGGEST || |
341 type == AutocompleteMatchType::SEARCH_OTHER_ENGINE; | 341 type == AutocompleteMatchType::SEARCH_OTHER_ENGINE; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 << " is unsorted in relation to last offset of " << last_offset | 490 << " is unsorted in relation to last offset of " << last_offset |
491 << ". Provider: " << provider_name << "."; | 491 << ". Provider: " << provider_name << "."; |
492 DCHECK_LT(i->offset, text.length()) | 492 DCHECK_LT(i->offset, text.length()) |
493 << " Classification of [" << i->offset << "," << text.length() | 493 << " Classification of [" << i->offset << "," << text.length() |
494 << "] is out of bounds for \"" << text << "\". Provider: " | 494 << "] is out of bounds for \"" << text << "\". Provider: " |
495 << provider_name << "."; | 495 << provider_name << "."; |
496 last_offset = i->offset; | 496 last_offset = i->offset; |
497 } | 497 } |
498 } | 498 } |
499 #endif | 499 #endif |
OLD | NEW |