| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // suggestions. | 52 // suggestions. |
| 53 class SearchProvider : public AutocompleteProvider, | 53 class SearchProvider : public AutocompleteProvider, |
| 54 public net::URLFetcherDelegate { | 54 public net::URLFetcherDelegate { |
| 55 public: | 55 public: |
| 56 // ID used in creating URLFetcher for default provider's suggest results. | 56 // ID used in creating URLFetcher for default provider's suggest results. |
| 57 static const int kDefaultProviderURLFetcherID; | 57 static const int kDefaultProviderURLFetcherID; |
| 58 | 58 |
| 59 // ID used in creating URLFetcher for keyword provider's suggest results. | 59 // ID used in creating URLFetcher for keyword provider's suggest results. |
| 60 static const int kKeywordProviderURLFetcherID; | 60 static const int kKeywordProviderURLFetcherID; |
| 61 | 61 |
| 62 // Returns an AutocompleteMatch representing a search for |query_string| |
| 63 // using the provider identified by |keyword|. |is_keyword| should be true if |
| 64 // |input| represents a keyword search (even if it's for the default search |
| 65 // provider). |input_text| (the original input text) and |accepted_suggestion| |
| 66 // are used to generate Assisted Query Stats. |
| 67 // Returns a match with an invalid destination_url in case of any errors. |
| 68 static AutocompleteMatch CreateSearchSuggestion( |
| 69 Profile* profile, |
| 70 AutocompleteProvider* autocomplete_provider, |
| 71 const AutocompleteInput& input, |
| 72 const string16& query_string, |
| 73 const string16& input_text, |
| 74 int relevance, |
| 75 AutocompleteMatch::Type type, |
| 76 int accepted_suggestion, |
| 77 bool is_keyword, |
| 78 const string16& keyword); |
| 79 |
| 62 SearchProvider(AutocompleteProviderListener* listener, Profile* profile); | 80 SearchProvider(AutocompleteProviderListener* listener, Profile* profile); |
| 63 | 81 |
| 64 // Marks the instant query as done. If |input_text| is non-empty this changes | 82 // Marks the instant query as done. If |input_text| is non-empty this changes |
| 65 // the 'search what you typed' results text to |input_text| + | 83 // the 'search what you typed' results text to |input_text| + |
| 66 // |suggestion.text|. |input_text| is the text the user input into the edit. | 84 // |suggestion.text|. |input_text| is the text the user input into the edit. |
| 67 // |input_text| differs from |input_.text()| if the input contained | 85 // |input_text| differs from |input_.text()| if the input contained |
| 68 // whitespace. | 86 // whitespace. |
| 69 // | 87 // |
| 70 // This method also marks the search provider as no longer needing to wait for | 88 // This method also marks the search provider as no longer needing to wait for |
| 71 // the instant result. | 89 // the instant result. |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 bool field_trial_triggered_; | 486 bool field_trial_triggered_; |
| 469 | 487 |
| 470 // Same as above except that it is maintained across the current Omnibox | 488 // Same as above except that it is maintained across the current Omnibox |
| 471 // session. | 489 // session. |
| 472 bool field_trial_triggered_in_session_; | 490 bool field_trial_triggered_in_session_; |
| 473 | 491 |
| 474 DISALLOW_COPY_AND_ASSIGN(SearchProvider); | 492 DISALLOW_COPY_AND_ASSIGN(SearchProvider); |
| 475 }; | 493 }; |
| 476 | 494 |
| 477 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ | 495 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ |
| OLD | NEW |