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 27 matching lines...) Expand all Loading... |
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 private: | 43 private: |
44 friend class HistoryQuickProviderTest; | 44 friend class HistoryQuickProviderTest; |
45 FRIEND_TEST_ALL_PREFIXES(HistoryQuickProviderTest, Spans); | 45 FRIEND_TEST_ALL_PREFIXES(HistoryQuickProviderTest, Spans); |
46 FRIEND_TEST_ALL_PREFIXES(HistoryQuickProviderTest, Relevance); | 46 FRIEND_TEST_ALL_PREFIXES(HistoryQuickProviderTest, Relevance); |
47 | 47 |
| 48 // The initial maximum allowable score for a match which cannot be inlined. |
| 49 static const int kMaxNonInliningScore; |
| 50 |
48 // Creates an AutocompleteMatch from |history_match|. |max_match_score| gives | 51 // Creates an AutocompleteMatch from |history_match|. |max_match_score| gives |
49 // the maximum possible score for the match. | 52 // the maximum possible score for the match. |
50 AutocompleteMatch QuickMatchToACMatch( | 53 AutocompleteMatch QuickMatchToACMatch( |
51 const history::ScoredHistoryMatch& history_match, | 54 const history::ScoredHistoryMatch& history_match, |
52 bool prevent_inline_autocomplete, | 55 bool prevent_inline_autocomplete, |
53 int* max_match_score); | 56 int* max_match_score); |
54 | 57 |
55 // Determines the relevance score of |history_match|. The maximum allowed | 58 // Determines the relevance score of |history_match|. The maximum allowed |
56 // score for the match is passed in |max_match_score|. The |max_match_score| | 59 // score for the match is passed in |max_match_score|. The |max_match_score| |
57 // is always set to the resulting score minus 1 whenever the match's score | 60 // is always set to the resulting score minus 1 whenever the match's score |
(...skipping 16 matching lines...) Expand all Loading... |
74 // Only for use in unittests. Takes ownership of |index|. | 77 // Only for use in unittests. Takes ownership of |index|. |
75 void SetIndexForTesting(history::InMemoryURLIndex* index); | 78 void SetIndexForTesting(history::InMemoryURLIndex* index); |
76 AutocompleteInput autocomplete_input_; | 79 AutocompleteInput autocomplete_input_; |
77 std::string languages_; | 80 std::string languages_; |
78 | 81 |
79 // Only used for testing. | 82 // Only used for testing. |
80 scoped_ptr<history::InMemoryURLIndex> index_for_testing_; | 83 scoped_ptr<history::InMemoryURLIndex> index_for_testing_; |
81 }; | 84 }; |
82 | 85 |
83 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_QUICK_PROVIDER_H_ | 86 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_QUICK_PROVIDER_H_ |
OLD | NEW |