Chromium Code Reviews| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 // Tells the provider whether to promote the what you typed match, the first | 149 // Tells the provider whether to promote the what you typed match, the first |
| 150 // element of |matches|, or neither as the first AutocompleteMatch. If | 150 // element of |matches|, or neither as the first AutocompleteMatch. If |
| 151 // |exact_suggestion_is_in_history| is true (and thus "the what you typed | 151 // |exact_suggestion_is_in_history| is true (and thus "the what you typed |
| 152 // match" and "the first element of |matches|" represent the same thing), this | 152 // match" and "the first element of |matches|" represent the same thing), this |
| 153 // will be set to WHAT_YOU_TYPED_MATCH. | 153 // will be set to WHAT_YOU_TYPED_MATCH. |
| 154 // | 154 // |
| 155 // NOTE: The second pass of DoAutocomplete() checks what the first pass set | 155 // NOTE: The second pass of DoAutocomplete() checks what the first pass set |
| 156 // this to. See comments in DoAutocomplete(). | 156 // this to. See comments in DoAutocomplete(). |
| 157 PromoteType promote_type; | 157 PromoteType promote_type; |
| 158 | 158 |
| 159 // True if we should consider adding the what you typed match. This | |
| 160 // decision is often already summarized in |promote_type| by whether it | |
| 161 // says to promote the what you typed match. As such, this variable is | |
| 162 // only useful when |promote_type| is FRONT_HISTORY_MATCH. | |
|
Peter Kasting
2014/06/20 21:12:42
Nit: I think this comment would be clearer as:
Tr
Mark P
2014/06/23 22:23:12
Yes, that is clearer. Done.
| |
| 163 bool have_what_you_typed_match; | |
| 164 | |
| 159 // Languages we should pass to gfx::GetCleanStringFromUrl. | 165 // Languages we should pass to gfx::GetCleanStringFromUrl. |
| 160 std::string languages; | 166 std::string languages; |
| 161 | 167 |
| 162 // 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 |
| 163 // 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 |
| 164 // 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 |
| 165 // 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 |
| 166 // 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> |
| 167 // 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 |
| 168 // history thread. | 174 // history thread. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 | 244 |
| 239 // Actually runs the autocomplete job on the given database, which is | 245 // Actually runs the autocomplete job on the given database, which is |
| 240 // guaranteed not to be NULL. Used by both autocomplete passes, and therefore | 246 // guaranteed not to be NULL. Used by both autocomplete passes, and therefore |
| 241 // called on multiple different threads (though not simultaneously). | 247 // called on multiple different threads (though not simultaneously). |
| 242 void DoAutocomplete(history::HistoryBackend* backend, | 248 void DoAutocomplete(history::HistoryBackend* backend, |
| 243 history::URLDatabase* db, | 249 history::URLDatabase* db, |
| 244 HistoryURLProviderParams* params); | 250 HistoryURLProviderParams* params); |
| 245 | 251 |
| 246 // May promote either the what you typed match or first history match in | 252 // May promote either the what you typed match or first history match in |
| 247 // params->matches to the front of |matches_|, depending on the value of | 253 // params->matches to the front of |matches_|, depending on the value of |
| 248 // params->promote_type. | 254 // params->promote_type. Also, depending on a field trial state, if it |
| 249 void PromoteMatchIfNecessary(const HistoryURLProviderParams& params); | 255 // promotes the first history match, it may decide to append the what you |
| 256 // typed matche immediately after. | |
|
Peter Kasting
2014/06/20 21:12:42
Nit: How about:
May promote the what you typed ma
Mark P
2014/06/23 22:23:12
Okay, omitting the mention of the field trial seem
| |
| 257 void PromoteMatchesIfNecessary(const HistoryURLProviderParams& params); | |
| 250 | 258 |
| 251 // Dispatches the results to the autocomplete controller. Called on the | 259 // Dispatches the results to the autocomplete controller. Called on the |
| 252 // main thread by ExecuteWithDB when the results are available. | 260 // main thread by ExecuteWithDB when the results are available. |
| 253 // Frees params_gets_deleted on exit. | 261 // Frees params_gets_deleted on exit. |
| 254 void QueryComplete(HistoryURLProviderParams* params_gets_deleted); | 262 void QueryComplete(HistoryURLProviderParams* params_gets_deleted); |
| 255 | 263 |
| 256 // Looks up the info for params->what_you_typed_match in the DB. If found, | 264 // Looks up the info for params->what_you_typed_match in the DB. If found, |
| 257 // fills in the title, promotes the match's priority to that of an inline | 265 // fills in the title, promotes the match's priority to that of an inline |
| 258 // autocomplete match (maybe it should be slightly better?), and places it on | 266 // autocomplete match (maybe it should be slightly better?), and places it on |
| 259 // the front of params->matches (so we pick the right matches to throw away | 267 // the front of params->matches (so we pick the right matches to throw away |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 // Used in PromoteOrCreateShorterSuggestion(). If true, we may create | 344 // Used in PromoteOrCreateShorterSuggestion(). If true, we may create |
| 337 // shorter suggestions even when they haven't been visited before: | 345 // shorter suggestions even when they haven't been visited before: |
| 338 // if the user visited http://example.com/asdf once, we'll suggest | 346 // if the user visited http://example.com/asdf once, we'll suggest |
| 339 // http://example.com/ even if they've never been to it. | 347 // http://example.com/ even if they've never been to it. |
| 340 bool create_shorter_match_; | 348 bool create_shorter_match_; |
| 341 | 349 |
| 342 DISALLOW_COPY_AND_ASSIGN(HistoryURLProvider); | 350 DISALLOW_COPY_AND_ASSIGN(HistoryURLProvider); |
| 343 }; | 351 }; |
| 344 | 352 |
| 345 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ | 353 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ |
| OLD | NEW |