Chromium Code Reviews| 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 335 DCHECK(classifications); | 335 DCHECK(classifications); |
| 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 bindings.js. |
|
not at google - send to devlin
2013/02/13 01:45:49
it's actually in omnibox_custom_bindings.js.
cduvall
2013/02/15 00:40:28
Done.
| |
| 346 // schema_generated_bindings.js. | |
| 347 string16 result; | 346 string16 result; |
| 348 TrimWhitespace(text, TRIM_LEADING, &result); | 347 TrimWhitespace(text, TRIM_LEADING, &result); |
| 349 RemoveChars(result, kInvalidChars, &result); | 348 RemoveChars(result, kInvalidChars, &result); |
| 350 return result; | 349 return result; |
| 351 } | 350 } |
| 352 | 351 |
| 353 // static | 352 // static |
| 354 bool AutocompleteMatch::IsSearchType(Type type) { | 353 bool AutocompleteMatch::IsSearchType(Type type) { |
| 355 return type == SEARCH_WHAT_YOU_TYPED || | 354 return type == SEARCH_WHAT_YOU_TYPED || |
| 356 type == SEARCH_HISTORY || | 355 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 | 489 << " is unsorted in relation to last offset of " << last_offset |
| 491 << ". Provider: " << provider_name << "."; | 490 << ". Provider: " << provider_name << "."; |
| 492 DCHECK_LT(i->offset, text.length()) | 491 DCHECK_LT(i->offset, text.length()) |
| 493 << " Classification of [" << i->offset << "," << text.length() | 492 << " Classification of [" << i->offset << "," << text.length() |
| 494 << "] is out of bounds for \"" << text << "\". Provider: " | 493 << "] is out of bounds for \"" << text << "\". Provider: " |
| 495 << provider_name << "."; | 494 << provider_name << "."; |
| 496 last_offset = i->offset; | 495 last_offset = i->offset; |
| 497 } | 496 } |
| 498 } | 497 } |
| 499 #endif | 498 #endif |
| OLD | NEW |