OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_RESULT_H_ | 5 #ifndef COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_RESULT_H_ |
6 #define COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_RESULT_H_ | 6 #define COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_RESULT_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 const AutocompleteProvider* provider_affinity; | 52 const AutocompleteProvider* provider_affinity; |
53 | 53 |
54 // True when this is the HistoryURLProvider's "what you typed" match. This | 54 // True when this is the HistoryURLProvider's "what you typed" match. This |
55 // can't be tracked using |destination_url| because its URL changes on every | 55 // can't be tracked using |destination_url| because its URL changes on every |
56 // keystroke, so if this is set, we'll preserve the selection by simply | 56 // keystroke, so if this is set, we'll preserve the selection by simply |
57 // choosing the new "what you typed" entry and ignoring |destination_url|. | 57 // choosing the new "what you typed" entry and ignoring |destination_url|. |
58 bool is_history_what_you_typed_match; | 58 bool is_history_what_you_typed_match; |
59 }; | 59 }; |
60 | 60 |
61 // Max number of matches we'll show from the various providers. | 61 // Max number of matches we'll show from the various providers. |
62 static const size_t kMaxMatches; | 62 static size_t GetMaxMatches(); |
63 | 63 |
64 AutocompleteResult(); | 64 AutocompleteResult(); |
65 ~AutocompleteResult(); | 65 ~AutocompleteResult(); |
66 | 66 |
67 // Copies matches from |old_matches| to provide a consistant result set. See | 67 // Copies matches from |old_matches| to provide a consistant result set. See |
68 // comments in code for specifics. | 68 // comments in code for specifics. |
69 void CopyOldMatches(const AutocompleteInput& input, | 69 void CopyOldMatches(const AutocompleteInput& input, |
70 const AutocompleteResult& old_matches, | 70 const AutocompleteResult& old_matches, |
71 TemplateURLService* template_url_service); | 71 TemplateURLService* template_url_service); |
72 | 72 |
73 // Adds a new set of matches to the result set. Does not re-sort. Calls | 73 // Adds a new set of matches to the result set. Does not re-sort. Calls |
74 // PossiblySwapContentsAndDescriptionForURLSuggestion(input)" on all added | 74 // PossiblySwapContentsAndDescriptionForURLSuggestion(input)" on all added |
75 // matches; see comments there for more information. | 75 // matches; see comments there for more information. |
76 void AppendMatches(const AutocompleteInput& input, | 76 void AppendMatches(const AutocompleteInput& input, |
77 const ACMatches& matches); | 77 const ACMatches& matches); |
78 | 78 |
79 // Removes duplicates, puts the list in sorted order and culls to leave only | 79 // Removes duplicates, puts the list in sorted order and culls to leave only |
80 // the best kMaxMatches matches. Sets the default match to the best match | 80 // the best GetMaxMatches() matches. Sets the default match to the best match |
81 // and updates the alternate nav URL. | 81 // and updates the alternate nav URL. |
82 void SortAndCull(const AutocompleteInput& input, | 82 void SortAndCull(const AutocompleteInput& input, |
83 TemplateURLService* template_url_service); | 83 TemplateURLService* template_url_service); |
84 | 84 |
85 // Returns true if at least one match was copied from the last result. | 85 // Returns true if at least one match was copied from the last result. |
86 bool HasCopiedMatches() const; | 86 bool HasCopiedMatches() const; |
87 | 87 |
88 // Vector-style accessors/operators. | 88 // Vector-style accessors/operators. |
89 size_t size() const; | 89 size_t size() const; |
90 bool empty() const; | 90 bool empty() const; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 // user's local intranet contains site "foo", and the user types "foo", we | 178 // user's local intranet contains site "foo", and the user types "foo", we |
179 // default to searching for "foo" when the user may have meant to navigate | 179 // default to searching for "foo" when the user may have meant to navigate |
180 // there. In cases like this, the default match will point to the "search for | 180 // there. In cases like this, the default match will point to the "search for |
181 // 'foo'" result, and this will contain "http://foo/". | 181 // 'foo'" result, and this will contain "http://foo/". |
182 GURL alternate_nav_url_; | 182 GURL alternate_nav_url_; |
183 | 183 |
184 DISALLOW_COPY_AND_ASSIGN(AutocompleteResult); | 184 DISALLOW_COPY_AND_ASSIGN(AutocompleteResult); |
185 }; | 185 }; |
186 | 186 |
187 #endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_RESULT_H_ | 187 #endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_RESULT_H_ |
OLD | NEW |