| 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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_HISTORY_QUICK_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_HISTORY_QUICK_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_QUICK_PROVIDER_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_QUICK_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // This class is an autocomplete provider (a pseudo-internal component of | 24 // This class is an autocomplete provider (a pseudo-internal component of |
| 25 // the history system) which quickly (and synchronously) provides matching | 25 // the history system) which quickly (and synchronously) provides matching |
| 26 // results from recently or frequently visited sites in the profile's | 26 // results from recently or frequently visited sites in the profile's |
| 27 // history. | 27 // history. |
| 28 class HistoryQuickProvider : public HistoryProvider { | 28 class HistoryQuickProvider : public HistoryProvider { |
| 29 public: | 29 public: |
| 30 explicit HistoryQuickProvider(Profile* profile); | 30 explicit HistoryQuickProvider(Profile* profile); |
| 31 | 31 |
| 32 // AutocompleteProvider. |minimal_changes| is ignored since there is no asynch | 32 // AutocompleteProvider. |minimal_changes| is ignored since there is no asynch |
| 33 // completion performed. | 33 // completion performed. |
| 34 virtual void Start(const AutocompleteInput& input, | 34 void Start(const AutocompleteInput& input, bool minimal_changes) override; |
| 35 bool minimal_changes) override; | |
| 36 | 35 |
| 37 // Disable this provider. For unit testing purposes only. This is required | 36 // Disable this provider. For unit testing purposes only. This is required |
| 38 // because this provider is closely associated with the HistoryURLProvider | 37 // because this provider is closely associated with the HistoryURLProvider |
| 39 // and in order to properly test the latter the HistoryQuickProvider must | 38 // and in order to properly test the latter the HistoryQuickProvider must |
| 40 // be disabled. | 39 // be disabled. |
| 41 // TODO(mrossetti): Eliminate this once the HUP has been refactored. | 40 // TODO(mrossetti): Eliminate this once the HUP has been refactored. |
| 42 static void set_disabled(bool disabled) { disabled_ = disabled; } | 41 static void set_disabled(bool disabled) { disabled_ = disabled; } |
| 43 | 42 |
| 44 private: | 43 private: |
| 45 friend class HistoryQuickProviderTest; | 44 friend class HistoryQuickProviderTest; |
| 46 FRIEND_TEST_ALL_PREFIXES(HistoryQuickProviderTest, Spans); | 45 FRIEND_TEST_ALL_PREFIXES(HistoryQuickProviderTest, Spans); |
| 47 FRIEND_TEST_ALL_PREFIXES(HistoryQuickProviderTest, Relevance); | 46 FRIEND_TEST_ALL_PREFIXES(HistoryQuickProviderTest, Relevance); |
| 48 | 47 |
| 49 virtual ~HistoryQuickProvider(); | 48 ~HistoryQuickProvider() override; |
| 50 | 49 |
| 51 // Performs the autocomplete matching and scoring. | 50 // Performs the autocomplete matching and scoring. |
| 52 void DoAutocomplete(); | 51 void DoAutocomplete(); |
| 53 | 52 |
| 54 // Creates an AutocompleteMatch from |history_match|, assigning it | 53 // Creates an AutocompleteMatch from |history_match|, assigning it |
| 55 // the score |score|. | 54 // the score |score|. |
| 56 AutocompleteMatch QuickMatchToACMatch( | 55 AutocompleteMatch QuickMatchToACMatch( |
| 57 const history::ScoredHistoryMatch& history_match, | 56 const history::ScoredHistoryMatch& history_match, |
| 58 int score); | 57 int score); |
| 59 | 58 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 71 // Only used for testing. | 70 // Only used for testing. |
| 72 scoped_ptr<history::InMemoryURLIndex> index_for_testing_; | 71 scoped_ptr<history::InMemoryURLIndex> index_for_testing_; |
| 73 | 72 |
| 74 // This provider is disabled when true. | 73 // This provider is disabled when true. |
| 75 static bool disabled_; | 74 static bool disabled_; |
| 76 | 75 |
| 77 DISALLOW_COPY_AND_ASSIGN(HistoryQuickProvider); | 76 DISALLOW_COPY_AND_ASSIGN(HistoryQuickProvider); |
| 78 }; | 77 }; |
| 79 | 78 |
| 80 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_QUICK_PROVIDER_H_ | 79 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_QUICK_PROVIDER_H_ |
| OLD | NEW |