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

Side by Side Diff: chrome/browser/autocomplete/zero_suggest_provider.h

Issue 671593002: Do not delay most visited results. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed slow mv return condition and added unit tests Created 6 years, 2 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
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 // This file contains the zero-suggest autocomplete provider. This experimental 5 // This file contains the zero-suggest autocomplete provider. This experimental
6 // provider is invoked when the user focuses in the omnibox prior to editing, 6 // provider is invoked when the user focuses in the omnibox prior to editing,
7 // and generates search query suggestions based on the current URL. 7 // and generates search query suggestions based on the current URL.
8 8
9 #ifndef CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ 9 #ifndef CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_
10 #define CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ 10 #define CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 AutocompleteMatch MatchForCurrentURL(); 112 AutocompleteMatch MatchForCurrentURL();
113 113
114 // When the user is in the Most Visited field trial, we ask the TopSites 114 // When the user is in the Most Visited field trial, we ask the TopSites
115 // service for the most visited URLs during Run(). It calls back to this 115 // service for the most visited URLs during Run(). It calls back to this
116 // function to return those |urls|. 116 // function to return those |urls|.
117 void OnMostVisitedUrlsAvailable(const history::MostVisitedURLList& urls); 117 void OnMostVisitedUrlsAvailable(const history::MostVisitedURLList& urls);
118 118
119 // Returns the relevance score for the verbatim result. 119 // Returns the relevance score for the verbatim result.
120 int GetVerbatimRelevance() const; 120 int GetVerbatimRelevance() const;
121 121
122 // Whether we can show zero suggest on |current_page_url| without 122 // Whether we can show zero suggest without sending |current_page_url| to
123 // sending |current_page_url| as a parameter to the server at |suggest_url|. 123 // |suggest_url| search provider. Also checks that other conditions for
124 bool CanShowZeroSuggestWithoutSendingURL(const GURL& suggest_url, 124 // non-contextual zero suggest are satisfied.
125 const GURL& current_page_url) const; 125 bool ShouldShowNonContextualZeroSuggest(const GURL& suggest_url,
126 const GURL& current_page_url) const;
126 127
127 // Checks whether we have a set of zero suggest results cached, and if so 128 // Checks whether we have a set of zero suggest results cached, and if so
128 // populates |matches_| with cached results. 129 // populates |matches_| with cached results.
129 void MaybeUseCachedSuggestions(); 130 void MaybeUseCachedSuggestions();
130 131
131 AutocompleteProviderListener* listener_; 132 AutocompleteProviderListener* listener_;
132 Profile* profile_; 133 Profile* profile_;
133 134
134 // The URL for which a suggestion fetch is pending. 135 // The URL for which a suggestion fetch is pending.
135 std::string current_query_; 136 std::string current_query_;
(...skipping 13 matching lines...) Expand all
149 150
150 // Contains suggest and navigation results as well as relevance parsed from 151 // Contains suggest and navigation results as well as relevance parsed from
151 // the response for the most recent zero suggest input URL. 152 // the response for the most recent zero suggest input URL.
152 SearchSuggestionParser::Results results_; 153 SearchSuggestionParser::Results results_;
153 154
154 // Whether we are currently showing cached zero suggest results. 155 // Whether we are currently showing cached zero suggest results.
155 bool results_from_cache_; 156 bool results_from_cache_;
156 157
157 history::MostVisitedURLList most_visited_urls_; 158 history::MostVisitedURLList most_visited_urls_;
158 159
160 // Whether we are waiting for a most visited visited urls callback to run.
161 bool most_visited_urls_requested_;
Mark P 2014/10/22 19:11:23 optional nit: consider calling this something like
Maria 2014/10/23 20:34:26 Done.
162
159 // For callbacks that may be run after destruction. 163 // For callbacks that may be run after destruction.
160 base::WeakPtrFactory<ZeroSuggestProvider> weak_ptr_factory_; 164 base::WeakPtrFactory<ZeroSuggestProvider> weak_ptr_factory_;
161 165
162 DISALLOW_COPY_AND_ASSIGN(ZeroSuggestProvider); 166 DISALLOW_COPY_AND_ASSIGN(ZeroSuggestProvider);
163 }; 167 };
164 168
165 #endif // CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ 169 #endif // CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698