Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 497 GURL alternate_nav_url() const { return alternate_nav_url_; } | 497 GURL alternate_nav_url() const { return alternate_nav_url_; } |
| 498 | 498 |
| 499 // Clears the matches for this result set. | 499 // Clears the matches for this result set. |
| 500 void Reset(); | 500 void Reset(); |
| 501 | 501 |
| 502 #ifndef NDEBUG | 502 #ifndef NDEBUG |
| 503 // Does a data integrity check on this result. | 503 // Does a data integrity check on this result. |
| 504 void Validate() const; | 504 void Validate() const; |
| 505 #endif | 505 #endif |
| 506 | 506 |
| 507 // Max number of matches we'll show from the various providers. We may end | 507 // Max number of matches we'll show from the various providers. |
| 508 // up showing an additional shortcut for Destinations->History, see | |
| 509 // AddHistoryContentsShortcut. | |
| 510 static const size_t kMaxMatches; | 508 static const size_t kMaxMatches; |
| 511 | 509 |
| 512 private: | 510 private: |
| 513 ACMatches matches_; | 511 ACMatches matches_; |
| 514 | 512 |
| 515 const_iterator default_match_; | 513 const_iterator default_match_; |
| 516 | 514 |
| 517 // The "alternate navigation URL", if any, for this result set. This is a URL | 515 // The "alternate navigation URL", if any, for this result set. This is a URL |
| 518 // to try offering as a navigational option in case the user navigated to the | 516 // to try offering as a navigational option in case the user navigated to the |
| 519 // URL of the default match but intended something else. For example, if the | 517 // URL of the default match but intended something else. For example, if the |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 635 void DelayTimerFired(); | 633 void DelayTimerFired(); |
| 636 | 634 |
| 637 // Copies |latest_result_| to |result_| and notifies observers of updates. | 635 // Copies |latest_result_| to |result_| and notifies observers of updates. |
| 638 // |notify_default_match| should normally be true; if it's false, we don't | 636 // |notify_default_match| should normally be true; if it's false, we don't |
| 639 // send an AUTOCOMPLETE_CONTROLLER_DEFAULT_MATCH_UPDATED notification. This | 637 // send an AUTOCOMPLETE_CONTROLLER_DEFAULT_MATCH_UPDATED notification. This |
| 640 // is a hack to avoid updating the edit with out-of-date data. | 638 // is a hack to avoid updating the edit with out-of-date data. |
| 641 // TODO(pkasting): Don't hardcode assumptions about who listens to these | 639 // TODO(pkasting): Don't hardcode assumptions about who listens to these |
| 642 // notificiations. | 640 // notificiations. |
| 643 void CommitResult(bool notify_default_match); | 641 void CommitResult(bool notify_default_match); |
| 644 | 642 |
| 645 // Returns the matches from |provider| whose destination urls are not in | |
| 646 // |latest_result_|. | |
| 647 ACMatches GetMatchesNotInLatestResult( | |
| 648 const AutocompleteProvider* provider) const; | |
| 649 | |
| 650 // If the HistoryContentsAutocomplete provider is done and there are more | |
| 651 // matches in the database than currently shown, an entry is added to | |
| 652 // |latest_result_| to show all history matches. | |
| 653 void AddHistoryContentsShortcut(); | |
| 654 | |
| 655 // Updates |done_| to be accurate with respect to current providers' statuses. | 643 // Updates |done_| to be accurate with respect to current providers' statuses. |
| 656 void CheckIfDone(); | 644 void CheckIfDone(); |
| 657 | 645 |
| 658 // A list of all providers. | 646 // A list of all providers. |
| 659 ACProviders providers_; | 647 ACProviders providers_; |
| 660 | 648 |
| 661 HistoryContentsProvider* history_contents_provider_; | 649 HistoryContentsProvider* history_contents_provider_; |
|
Peter Kasting
2011/01/19 20:02:36
Seems like we can get rid of this and its referenc
| |
| 662 | 650 |
| 663 SearchProvider* search_provider_; | 651 SearchProvider* search_provider_; |
| 664 | 652 |
| 665 // Input passed to Start. | 653 // Input passed to Start. |
| 666 AutocompleteInput input_; | 654 AutocompleteInput input_; |
| 667 | 655 |
| 668 // Data from the autocomplete query. | 656 // Data from the autocomplete query. |
| 669 AutocompleteResult result_; | 657 AutocompleteResult result_; |
| 670 | 658 |
| 671 // The latest result available from the autocomplete providers. This may be | 659 // The latest result available from the autocomplete providers. This may be |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 731 AutocompleteInput::Type input_type; | 719 AutocompleteInput::Type input_type; |
| 732 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). | 720 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). |
| 733 size_t selected_index; | 721 size_t selected_index; |
| 734 // Inline autocompleted length (if displayed). | 722 // Inline autocompleted length (if displayed). |
| 735 size_t inline_autocompleted_length; | 723 size_t inline_autocompleted_length; |
| 736 // Result set. | 724 // Result set. |
| 737 const AutocompleteResult& result; | 725 const AutocompleteResult& result; |
| 738 }; | 726 }; |
| 739 | 727 |
| 740 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ | 728 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ |
| OLD | NEW |