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/string16.h" | 9 #include "base/string16.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 if (classifications->empty() || classifications->back().style != style) { | 336 if (classifications->empty() || classifications->back().style != style) { |
337 DCHECK(classifications->empty() || | 337 DCHECK(classifications->empty() || |
338 (offset > classifications->back().offset)); | 338 (offset > classifications->back().offset)); |
339 classifications->push_back(ACMatchClassification(offset, style)); | 339 classifications->push_back(ACMatchClassification(offset, style)); |
340 } | 340 } |
341 } | 341 } |
342 | 342 |
343 // static | 343 // static |
344 string16 AutocompleteMatch::SanitizeString(const string16& text) { | 344 string16 AutocompleteMatch::SanitizeString(const string16& text) { |
345 // NOTE: This logic is mirrored by |sanitizeString()| in | 345 // NOTE: This logic is mirrored by |sanitizeString()| in |
346 // schema_generated_bindings.js. | 346 // omnibox_custom_bindings.js. |
347 string16 result; | 347 string16 result; |
348 TrimWhitespace(text, TRIM_LEADING, &result); | 348 TrimWhitespace(text, TRIM_LEADING, &result); |
349 RemoveChars(result, kInvalidChars, &result); | 349 RemoveChars(result, kInvalidChars, &result); |
350 return result; | 350 return result; |
351 } | 351 } |
352 | 352 |
353 // static | 353 // static |
354 bool AutocompleteMatch::IsSearchType(Type type) { | 354 bool AutocompleteMatch::IsSearchType(Type type) { |
355 return type == SEARCH_WHAT_YOU_TYPED || | 355 return type == SEARCH_WHAT_YOU_TYPED || |
356 type == SEARCH_HISTORY || | 356 type == SEARCH_HISTORY || |
(...skipping 133 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 |