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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 238 |
239 // Actually runs the autocomplete job on the given database, which is | 239 // Actually runs the autocomplete job on the given database, which is |
240 // guaranteed not to be NULL. Used by both autocomplete passes, and therefore | 240 // guaranteed not to be NULL. Used by both autocomplete passes, and therefore |
241 // called on multiple different threads (though not simultaneously). | 241 // called on multiple different threads (though not simultaneously). |
242 void DoAutocomplete(history::HistoryBackend* backend, | 242 void DoAutocomplete(history::HistoryBackend* backend, |
243 history::URLDatabase* db, | 243 history::URLDatabase* db, |
244 HistoryURLProviderParams* params); | 244 HistoryURLProviderParams* params); |
245 | 245 |
246 // May promote either the what you typed match or first history match in | 246 // 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 | 247 // params->matches to the front of |matches_|, depending on the value of |
248 // params->promote_type. | 248 // params->promote_type. Also, depending on a field trial state, if it |
249 void PromoteMatchIfNecessary(const HistoryURLProviderParams& params); | 249 // promotes the first history match, it may decide to append the what you |
| 250 // typed matche immediately after. |
| 251 void PromoteMatchesIfNecessary(const HistoryURLProviderParams& params); |
250 | 252 |
251 // Dispatches the results to the autocomplete controller. Called on the | 253 // Dispatches the results to the autocomplete controller. Called on the |
252 // main thread by ExecuteWithDB when the results are available. | 254 // main thread by ExecuteWithDB when the results are available. |
253 // Frees params_gets_deleted on exit. | 255 // Frees params_gets_deleted on exit. |
254 void QueryComplete(HistoryURLProviderParams* params_gets_deleted); | 256 void QueryComplete(HistoryURLProviderParams* params_gets_deleted); |
255 | 257 |
| 258 // Returns whether we should consider showing the what you typed match. |
| 259 static bool HaveWhatYouTypedMatch(const VisitClassifier& classifier, |
| 260 const HistoryURLProviderParams& params); |
| 261 |
256 // Looks up the info for params->what_you_typed_match in the DB. If found, | 262 // 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 | 263 // 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 | 264 // 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 | 265 // the front of params->matches (so we pick the right matches to throw away |
260 // when culling redirects to/from it). Returns whether a match was promoted. | 266 // when culling redirects to/from it). Returns whether a match was promoted. |
261 bool FixupExactSuggestion(history::URLDatabase* db, | 267 bool FixupExactSuggestion(history::URLDatabase* db, |
262 const VisitClassifier& classifier, | 268 const VisitClassifier& classifier, |
263 HistoryURLProviderParams* params) const; | 269 HistoryURLProviderParams* params) const; |
264 | 270 |
265 // Helper function for FixupExactSuggestion, this returns true if the input | 271 // Helper function for FixupExactSuggestion, this returns true if the input |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 // Used in PromoteOrCreateShorterSuggestion(). If true, we may create | 342 // Used in PromoteOrCreateShorterSuggestion(). If true, we may create |
337 // shorter suggestions even when they haven't been visited before: | 343 // shorter suggestions even when they haven't been visited before: |
338 // if the user visited http://example.com/asdf once, we'll suggest | 344 // if the user visited http://example.com/asdf once, we'll suggest |
339 // http://example.com/ even if they've never been to it. | 345 // http://example.com/ even if they've never been to it. |
340 bool create_shorter_match_; | 346 bool create_shorter_match_; |
341 | 347 |
342 DISALLOW_COPY_AND_ASSIGN(HistoryURLProvider); | 348 DISALLOW_COPY_AND_ASSIGN(HistoryURLProvider); |
343 }; | 349 }; |
344 | 350 |
345 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ | 351 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ |
OLD | NEW |