| 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_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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // AutocompleteProvider. |minimal_changes| is ignored since there | 33 // AutocompleteProvider. |minimal_changes| is ignored since there |
| 34 // is no asynch completion performed. | 34 // is no asynch completion performed. |
| 35 virtual void Start(const AutocompleteInput& input, | 35 virtual void Start(const AutocompleteInput& input, |
| 36 bool minimal_changes) OVERRIDE; | 36 bool minimal_changes) OVERRIDE; |
| 37 | 37 |
| 38 virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE; | 38 virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE; |
| 39 | 39 |
| 40 // Performs the autocomplete matching and scoring. | 40 // Performs the autocomplete matching and scoring. |
| 41 void DoAutocomplete(); | 41 void DoAutocomplete(); |
| 42 | 42 |
| 43 // Disable this provider. For unit testing purposes only. This is required |
| 44 // because this provider is closely associated with the HistoryURLProvider |
| 45 // and in order to properly test the latter the HistoryQuickProvider must |
| 46 // be disabled. |
| 47 // TODO(mrossetti): Eliminate this once the HUP has been refactored. |
| 48 static void set_disabled(bool disabled) { disabled_ = disabled; } |
| 49 |
| 43 private: | 50 private: |
| 44 friend class HistoryQuickProviderTest; | 51 friend class HistoryQuickProviderTest; |
| 45 FRIEND_TEST_ALL_PREFIXES(HistoryQuickProviderTest, Spans); | 52 FRIEND_TEST_ALL_PREFIXES(HistoryQuickProviderTest, Spans); |
| 46 FRIEND_TEST_ALL_PREFIXES(HistoryQuickProviderTest, Relevance); | 53 FRIEND_TEST_ALL_PREFIXES(HistoryQuickProviderTest, Relevance); |
| 47 | 54 |
| 48 // The initial maximum allowable score for a match which cannot be inlined. | 55 // The initial maximum allowable score for a match which cannot be inlined. |
| 49 static const int kMaxNonInliningScore; | 56 static const int kMaxNonInliningScore; |
| 50 | 57 |
| 51 // Creates an AutocompleteMatch from |history_match|. |max_match_score| gives | 58 // Creates an AutocompleteMatch from |history_match|. |max_match_score| gives |
| 52 // the maximum possible score for the match. |history_matches| is the full set | 59 // the maximum possible score for the match. |history_matches| is the full set |
| (...skipping 29 matching lines...) Expand all Loading... |
| 82 size_t text_length, | 89 size_t text_length, |
| 83 bool is_url); | 90 bool is_url); |
| 84 | 91 |
| 85 // Only for use in unittests. Takes ownership of |index|. | 92 // Only for use in unittests. Takes ownership of |index|. |
| 86 void SetIndexForTesting(history::InMemoryURLIndex* index); | 93 void SetIndexForTesting(history::InMemoryURLIndex* index); |
| 87 AutocompleteInput autocomplete_input_; | 94 AutocompleteInput autocomplete_input_; |
| 88 std::string languages_; | 95 std::string languages_; |
| 89 | 96 |
| 90 // Only used for testing. | 97 // Only used for testing. |
| 91 scoped_ptr<history::InMemoryURLIndex> index_for_testing_; | 98 scoped_ptr<history::InMemoryURLIndex> index_for_testing_; |
| 99 |
| 100 // This provider is disabled when true. |
| 101 static bool disabled_; |
| 92 }; | 102 }; |
| 93 | 103 |
| 94 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_QUICK_PROVIDER_H_ | 104 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_QUICK_PROVIDER_H_ |
| OLD | NEW |