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

Unified Diff: chrome/browser/autocomplete/base_search_provider.h

Issue 471673002: Omnibox: Prevent Asynchronous Suggestions from Changing Default Match (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better resolve rebase Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autocomplete/base_search_provider.h
diff --git a/chrome/browser/autocomplete/base_search_provider.h b/chrome/browser/autocomplete/base_search_provider.h
index 0f3b05cc8bcee79af17d326a4cede724ecdf68ff..66f26aa3b6b911b129a7bdd04d4302088018ef51 100644
--- a/chrome/browser/autocomplete/base_search_provider.h
+++ b/chrome/browser/autocomplete/base_search_provider.h
@@ -57,7 +57,8 @@ class BaseSearchProvider : public AutocompleteProvider {
static bool ShouldPrefetch(const AutocompleteMatch& match);
// Returns a simpler AutocompleteMatch suitable for persistence like in
- // ShortcutsDatabase.
+ // ShortcutsDatabase. This wrapper function uses a number of default values
+ // that may or may not be appropriate for your needs.
// NOTE: Use with care. Most likely you want the other CreateSearchSuggestion
// with protected access.
static AutocompleteMatch CreateSearchSuggestion(
@@ -113,6 +114,8 @@ class BaseSearchProvider : public AutocompleteProvider {
//
// |input| is also necessary for various other details, like whether we should
// allow inline autocompletion and what the transition type should be.
+ // |in_keyword_mode| helps guarantee a non-keyword suggestion does not
+ // appear as the default match when the user is in keyword mode.
// |accepted_suggestion| is used to generate Assisted Query Stats.
// |append_extra_query_params| should be set if |template_url| is the default
// search engine, so the destination URL will contain any
@@ -120,6 +123,7 @@ class BaseSearchProvider : public AutocompleteProvider {
static AutocompleteMatch CreateSearchSuggestion(
AutocompleteProvider* autocomplete_provider,
const AutocompleteInput& input,
+ const bool in_keyword_mode,
const SearchSuggestionParser::SuggestResult& suggestion,
const TemplateURL* template_url,
const SearchTermsData& search_terms_data,
@@ -180,11 +184,14 @@ class BaseSearchProvider : public AutocompleteProvider {
// |metadata| and |accepted_suggestion| are used for generating an
// AutocompleteMatch.
// |mark_as_deletable| indicates whether the match should be marked deletable.
+ // |in_keyword_mode| helps guarantee a non-keyword suggestion does not
+ // appear as the default match when the user is in keyword mode.
// NOTE: Any result containing a deletion URL is always marked deletable.
void AddMatchToMap(const SearchSuggestionParser::SuggestResult& result,
const std::string& metadata,
int accepted_suggestion,
bool mark_as_deletable,
+ bool in_keyword_mode,
MatchMap* map);
// Parses results from the suggest server and updates the appropriate suggest
« no previous file with comments | « no previous file | chrome/browser/autocomplete/base_search_provider.cc » ('j') | chrome/browser/autocomplete/search_provider.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698