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