Chromium Code Reviews| 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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 593 // Used to indicate an index that is not selected in a call to Update(). | 593 // Used to indicate an index that is not selected in a call to Update(). |
| 594 static const int kNoItemSelected; | 594 static const int kNoItemSelected; |
| 595 | 595 |
| 596 // Normally, you will call the first constructor. Unit tests can use the | 596 // Normally, you will call the first constructor. Unit tests can use the |
| 597 // second to set the providers to some known testing providers. The default | 597 // second to set the providers to some known testing providers. The default |
| 598 // providers will be overridden and the controller will take ownership of the | 598 // providers will be overridden and the controller will take ownership of the |
| 599 // providers, Release()ing them on destruction. | 599 // providers, Release()ing them on destruction. |
| 600 AutocompleteController(Profile* profile, | 600 AutocompleteController(Profile* profile, |
| 601 AutocompleteControllerDelegate* delegate); | 601 AutocompleteControllerDelegate* delegate); |
| 602 #ifdef UNIT_TEST | 602 #ifdef UNIT_TEST |
| 603 explicit AutocompleteController(const ACProviders& providers) | 603 explicit AutocompleteController(const ACProviders& providers, |
|
sky
2011/07/12 00:37:50
no explicit
sreeram
2011/07/12 03:36:18
Good catch! Will do in the next patch.
| |
| 604 Profile* profile) | |
| 604 : delegate_(NULL), | 605 : delegate_(NULL), |
| 605 providers_(providers), | 606 providers_(providers), |
| 606 search_provider_(NULL), | 607 search_provider_(NULL), |
| 607 done_(true), | 608 done_(true), |
| 608 in_start_(false) { | 609 in_start_(false), |
| 610 profile_(profile) { | |
| 609 } | 611 } |
| 610 #endif | 612 #endif |
| 611 ~AutocompleteController(); | 613 ~AutocompleteController(); |
| 612 | 614 |
| 613 // Invoked when the profile changes. This forwards the call down to all | 615 // Invoked when the profile changes. This forwards the call down to all |
| 614 // the AutocompleteProviders. | 616 // the AutocompleteProviders. |
| 615 void SetProfile(Profile* profile); | 617 void SetProfile(Profile* profile); |
| 616 | 618 |
| 617 // Starts an autocomplete query, which continues until all providers are | 619 // Starts an autocomplete query, which continues until all providers are |
| 618 // done or the query is Stop()ed. It is safe to Start() a new query without | 620 // done or the query is Stop()ed. It is safe to Start() a new query without |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 710 // invokes |ExpireCopiedEntries|. | 712 // invokes |ExpireCopiedEntries|. |
| 711 base::OneShotTimer<AutocompleteController> expire_timer_; | 713 base::OneShotTimer<AutocompleteController> expire_timer_; |
| 712 | 714 |
| 713 // True if a query is not currently running. | 715 // True if a query is not currently running. |
| 714 bool done_; | 716 bool done_; |
| 715 | 717 |
| 716 // Are we in Start()? This is used to avoid updating |result_| and sending | 718 // Are we in Start()? This is used to avoid updating |result_| and sending |
| 717 // notifications until Start() has been invoked on all providers. | 719 // notifications until Start() has been invoked on all providers. |
| 718 bool in_start_; | 720 bool in_start_; |
| 719 | 721 |
| 722 Profile* profile_; | |
| 723 | |
| 720 DISALLOW_COPY_AND_ASSIGN(AutocompleteController); | 724 DISALLOW_COPY_AND_ASSIGN(AutocompleteController); |
| 721 }; | 725 }; |
| 722 | 726 |
| 723 // AutocompleteLog ------------------------------------------------------------ | 727 // AutocompleteLog ------------------------------------------------------------ |
| 724 | 728 |
| 725 // The data to log (via the metrics service) when the user selects an item | 729 // The data to log (via the metrics service) when the user selects an item |
| 726 // from the omnibox popup. | 730 // from the omnibox popup. |
| 727 struct AutocompleteLog { | 731 struct AutocompleteLog { |
| 728 AutocompleteLog(const string16& text, | 732 AutocompleteLog(const string16& text, |
| 729 AutocompleteInput::Type input_type, | 733 AutocompleteInput::Type input_type, |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 742 AutocompleteInput::Type input_type; | 746 AutocompleteInput::Type input_type; |
| 743 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). | 747 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). |
| 744 size_t selected_index; | 748 size_t selected_index; |
| 745 // Inline autocompleted length (if displayed). | 749 // Inline autocompleted length (if displayed). |
| 746 size_t inline_autocompleted_length; | 750 size_t inline_autocompleted_length; |
| 747 // Result set. | 751 // Result set. |
| 748 const AutocompleteResult& result; | 752 const AutocompleteResult& result; |
| 749 }; | 753 }; |
| 750 | 754 |
| 751 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ | 755 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ |
| OLD | NEW |