Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: chrome/browser/autocomplete/autocomplete_match.cc

Issue 211283005: Revert of Handle Search suggest subtypes for Shortcuts DB (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 base::TrimWhitespace(text, base::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_SUGGEST_ENTITY ||
342 IsSpecializedSearchType(type);
343 }
344
345 // static
346 bool AutocompleteMatch::IsSpecializedSearchType(Type type) {
347 return type == AutocompleteMatchType::SEARCH_SUGGEST_ENTITY ||
348 type == AutocompleteMatchType::SEARCH_SUGGEST_INFINITE || 342 type == AutocompleteMatchType::SEARCH_SUGGEST_INFINITE ||
349 type == AutocompleteMatchType::SEARCH_SUGGEST_PERSONALIZED || 343 type == AutocompleteMatchType::SEARCH_SUGGEST_PERSONALIZED ||
350 type == AutocompleteMatchType::SEARCH_SUGGEST_PROFILE; 344 type == AutocompleteMatchType::SEARCH_SUGGEST_PROFILE ||
345 type == AutocompleteMatchType::SEARCH_OTHER_ENGINE;
351 } 346 }
352 347
353 void AutocompleteMatch::ComputeStrippedDestinationURL(Profile* profile) { 348 void AutocompleteMatch::ComputeStrippedDestinationURL(Profile* profile) {
354 stripped_destination_url = destination_url; 349 stripped_destination_url = destination_url;
355 if (!stripped_destination_url.is_valid()) 350 if (!stripped_destination_url.is_valid())
356 return; 351 return;
357 352
358 // If the destination URL looks like it was generated from a TemplateURL, 353 // If the destination URL looks like it was generated from a TemplateURL,
359 // remove all substitutions other than the search terms. This allows us 354 // remove all substitutions other than the search terms. This allows us
360 // to eliminate cases like past search URLs from history that differ only 355 // to eliminate cases like past search URLs from history that differ only
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 << " is unsorted in relation to last offset of " << last_offset 506 << " is unsorted in relation to last offset of " << last_offset
512 << ". Provider: " << provider_name << "."; 507 << ". Provider: " << provider_name << ".";
513 DCHECK_LT(i->offset, text.length()) 508 DCHECK_LT(i->offset, text.length())
514 << " Classification of [" << i->offset << "," << text.length() 509 << " Classification of [" << i->offset << "," << text.length()
515 << "] is out of bounds for \"" << text << "\". Provider: " 510 << "] is out of bounds for \"" << text << "\". Provider: "
516 << provider_name << "."; 511 << provider_name << ".";
517 last_offset = i->offset; 512 last_offset = i->offset;
518 } 513 }
519 } 514 }
520 #endif 515 #endif
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_match.h ('k') | chrome/browser/autocomplete/base_search_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698