OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 // Returns the name of this provider. | 395 // Returns the name of this provider. |
396 const char* name() const { return name_; } | 396 const char* name() const { return name_; } |
397 | 397 |
398 // Called to delete a match and the backing data that produced it. This | 398 // Called to delete a match and the backing data that produced it. This |
399 // match should not appear again in this or future queries. This can only be | 399 // match should not appear again in this or future queries. This can only be |
400 // called for matches the provider marks as deletable. This should only be | 400 // called for matches the provider marks as deletable. This should only be |
401 // called when no query is running. | 401 // called when no query is running. |
402 // NOTE: Remember to call OnProviderUpdate() if matches_ is updated. | 402 // NOTE: Remember to call OnProviderUpdate() if matches_ is updated. |
403 virtual void DeleteMatch(const AutocompleteMatch& match); | 403 virtual void DeleteMatch(const AutocompleteMatch& match); |
404 | 404 |
| 405 // Invoked after combining the results from all providers (including sorting, |
| 406 // culling and all that) but before the AutocompleteController's delegate is |
| 407 // notified. This is exposed to allow providers to alter the descriptions of |
| 408 // matches based on position in the final result set. Providers should not use |
| 409 // this to add new matches. |
| 410 virtual void PostProcessResult(AutocompleteResult* result); |
| 411 |
| 412 #ifdef UNIT_TEST |
| 413 void set_listener(ACProviderListener* listener) { listener_ = listener; } |
| 414 #endif |
405 // A suggested upper bound for how many matches a provider should return. | 415 // A suggested upper bound for how many matches a provider should return. |
406 // TODO(pkasting): http://b/1111299 , http://b/933133 This should go away once | 416 // TODO(pkasting): http://b/1111299 , http://b/933133 This should go away once |
407 // we have good relevance heuristics; the controller should handle all | 417 // we have good relevance heuristics; the controller should handle all |
408 // culling. | 418 // culling. |
409 static const size_t kMaxMatches; | 419 static const size_t kMaxMatches; |
410 | 420 |
411 protected: | 421 protected: |
412 friend class base::RefCountedThreadSafe<AutocompleteProvider>; | 422 friend class base::RefCountedThreadSafe<AutocompleteProvider>; |
413 | 423 |
414 virtual ~AutocompleteProvider(); | 424 virtual ~AutocompleteProvider(); |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 AutocompleteInput::Type input_type; | 742 AutocompleteInput::Type input_type; |
733 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). | 743 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). |
734 size_t selected_index; | 744 size_t selected_index; |
735 // Inline autocompleted length (if displayed). | 745 // Inline autocompleted length (if displayed). |
736 size_t inline_autocompleted_length; | 746 size_t inline_autocompleted_length; |
737 // Result set. | 747 // Result set. |
738 const AutocompleteResult& result; | 748 const AutocompleteResult& result; |
739 }; | 749 }; |
740 | 750 |
741 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ | 751 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ |
OLD | NEW |