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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 virtual void OnProviderUpdate(bool updated_matches) = 0; | 352 virtual void OnProviderUpdate(bool updated_matches) = 0; |
353 | 353 |
354 protected: | 354 protected: |
355 virtual ~ACProviderListener(); | 355 virtual ~ACProviderListener(); |
356 }; | 356 }; |
357 | 357 |
358 AutocompleteProvider(ACProviderListener* listener, | 358 AutocompleteProvider(ACProviderListener* listener, |
359 Profile* profile, | 359 Profile* profile, |
360 const char* name); | 360 const char* name); |
361 | 361 |
362 // Invoked when the profile changes. | |
363 // NOTE: Do not access any previous Profile* at this point as it may have | |
364 // already been deleted. | |
365 void SetProfile(Profile* profile); | |
366 | |
367 // Called to start an autocomplete query. The provider is responsible for | 362 // Called to start an autocomplete query. The provider is responsible for |
368 // tracking its matches for this query and whether it is done processing the | 363 // tracking its matches for this query and whether it is done processing the |
369 // query. When new matches are available or the provider finishes, it | 364 // query. When new matches are available or the provider finishes, it |
370 // calls the controller's OnProviderUpdate() method. The controller can then | 365 // calls the controller's OnProviderUpdate() method. The controller can then |
371 // get the new matches using the provider's accessors. | 366 // get the new matches using the provider's accessors. |
372 // Exception: Matches available immediately after starting the query (that | 367 // Exception: Matches available immediately after starting the query (that |
373 // is, synchronously) do not cause any notifications to be sent. The | 368 // is, synchronously) do not cause any notifications to be sent. The |
374 // controller is expected to check for these without prompting (since | 369 // controller is expected to check for these without prompting (since |
375 // otherwise, starting each provider running would result in a flurry of | 370 // otherwise, starting each provider running would result in a flurry of |
376 // notifications). | 371 // notifications). |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 providers_(providers), | 599 providers_(providers), |
605 keyword_provider_(NULL), | 600 keyword_provider_(NULL), |
606 search_provider_(NULL), | 601 search_provider_(NULL), |
607 done_(true), | 602 done_(true), |
608 in_start_(false), | 603 in_start_(false), |
609 profile_(profile) { | 604 profile_(profile) { |
610 } | 605 } |
611 #endif | 606 #endif |
612 ~AutocompleteController(); | 607 ~AutocompleteController(); |
613 | 608 |
614 // Invoked when the profile changes. This forwards the call down to all | |
615 // the AutocompleteProviders. | |
616 void SetProfile(Profile* profile); | |
617 | |
618 // Starts an autocomplete query, which continues until all providers are | 609 // Starts an autocomplete query, which continues until all providers are |
619 // done or the query is Stop()ed. It is safe to Start() a new query without | 610 // done or the query is Stop()ed. It is safe to Start() a new query without |
620 // Stop()ing the previous one. | 611 // Stop()ing the previous one. |
621 // | 612 // |
622 // See AutocompleteInput::desired_tld() for meaning of |desired_tld|. | 613 // See AutocompleteInput::desired_tld() for meaning of |desired_tld|. |
623 // | 614 // |
624 // |prevent_inline_autocomplete| is true if the generated result set should | 615 // |prevent_inline_autocomplete| is true if the generated result set should |
625 // not require inline autocomplete for the default match. This is difficult | 616 // not require inline autocomplete for the default match. This is difficult |
626 // to explain in the abstract; the practical use case is that after the user | 617 // to explain in the abstract; the practical use case is that after the user |
627 // deletes text in the edit, the HistoryURLProvider should make sure not to | 618 // deletes text in the edit, the HistoryURLProvider should make sure not to |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 AutocompleteInput::Type input_type; | 747 AutocompleteInput::Type input_type; |
757 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). | 748 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). |
758 size_t selected_index; | 749 size_t selected_index; |
759 // Inline autocompleted length (if displayed). | 750 // Inline autocompleted length (if displayed). |
760 size_t inline_autocompleted_length; | 751 size_t inline_autocompleted_length; |
761 // Result set. | 752 // Result set. |
762 const AutocompleteResult& result; | 753 const AutocompleteResult& result; |
763 }; | 754 }; |
764 | 755 |
765 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ | 756 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ |
OLD | NEW |