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

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

Issue 165163002: Handle Search suggest subtypes for Shortcuts DB (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Submit candidate 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_SUGGEST_ENTITY || 341 type == AutocompleteMatchType::SEARCH_OTHER_ENGINE ||
342 IsSpecializedSearchType(type);
343 }
344
345 // static
346 bool AutocompleteMatch::IsSpecializedSearchType(Type type) {
347 return type == AutocompleteMatchType::SEARCH_SUGGEST_ENTITY ||
342 type == AutocompleteMatchType::SEARCH_SUGGEST_INFINITE || 348 type == AutocompleteMatchType::SEARCH_SUGGEST_INFINITE ||
343 type == AutocompleteMatchType::SEARCH_SUGGEST_PERSONALIZED || 349 type == AutocompleteMatchType::SEARCH_SUGGEST_PERSONALIZED ||
344 type == AutocompleteMatchType::SEARCH_SUGGEST_PROFILE || 350 type == AutocompleteMatchType::SEARCH_SUGGEST_PROFILE;
345 type == AutocompleteMatchType::SEARCH_OTHER_ENGINE;
346 } 351 }
347 352
348 void AutocompleteMatch::ComputeStrippedDestinationURL(Profile* profile) { 353 void AutocompleteMatch::ComputeStrippedDestinationURL(Profile* profile) {
349 stripped_destination_url = destination_url; 354 stripped_destination_url = destination_url;
350 if (!stripped_destination_url.is_valid()) 355 if (!stripped_destination_url.is_valid())
351 return; 356 return;
352 357
353 // If the destination URL looks like it was generated from a TemplateURL, 358 // If the destination URL looks like it was generated from a TemplateURL,
354 // remove all substitutions other than the search terms. This allows us 359 // remove all substitutions other than the search terms. This allows us
355 // to eliminate cases like past search URLs from history that differ only 360 // to eliminate cases like past search URLs from history that differ only
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 << " is unsorted in relation to last offset of " << last_offset 511 << " is unsorted in relation to last offset of " << last_offset
507 << ". Provider: " << provider_name << "."; 512 << ". Provider: " << provider_name << ".";
508 DCHECK_LT(i->offset, text.length()) 513 DCHECK_LT(i->offset, text.length())
509 << " Classification of [" << i->offset << "," << text.length() 514 << " Classification of [" << i->offset << "," << text.length()
510 << "] is out of bounds for \"" << text << "\". Provider: " 515 << "] is out of bounds for \"" << text << "\". Provider: "
511 << provider_name << "."; 516 << provider_name << ".";
512 last_offset = i->offset; 517 last_offset = i->offset;
513 } 518 }
514 } 519 }
515 #endif 520 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698