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 | |
165 // Languages we should pass to gfx::GetCleanStringFromUrl. | 160 // Languages we should pass to gfx::GetCleanStringFromUrl. |
166 std::string languages; | 161 std::string languages; |
167 | 162 |
168 // The default search provider and search terms data necessary to cull results | 163 // The default search provider and search terms data necessary to cull results |
169 // that correspond to searches (on the default engine). These can only be | 164 // that correspond to searches (on the default engine). These can only be |
170 // obtained on the UI thread, so we have to copy them into here to pass them | 165 // obtained on the UI thread, so we have to copy them into here to pass them |
171 // to the history thread. We use a scoped_ptr<TemplateURL> for the DSP since | 166 // to the history thread. We use a scoped_ptr<TemplateURL> for the DSP since |
172 // TemplateURLs can't be copied by value. We use a scoped_ptr<SearchTermsData> | 167 // TemplateURLs can't be copied by value. We use a scoped_ptr<SearchTermsData> |
173 // so that we can store a snapshot of the SearchTermsData accessible from the | 168 // so that we can store a snapshot of the SearchTermsData accessible from the |
174 // history thread. | 169 // history thread. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 const base::string16& input_text, | 238 const base::string16& input_text, |
244 const base::string16& description); | 239 const base::string16& description); |
245 | 240 |
246 // Actually runs the autocomplete job on the given database, which is | 241 // Actually runs the autocomplete job on the given database, which is |
247 // guaranteed not to be NULL. Used by both autocomplete passes, and therefore | 242 // guaranteed not to be NULL. Used by both autocomplete passes, and therefore |
248 // called on multiple different threads (though not simultaneously). | 243 // called on multiple different threads (though not simultaneously). |
249 void DoAutocomplete(history::HistoryBackend* backend, | 244 void DoAutocomplete(history::HistoryBackend* backend, |
250 history::URLDatabase* db, | 245 history::URLDatabase* db, |
251 HistoryURLProviderParams* params); | 246 HistoryURLProviderParams* params); |
252 | 247 |
253 // May promote the what you typed match, the first history match in | 248 // May promote either the what you typed match or first history match in |
254 // parmas->matches, or both to the front of |matches_|, depending on the | 249 // params->matches to the front of |matches_|, depending on the value of |
255 // values of params->promote_type and params->have_what_you_typed_match. | 250 // params->promote_type. |
256 void PromoteMatchesIfNecessary(const HistoryURLProviderParams& params); | 251 void PromoteMatchIfNecessary(const HistoryURLProviderParams& params); |
257 | 252 |
258 // Dispatches the results to the autocomplete controller. Called on the | 253 // Dispatches the results to the autocomplete controller. Called on the |
259 // main thread by ExecuteWithDB when the results are available. | 254 // main thread by ExecuteWithDB when the results are available. |
260 // Frees params_gets_deleted on exit. | 255 // Frees params_gets_deleted on exit. |
261 void QueryComplete(HistoryURLProviderParams* params_gets_deleted); | 256 void QueryComplete(HistoryURLProviderParams* params_gets_deleted); |
262 | 257 |
263 // Looks up the info for params->what_you_typed_match in the DB. If found, | 258 // Looks up the info for params->what_you_typed_match in the DB. If found, |
264 // fills in the title, promotes the match's priority to that of an inline | 259 // fills in the title, promotes the match's priority to that of an inline |
265 // autocomplete match (maybe it should be slightly better?), and places it on | 260 // autocomplete match (maybe it should be slightly better?), and places it on |
266 // the front of params->matches (so we pick the right matches to throw away | 261 // 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... |
332 // keep this member is so we can set the cancel bit on it. | 327 // keep this member is so we can set the cancel bit on it. |
333 HistoryURLProviderParams* params_; | 328 HistoryURLProviderParams* params_; |
334 | 329 |
335 // Params controlling experimental behavior of this provider. | 330 // Params controlling experimental behavior of this provider. |
336 HUPScoringParams scoring_params_; | 331 HUPScoringParams scoring_params_; |
337 | 332 |
338 DISALLOW_COPY_AND_ASSIGN(HistoryURLProvider); | 333 DISALLOW_COPY_AND_ASSIGN(HistoryURLProvider); |
339 }; | 334 }; |
340 | 335 |
341 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ | 336 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ |
OLD | NEW |