| 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 (offset > classifications->back().offset)); | 323 (offset > classifications->back().offset)); |
| 324 classifications->push_back(ACMatchClassification(offset, style)); | 324 classifications->push_back(ACMatchClassification(offset, style)); |
| 325 } | 325 } |
| 326 } | 326 } |
| 327 | 327 |
| 328 // static | 328 // static |
| 329 base::string16 AutocompleteMatch::SanitizeString(const base::string16& text) { | 329 base::string16 AutocompleteMatch::SanitizeString(const base::string16& text) { |
| 330 // NOTE: This logic is mirrored by |sanitizeString()| in | 330 // NOTE: This logic is mirrored by |sanitizeString()| in |
| 331 // omnibox_custom_bindings.js. | 331 // omnibox_custom_bindings.js. |
| 332 base::string16 result; | 332 base::string16 result; |
| 333 TrimWhitespace(text, TRIM_LEADING, &result); | 333 base::TrimWhitespace(text, base::TRIM_LEADING, &result); |
| 334 base::RemoveChars(result, kInvalidChars, &result); | 334 base::RemoveChars(result, kInvalidChars, &result); |
| 335 return result; | 335 return result; |
| 336 } | 336 } |
| 337 | 337 |
| 338 // static | 338 // static |
| 339 bool AutocompleteMatch::IsSearchType(Type type) { | 339 bool AutocompleteMatch::IsSearchType(Type type) { |
| 340 return type == AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED || | 340 return type == AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED || |
| 341 type == AutocompleteMatchType::SEARCH_HISTORY || | 341 type == AutocompleteMatchType::SEARCH_HISTORY || |
| 342 type == AutocompleteMatchType::SEARCH_SUGGEST || | 342 type == AutocompleteMatchType::SEARCH_SUGGEST || |
| 343 type == AutocompleteMatchType::SEARCH_OTHER_ENGINE; | 343 type == AutocompleteMatchType::SEARCH_OTHER_ENGINE; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 << " is unsorted in relation to last offset of " << last_offset | 504 << " is unsorted in relation to last offset of " << last_offset |
| 505 << ". Provider: " << provider_name << "."; | 505 << ". Provider: " << provider_name << "."; |
| 506 DCHECK_LT(i->offset, text.length()) | 506 DCHECK_LT(i->offset, text.length()) |
| 507 << " Classification of [" << i->offset << "," << text.length() | 507 << " Classification of [" << i->offset << "," << text.length() |
| 508 << "] is out of bounds for \"" << text << "\". Provider: " | 508 << "] is out of bounds for \"" << text << "\". Provider: " |
| 509 << provider_name << "."; | 509 << provider_name << "."; |
| 510 last_offset = i->offset; | 510 last_offset = i->offset; |
| 511 } | 511 } |
| 512 } | 512 } |
| 513 #endif | 513 #endif |
| OLD | NEW |