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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
150 // Tells the provider whether to promote the what you typed match, the first | 150 // Tells the provider whether to promote the what you typed match, the first |
151 // element of |matches|, or neither as the first AutocompleteMatch. If | 151 // element of |matches|, or neither as the first AutocompleteMatch. If |
152 // |exact_suggestion_is_in_history| is true (and thus "the what you typed | 152 // |exact_suggestion_is_in_history| is true (and thus "the what you typed |
153 // match" and "the first element of |matches|" represent the same thing), this | 153 // match" and "the first element of |matches|" represent the same thing), this |
154 // will be set to WHAT_YOU_TYPED_MATCH. | 154 // will be set to WHAT_YOU_TYPED_MATCH. |
155 // | 155 // |
156 // NOTE: The second pass of DoAutocomplete() checks what the first pass set | 156 // NOTE: The second pass of DoAutocomplete() checks what the first pass set |
157 // this to. See comments in DoAutocomplete(). | 157 // this to. See comments in DoAutocomplete(). |
158 PromoteType promote_type; | 158 PromoteType promote_type; |
159 | 159 |
160 // True if |what_you_typed_match| is eligible for display. If this is true, | |
161 // PromoteMatchesIfNecessary() may choose to place |what_you_typed_match| on | |
162 // |matches_| even when |promote_type| is not WHAT_YOU_TYPED_MATCH. | |
163 bool have_what_you_typed_match; | |
164 | |
160 // Languages we should pass to gfx::GetCleanStringFromUrl. | 165 // Languages we should pass to gfx::GetCleanStringFromUrl. |
161 std::string languages; | 166 std::string languages; |
162 | 167 |
163 // The default search provider and search terms data necessary to cull results | 168 // The default search provider and search terms data necessary to cull results |
164 // that correspond to searches (on the default engine). These can only be | 169 // that correspond to searches (on the default engine). These can only be |
165 // obtained on the UI thread, so we have to copy them into here to pass them | 170 // obtained on the UI thread, so we have to copy them into here to pass them |
166 // to the history thread. We use a scoped_ptr<TemplateURL> for the DSP since | 171 // to the history thread. We use a scoped_ptr<TemplateURL> for the DSP since |
167 // TemplateURLs can't be copied by value. We use a scoped_ptr<SearchTermsData> | 172 // TemplateURLs can't be copied by value. We use a scoped_ptr<SearchTermsData> |
168 // so that we can store a snapshot of the SearchTermsData accessible from the | 173 // so that we can store a snapshot of the SearchTermsData accessible from the |
169 // history thread. | 174 // history thread. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
239 const base::string16& input_text, | 244 const base::string16& input_text, |
240 const base::string16& description); | 245 const base::string16& description); |
241 | 246 |
242 // Actually runs the autocomplete job on the given database, which is | 247 // Actually runs the autocomplete job on the given database, which is |
243 // guaranteed not to be NULL. Used by both autocomplete passes, and therefore | 248 // guaranteed not to be NULL. Used by both autocomplete passes, and therefore |
244 // called on multiple different threads (though not simultaneously). | 249 // called on multiple different threads (though not simultaneously). |
245 void DoAutocomplete(history::HistoryBackend* backend, | 250 void DoAutocomplete(history::HistoryBackend* backend, |
246 history::URLDatabase* db, | 251 history::URLDatabase* db, |
247 HistoryURLProviderParams* params); | 252 HistoryURLProviderParams* params); |
248 | 253 |
249 // May promote either the what you typed match or first history match in | 254 // May promote the what you typed match, the first history match in |
250 // params->matches to the front of |matches_|, depending on the value of | 255 // parmas->matches, or both to the front of |matches_|, depending on the |
Peter Kasting
2015/03/20 23:30:19
params
Mark P
2015/03/24 18:23:26
Done.
| |
251 // params->promote_type. | 256 // values of params->promote_type, params->have_what_you_typed_match, and |
252 void PromoteMatchIfNecessary(const HistoryURLProviderParams& params); | 257 // params->prevent_inline_autocomplete. |
258 void PromoteMatchesIfNecessary(const HistoryURLProviderParams& params); | |
253 | 259 |
254 // Dispatches the results to the autocomplete controller. Called on the | 260 // Dispatches the results to the autocomplete controller. Called on the |
255 // main thread by ExecuteWithDB when the results are available. | 261 // main thread by ExecuteWithDB when the results are available. |
256 // Frees params_gets_deleted on exit. | 262 // Frees params_gets_deleted on exit. |
257 void QueryComplete(HistoryURLProviderParams* params_gets_deleted); | 263 void QueryComplete(HistoryURLProviderParams* params_gets_deleted); |
258 | 264 |
259 // Looks up the info for params->what_you_typed_match in the DB. If found, | 265 // Looks up the info for params->what_you_typed_match in the DB. If found, |
260 // fills in the title, promotes the match's priority to that of an inline | 266 // fills in the title, promotes the match's priority to that of an inline |
261 // autocomplete match (maybe it should be slightly better?), and places it on | 267 // autocomplete match (maybe it should be slightly better?), and places it on |
262 // the front of params->matches (so we pick the right matches to throw away | 268 // the front of params->matches (so we pick the right matches to throw away |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
328 // keep this member is so we can set the cancel bit on it. | 334 // keep this member is so we can set the cancel bit on it. |
329 HistoryURLProviderParams* params_; | 335 HistoryURLProviderParams* params_; |
330 | 336 |
331 // Params controlling experimental behavior of this provider. | 337 // Params controlling experimental behavior of this provider. |
332 HUPScoringParams scoring_params_; | 338 HUPScoringParams scoring_params_; |
333 | 339 |
334 DISALLOW_COPY_AND_ASSIGN(HistoryURLProvider); | 340 DISALLOW_COPY_AND_ASSIGN(HistoryURLProvider); |
335 }; | 341 }; |
336 | 342 |
337 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ | 343 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ |
OLD | NEW |