| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 // based on server information, and thus is assumed to be more accurate. | 233 // based on server information, and thus is assumed to be more accurate. |
| 234 // This is ultimately used in | 234 // This is ultimately used in |
| 235 // SearchProvider::ConvertResultsToAutocompleteMatches(), see comments | 235 // SearchProvider::ConvertResultsToAutocompleteMatches(), see comments |
| 236 // there. | 236 // there. |
| 237 bool relevance_from_server_; | 237 bool relevance_from_server_; |
| 238 }; | 238 }; |
| 239 | 239 |
| 240 class SuggestResult : public Result { | 240 class SuggestResult : public Result { |
| 241 public: | 241 public: |
| 242 SuggestResult(const base::string16& suggestion, | 242 SuggestResult(const base::string16& suggestion, |
| 243 AutocompleteMatchType::Type type, |
| 243 const base::string16& match_contents, | 244 const base::string16& match_contents, |
| 244 const base::string16& annotation, | 245 const base::string16& annotation, |
| 245 const std::string& suggest_query_params, | 246 const std::string& suggest_query_params, |
| 246 const std::string& deletion_url, | 247 const std::string& deletion_url, |
| 247 bool from_keyword_provider, | 248 bool from_keyword_provider, |
| 248 int relevance, | 249 int relevance, |
| 249 bool relevance_from_server, | 250 bool relevance_from_server, |
| 250 bool should_prefetch); | 251 bool should_prefetch); |
| 251 virtual ~SuggestResult(); | 252 virtual ~SuggestResult(); |
| 252 | 253 |
| 253 const base::string16& suggestion() const { return suggestion_; } | 254 const base::string16& suggestion() const { return suggestion_; } |
| 255 AutocompleteMatchType::Type type() const { return type_; } |
| 254 const base::string16& match_contents() const { return match_contents_; } | 256 const base::string16& match_contents() const { return match_contents_; } |
| 255 const base::string16& annotation() const { return annotation_; } | 257 const base::string16& annotation() const { return annotation_; } |
| 256 const std::string& suggest_query_params() const { | 258 const std::string& suggest_query_params() const { |
| 257 return suggest_query_params_; | 259 return suggest_query_params_; |
| 258 } | 260 } |
| 259 const std::string& deletion_url() const { return deletion_url_; } | 261 const std::string& deletion_url() const { return deletion_url_; } |
| 260 bool should_prefetch() const { return should_prefetch_; } | 262 bool should_prefetch() const { return should_prefetch_; } |
| 261 | 263 |
| 262 // Result: | 264 // Result: |
| 263 virtual bool IsInlineable(const base::string16& input) const OVERRIDE; | 265 virtual bool IsInlineable(const base::string16& input) const OVERRIDE; |
| 264 virtual int CalculateRelevance( | 266 virtual int CalculateRelevance( |
| 265 const AutocompleteInput& input, | 267 const AutocompleteInput& input, |
| 266 bool keyword_provider_requested) const OVERRIDE; | 268 bool keyword_provider_requested) const OVERRIDE; |
| 267 | 269 |
| 268 private: | 270 private: |
| 269 // The search terms to be used for this suggestion. | 271 // The search terms to be used for this suggestion. |
| 270 base::string16 suggestion_; | 272 base::string16 suggestion_; |
| 271 | 273 |
| 274 AutocompleteMatchType::Type type_; |
| 275 |
| 272 // The contents to be displayed in the autocomplete match. | 276 // The contents to be displayed in the autocomplete match. |
| 273 base::string16 match_contents_; | 277 base::string16 match_contents_; |
| 274 | 278 |
| 275 // Optional annotation for the |match_contents_| for disambiguation. | 279 // Optional annotation for the |match_contents_| for disambiguation. |
| 276 // This may be displayed in the autocomplete match contents, but is defined | 280 // This may be displayed in the autocomplete match contents, but is defined |
| 277 // separately to facilitate different formatting. | 281 // separately to facilitate different formatting. |
| 278 base::string16 annotation_; | 282 base::string16 annotation_; |
| 279 | 283 |
| 280 // Optional additional parameters to be added to the search URL. | 284 // Optional additional parameters to be added to the search URL. |
| 281 std::string suggest_query_params_; | 285 std::string suggest_query_params_; |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 // If true, search history query suggestions will score low enough that | 680 // If true, search history query suggestions will score low enough that |
| 677 // they will not be inlined. | 681 // they will not be inlined. |
| 678 bool prevent_search_history_inlining_; | 682 bool prevent_search_history_inlining_; |
| 679 | 683 |
| 680 GURL current_page_url_; | 684 GURL current_page_url_; |
| 681 | 685 |
| 682 DISALLOW_COPY_AND_ASSIGN(SearchProvider); | 686 DISALLOW_COPY_AND_ASSIGN(SearchProvider); |
| 683 }; | 687 }; |
| 684 | 688 |
| 685 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ | 689 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ |
| OLD | NEW |