| 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 autocomplete entries that start with "Search <engine> | 6 // responsible for all autocomplete entries that start with "Search <engine> |
| 7 // for ...", including searching for the current input string, search | 7 // for ...", including searching for the current input string, search |
| 8 // history, and search suggestions. An instance of it gets created and | 8 // 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 void ApplyCalculatedRelevance(); | 403 void ApplyCalculatedRelevance(); |
| 404 void ApplyCalculatedSuggestRelevance(SuggestResults* list); | 404 void ApplyCalculatedSuggestRelevance(SuggestResults* list); |
| 405 void ApplyCalculatedNavigationRelevance(NavigationResults* list); | 405 void ApplyCalculatedNavigationRelevance(NavigationResults* list); |
| 406 | 406 |
| 407 // Starts a new URLFetcher requesting suggest results from |template_url|; | 407 // Starts a new URLFetcher requesting suggest results from |template_url|; |
| 408 // callers own the returned URLFetcher, which is NULL for invalid providers. | 408 // callers own the returned URLFetcher, which is NULL for invalid providers. |
| 409 net::URLFetcher* CreateSuggestFetcher(int id, | 409 net::URLFetcher* CreateSuggestFetcher(int id, |
| 410 const TemplateURL* template_url, | 410 const TemplateURL* template_url, |
| 411 const AutocompleteInput& input); | 411 const AutocompleteInput& input); |
| 412 | 412 |
| 413 // Parses JSON response received from the provider, stripping XSSI |
| 414 // protection if needed. Returns the parsed data if successful, NULL |
| 415 // otherwise. |
| 416 static scoped_ptr<base::Value> DeserializeJsonData(std::string json_data); |
| 417 |
| 413 // Parses results from the suggest server and updates the appropriate suggest | 418 // Parses results from the suggest server and updates the appropriate suggest |
| 414 // and navigation result lists, depending on whether |is_keyword| is true. | 419 // and navigation result lists, depending on whether |is_keyword| is true. |
| 415 // Returns whether the appropriate result list members were updated. | 420 // Returns whether the appropriate result list members were updated. |
| 416 bool ParseSuggestResults(base::Value* root_val, bool is_keyword); | 421 bool ParseSuggestResults(base::Value* root_val, bool is_keyword); |
| 417 | 422 |
| 418 // Converts the parsed results to a set of AutocompleteMatches, |matches_|. | 423 // Converts the parsed results to a set of AutocompleteMatches, |matches_|. |
| 419 void ConvertResultsToAutocompleteMatches(); | 424 void ConvertResultsToAutocompleteMatches(); |
| 420 | 425 |
| 421 // Returns an iterator to the first match in |matches_| which might | 426 // Returns an iterator to the first match in |matches_| which might |
| 422 // be chosen as default. If | 427 // be chosen as default. If |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 // If true, search history query suggestions will score low enough that | 638 // If true, search history query suggestions will score low enough that |
| 634 // they will not be inlined. | 639 // they will not be inlined. |
| 635 bool prevent_search_history_inlining_; | 640 bool prevent_search_history_inlining_; |
| 636 | 641 |
| 637 GURL current_page_url_; | 642 GURL current_page_url_; |
| 638 | 643 |
| 639 DISALLOW_COPY_AND_ASSIGN(SearchProvider); | 644 DISALLOW_COPY_AND_ASSIGN(SearchProvider); |
| 640 }; | 645 }; |
| 641 | 646 |
| 642 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ | 647 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ |
| OLD | NEW |