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_AUTOCOMPLETE_RESULT_H_ | 5 #ifndef COMPONENTS_OMNIBOX_AUTOCOMPLETE_RESULT_H_ |
6 #define COMPONENTS_OMNIBOX_AUTOCOMPLETE_RESULT_H_ | 6 #define COMPONENTS_OMNIBOX_AUTOCOMPLETE_RESULT_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 // Max number of matches we'll show from the various providers. | 60 // Max number of matches we'll show from the various providers. |
61 static const size_t kMaxMatches; | 61 static const size_t kMaxMatches; |
62 | 62 |
63 AutocompleteResult(); | 63 AutocompleteResult(); |
64 ~AutocompleteResult(); | 64 ~AutocompleteResult(); |
65 | 65 |
66 // Copies matches from |old_matches| to provide a consistant result set. See | 66 // Copies matches from |old_matches| to provide a consistant result set. See |
67 // comments in code for specifics. | 67 // comments in code for specifics. |
68 void CopyOldMatches(const AutocompleteInput& input, | 68 void CopyOldMatches(const AutocompleteInput& input, |
| 69 const std::string& languages, |
69 const AutocompleteResult& old_matches, | 70 const AutocompleteResult& old_matches, |
70 TemplateURLService* template_url_service); | 71 TemplateURLService* template_url_service); |
71 | 72 |
72 // 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 |
73 // PossiblySwapContentsAndDescriptionForURLSuggestion(input)" on all added | 74 // PossiblySwapContentsAndDescriptionForURLSuggestion(input)" on all added |
74 // matches; see comments there for more information. | 75 // matches; see comments there for more information. |
75 void AppendMatches(const AutocompleteInput& input, | 76 void AppendMatches(const AutocompleteInput& input, |
76 const ACMatches& matches); | 77 const ACMatches& matches); |
77 | 78 |
78 // 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 |
79 // the best kMaxMatches matches. Sets the default match to the best match | 80 // the best kMaxMatches matches. Sets the default match to the best match |
80 // and updates the alternate nav URL. | 81 // and updates the alternate nav URL. |
81 void SortAndCull(const AutocompleteInput& input, | 82 void SortAndCull(const AutocompleteInput& input, |
| 83 const std::string& languages, |
82 TemplateURLService* template_url_service); | 84 TemplateURLService* template_url_service); |
83 | 85 |
84 // Returns true if at least one match was copied from the last result. | 86 // Returns true if at least one match was copied from the last result. |
85 bool HasCopiedMatches() const; | 87 bool HasCopiedMatches() const; |
86 | 88 |
87 // Vector-style accessors/operators. | 89 // Vector-style accessors/operators. |
88 size_t size() const; | 90 size_t size() const; |
89 bool empty() const; | 91 bool empty() const; |
90 const_iterator begin() const; | 92 const_iterator begin() const; |
91 iterator begin(); | 93 iterator begin(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // user's local intranet contains site "foo", and the user types "foo", we | 176 // user's local intranet contains site "foo", and the user types "foo", we |
175 // default to searching for "foo" when the user may have meant to navigate | 177 // default to searching for "foo" when the user may have meant to navigate |
176 // there. In cases like this, the default match will point to the "search for | 178 // there. In cases like this, the default match will point to the "search for |
177 // 'foo'" result, and this will contain "http://foo/". | 179 // 'foo'" result, and this will contain "http://foo/". |
178 GURL alternate_nav_url_; | 180 GURL alternate_nav_url_; |
179 | 181 |
180 DISALLOW_COPY_AND_ASSIGN(AutocompleteResult); | 182 DISALLOW_COPY_AND_ASSIGN(AutocompleteResult); |
181 }; | 183 }; |
182 | 184 |
183 #endif // COMPONENTS_OMNIBOX_AUTOCOMPLETE_RESULT_H_ | 185 #endif // COMPONENTS_OMNIBOX_AUTOCOMPLETE_RESULT_H_ |
OLD | NEW |