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 // This file contains the Search autocomplete provider. This provider is | 5 // This file contains the Search autocomplete provider. This provider is |
6 // responsible for all non-keyword autocomplete entries that start with | 6 // responsible for all non-keyword autocomplete entries that start with |
7 // "Search <engine> for ...", including searching for the current input string, | 7 // "Search <engine> for ...", including searching for the current input string, |
8 // search history, and search suggestions. An instance of it gets created and | 8 // search history, and search suggestions. An instance of it gets created and |
9 // managed by the autocomplete controller. | 9 // managed by the autocomplete controller. |
10 | 10 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 // Parses results from the suggest server and updates the appropriate suggest | 244 // Parses results from the suggest server and updates the appropriate suggest |
245 // and navigation result lists, depending on whether |is_keyword| is true. | 245 // and navigation result lists, depending on whether |is_keyword| is true. |
246 // Returns whether the appropriate result list members were updated. | 246 // Returns whether the appropriate result list members were updated. |
247 bool ParseSuggestResults(base::Value* root_val, bool is_keyword); | 247 bool ParseSuggestResults(base::Value* root_val, bool is_keyword); |
248 | 248 |
249 // Converts the parsed results to a set of AutocompleteMatches, |matches_|. | 249 // Converts the parsed results to a set of AutocompleteMatches, |matches_|. |
250 void ConvertResultsToAutocompleteMatches(); | 250 void ConvertResultsToAutocompleteMatches(); |
251 | 251 |
252 // Checks if suggested relevances violate certain expected constraints. | 252 // Checks if suggested relevances violate certain expected constraints. |
253 // See UpdateMatches() for the use and explanation of these constraints. | 253 // See UpdateMatches() for the use and explanation of these constraints. |
254 bool IsTopMatchScoreTooLow() const; | 254 // We pass in keyword_search_what_you_typed_relevance because the |
255 bool IsTopMatchHighRankSearchForURL() const; | 255 // keyword verbatim result is not in |matches_| but can be important in |
256 bool IsTopMatchNotInlinable() const; | 256 // testing these constraints if it's high-ranked than the best result |
Peter Kasting
2013/01/21 20:22:57
Nit: high-ranked -> ranked higher?
Mark P
2013/01/21 20:57:45
Rephrased for precision and readability.
| |
257 // in |matches_|. | |
258 bool IsTopMatchScoreTooLow( | |
Peter Kasting
2013/01/21 20:22:57
Nit: We may want to comment what some of these tes
Mark P
2013/01/21 20:57:45
These are explained in UpdateMatch(). (Note the c
| |
259 int keyword_search_what_you_typed_relevance) const; | |
260 bool IsTopMatchHighRankSearchForURL( | |
261 int keyword_search_what_you_typed_relevance) const; | |
262 bool IsTopMatchNotInlinable( | |
263 int keyword_search_what_you_typed_relevance) const; | |
257 | 264 |
258 // Updates |matches_| from the latest results; applies calculated relevances | 265 // Updates |matches_| from the latest results; applies calculated relevances |
259 // if suggested relevances cause undesriable behavior. Updates |done_|. | 266 // if suggested relevances cause undesriable behavior. Updates |done_|. |
260 void UpdateMatches(); | 267 void UpdateMatches(); |
261 | 268 |
262 // Converts the top navigation result in |navigation_results| to an | 269 // Converts the top navigation result in |navigation_results| to an |
263 // AutocompleteMatch and adds it to |matches_|. |is_keyword| must be true if | 270 // AutocompleteMatch and adds it to |matches_|. |is_keyword| must be true if |
264 // the results come from the keyword provider. | 271 // the results come from the keyword provider. |
265 void AddNavigationResultsToMatches( | 272 void AddNavigationResultsToMatches( |
266 const NavigationResults& navigation_results, | 273 const NavigationResults& navigation_results, |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
384 bool field_trial_triggered_; | 391 bool field_trial_triggered_; |
385 | 392 |
386 // Same as above except that it is maintained across the current Omnibox | 393 // Same as above except that it is maintained across the current Omnibox |
387 // session. | 394 // session. |
388 bool field_trial_triggered_in_session_; | 395 bool field_trial_triggered_in_session_; |
389 | 396 |
390 DISALLOW_COPY_AND_ASSIGN(SearchProvider); | 397 DISALLOW_COPY_AND_ASSIGN(SearchProvider); |
391 }; | 398 }; |
392 | 399 |
393 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ | 400 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ |
OLD | NEW |