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 zero-suggest autocomplete provider. This experimental | 5 // This file contains the zero-suggest autocomplete provider. This experimental |
6 // provider is invoked when the user focuses in the omnibox prior to editing, | 6 // provider is invoked when the user focuses in the omnibox prior to editing, |
7 // and generates search query suggestions based on the current URL. To enable | 7 // and generates search query suggestions based on the current URL. To enable |
8 // this provider, point --experimental-zero-suggest-url-prefix at an | 8 // this provider, point --experimental-zero-suggest-url-prefix at an |
9 // appropriate suggestion service. | 9 // appropriate suggestion service. |
10 // | 10 // |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 void MaybeUseCachedSuggestions(); | 127 void MaybeUseCachedSuggestions(); |
128 | 128 |
129 // Used to build default search engine URLs for suggested queries. | 129 // Used to build default search engine URLs for suggested queries. |
130 TemplateURLService* template_url_service_; | 130 TemplateURLService* template_url_service_; |
131 | 131 |
132 // The URL for which a suggestion fetch is pending. | 132 // The URL for which a suggestion fetch is pending. |
133 std::string current_query_; | 133 std::string current_query_; |
134 | 134 |
135 // The type of page the user is viewing (a search results page doing search | 135 // The type of page the user is viewing (a search results page doing search |
136 // term replacement, an arbitrary URL, etc.). | 136 // term replacement, an arbitrary URL, etc.). |
137 AutocompleteInput::PageClassification current_page_classification_; | 137 metrics::OmniboxEventProto::PageClassification current_page_classification_; |
138 | 138 |
139 // Copy of OmniboxEditModel::permanent_text_. | 139 // Copy of OmniboxEditModel::permanent_text_. |
140 base::string16 permanent_text_; | 140 base::string16 permanent_text_; |
141 | 141 |
142 // Fetcher used to retrieve results. | 142 // Fetcher used to retrieve results. |
143 scoped_ptr<net::URLFetcher> fetcher_; | 143 scoped_ptr<net::URLFetcher> fetcher_; |
144 | 144 |
145 // Suggestion for the current URL. | 145 // Suggestion for the current URL. |
146 AutocompleteMatch current_url_match_; | 146 AutocompleteMatch current_url_match_; |
147 | 147 |
148 // Contains suggest and navigation results as well as relevance parsed from | 148 // Contains suggest and navigation results as well as relevance parsed from |
149 // the response for the most recent zero suggest input URL. | 149 // the response for the most recent zero suggest input URL. |
150 Results results_; | 150 Results results_; |
151 | 151 |
152 // Whether we are currently showing cached zero suggest results. | 152 // Whether we are currently showing cached zero suggest results. |
153 bool results_from_cache_; | 153 bool results_from_cache_; |
154 | 154 |
155 history::MostVisitedURLList most_visited_urls_; | 155 history::MostVisitedURLList most_visited_urls_; |
156 | 156 |
157 // For callbacks that may be run after destruction. | 157 // For callbacks that may be run after destruction. |
158 base::WeakPtrFactory<ZeroSuggestProvider> weak_ptr_factory_; | 158 base::WeakPtrFactory<ZeroSuggestProvider> weak_ptr_factory_; |
159 | 159 |
160 DISALLOW_COPY_AND_ASSIGN(ZeroSuggestProvider); | 160 DISALLOW_COPY_AND_ASSIGN(ZeroSuggestProvider); |
161 }; | 161 }; |
162 | 162 |
163 #endif // CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ | 163 #endif // CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ |
OLD | NEW |