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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 const size_t kMaxMatches; |
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 std::string& languages, | |
71 const AutocompleteResult& old_matches, | 70 const AutocompleteResult& old_matches, |
72 TemplateURLService* template_url_service); | 71 TemplateURLService* template_url_service); |
73 | 72 |
74 // 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 |
75 // PossiblySwapContentsAndDescriptionForURLSuggestion(input)" on all added | 74 // PossiblySwapContentsAndDescriptionForURLSuggestion(input)" on all added |
76 // matches; see comments there for more information. | 75 // matches; see comments there for more information. |
77 void AppendMatches(const AutocompleteInput& input, | 76 void AppendMatches(const AutocompleteInput& input, |
78 const ACMatches& matches); | 77 const ACMatches& matches); |
79 | 78 |
80 // 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 |
81 // 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 |
82 // and updates the alternate nav URL. | 81 // and updates the alternate nav URL. |
83 void SortAndCull(const AutocompleteInput& input, | 82 void SortAndCull(const AutocompleteInput& input, |
84 const std::string& languages, | |
85 TemplateURLService* template_url_service); | 83 TemplateURLService* template_url_service); |
86 | 84 |
87 // 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. |
88 bool HasCopiedMatches() const; | 86 bool HasCopiedMatches() const; |
89 | 87 |
90 // Vector-style accessors/operators. | 88 // Vector-style accessors/operators. |
91 size_t size() const; | 89 size_t size() const; |
92 bool empty() const; | 90 bool empty() const; |
93 const_iterator begin() const; | 91 const_iterator begin() const; |
94 iterator begin(); | 92 iterator begin(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // user's local intranet contains site "foo", and the user types "foo", we | 175 // user's local intranet contains site "foo", and the user types "foo", we |
178 // default to searching for "foo" when the user may have meant to navigate | 176 // default to searching for "foo" when the user may have meant to navigate |
179 // there. In cases like this, the default match will point to the "search for | 177 // there. In cases like this, the default match will point to the "search for |
180 // 'foo'" result, and this will contain "http://foo/". | 178 // 'foo'" result, and this will contain "http://foo/". |
181 GURL alternate_nav_url_; | 179 GURL alternate_nav_url_; |
182 | 180 |
183 DISALLOW_COPY_AND_ASSIGN(AutocompleteResult); | 181 DISALLOW_COPY_AND_ASSIGN(AutocompleteResult); |
184 }; | 182 }; |
185 | 183 |
186 #endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_RESULT_H_ | 184 #endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_RESULT_H_ |
OLD | NEW |