OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_AUTOCOMPLETE_RESULT_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 #endif | 168 #endif |
169 | 169 |
170 // Returns true if |matches| contains a match with the same destination as | 170 // Returns true if |matches| contains a match with the same destination as |
171 // |match|. | 171 // |match|. |
172 static bool HasMatchByDestination(const AutocompleteMatch& match, | 172 static bool HasMatchByDestination(const AutocompleteMatch& match, |
173 const ACMatches& matches); | 173 const ACMatches& matches); |
174 | 174 |
175 // operator=() by another name. | 175 // operator=() by another name. |
176 void CopyFrom(const AutocompleteResult& rhs); | 176 void CopyFrom(const AutocompleteResult& rhs); |
177 | 177 |
178 // Adds a single match. The match is inserted at the appropriate position | |
179 // based on relevancy and display order. This is ONLY for use after | |
180 // SortAndCull() has been invoked, and preserves default_match_. | |
181 void AddMatch(AutocompleteInput::PageClassification page_classification, | |
182 const AutocompleteMatch& match); | |
183 | |
184 // Populates |provider_to_matches| from |matches_|. | 178 // Populates |provider_to_matches| from |matches_|. |
185 void BuildProviderToMatches(ProviderToMatches* provider_to_matches) const; | 179 void BuildProviderToMatches(ProviderToMatches* provider_to_matches) const; |
186 | 180 |
187 // Copies matches into this result. |old_matches| gives the matches from the | 181 // Copies matches into this result. |old_matches| gives the matches from the |
188 // last result, and |new_matches| the results from this result. | 182 // last result, and |new_matches| the results from this result. |
189 void MergeMatchesByProvider( | 183 void MergeMatchesByProvider( |
190 AutocompleteInput::PageClassification page_classification, | 184 AutocompleteInput::PageClassification page_classification, |
191 const ACMatches& old_matches, | 185 const ACMatches& old_matches, |
192 const ACMatches& new_matches); | 186 const ACMatches& new_matches); |
193 | 187 |
194 ACMatches matches_; | 188 ACMatches matches_; |
195 | 189 |
196 const_iterator default_match_; | 190 const_iterator default_match_; |
197 | 191 |
198 // The "alternate navigation URL", if any, for this result set. This is a URL | 192 // The "alternate navigation URL", if any, for this result set. This is a URL |
199 // to try offering as a navigational option in case the user navigated to the | 193 // to try offering as a navigational option in case the user navigated to the |
200 // URL of the default match but intended something else. For example, if the | 194 // URL of the default match but intended something else. For example, if the |
201 // user's local intranet contains site "foo", and the user types "foo", we | 195 // user's local intranet contains site "foo", and the user types "foo", we |
202 // default to searching for "foo" when the user may have meant to navigate | 196 // default to searching for "foo" when the user may have meant to navigate |
203 // there. In cases like this, the default match will point to the "search for | 197 // there. In cases like this, the default match will point to the "search for |
204 // 'foo'" result, and this will contain "http://foo/". | 198 // 'foo'" result, and this will contain "http://foo/". |
205 GURL alternate_nav_url_; | 199 GURL alternate_nav_url_; |
206 | 200 |
207 DISALLOW_COPY_AND_ASSIGN(AutocompleteResult); | 201 DISALLOW_COPY_AND_ASSIGN(AutocompleteResult); |
208 }; | 202 }; |
209 | 203 |
210 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_H_ | 204 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_H_ |
OLD | NEW |