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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "chrome/browser/autocomplete/autocomplete_input.h" |
13 #include "chrome/browser/autocomplete/autocomplete_match.h" | 14 #include "chrome/browser/autocomplete/autocomplete_match.h" |
14 #include "url/gurl.h" | 15 #include "url/gurl.h" |
15 | 16 |
16 class AutocompleteInput; | 17 class AutocompleteInput; |
17 class AutocompleteProvider; | 18 class AutocompleteProvider; |
18 class Profile; | 19 class Profile; |
19 | 20 |
20 // All matches from all providers for a particular query. This also tracks | 21 // All matches from all providers for a particular query. This also tracks |
21 // what the default match should be if the user doesn't manually select another | 22 // what the default match should be if the user doesn't manually select another |
22 // match. | 23 // match. |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // |match|. | 160 // |match|. |
160 static bool HasMatchByDestination(const AutocompleteMatch& match, | 161 static bool HasMatchByDestination(const AutocompleteMatch& match, |
161 const ACMatches& matches); | 162 const ACMatches& matches); |
162 | 163 |
163 // operator=() by another name. | 164 // operator=() by another name. |
164 void CopyFrom(const AutocompleteResult& rhs); | 165 void CopyFrom(const AutocompleteResult& rhs); |
165 | 166 |
166 // Adds a single match. The match is inserted at the appropriate position | 167 // Adds a single match. The match is inserted at the appropriate position |
167 // based on relevancy and display order. This is ONLY for use after | 168 // based on relevancy and display order. This is ONLY for use after |
168 // SortAndCull() has been invoked, and preserves default_match_. | 169 // SortAndCull() has been invoked, and preserves default_match_. |
169 void AddMatch(const AutocompleteMatch& match); | 170 void AddMatch(AutocompleteInput::PageClassification page_classification, |
| 171 const AutocompleteMatch& match); |
170 | 172 |
171 // Populates |provider_to_matches| from |matches_|. | 173 // Populates |provider_to_matches| from |matches_|. |
172 void BuildProviderToMatches(ProviderToMatches* provider_to_matches) const; | 174 void BuildProviderToMatches(ProviderToMatches* provider_to_matches) const; |
173 | 175 |
174 // Copies matches into this result. |old_matches| gives the matches from the | 176 // Copies matches into this result. |old_matches| gives the matches from the |
175 // last result, and |new_matches| the results from this result. | 177 // last result, and |new_matches| the results from this result. |
176 void MergeMatchesByProvider(const ACMatches& old_matches, | 178 void MergeMatchesByProvider( |
177 const ACMatches& new_matches); | 179 AutocompleteInput::PageClassification page_classification, |
| 180 const ACMatches& old_matches, |
| 181 const ACMatches& new_matches); |
178 | 182 |
179 ACMatches matches_; | 183 ACMatches matches_; |
180 | 184 |
181 const_iterator default_match_; | 185 const_iterator default_match_; |
182 | 186 |
183 // The "alternate navigation URL", if any, for this result set. This is a URL | 187 // The "alternate navigation URL", if any, for this result set. This is a URL |
184 // to try offering as a navigational option in case the user navigated to the | 188 // to try offering as a navigational option in case the user navigated to the |
185 // URL of the default match but intended something else. For example, if the | 189 // URL of the default match but intended something else. For example, if the |
186 // user's local intranet contains site "foo", and the user types "foo", we | 190 // user's local intranet contains site "foo", and the user types "foo", we |
187 // default to searching for "foo" when the user may have meant to navigate | 191 // default to searching for "foo" when the user may have meant to navigate |
188 // there. In cases like this, the default match will point to the "search for | 192 // there. In cases like this, the default match will point to the "search for |
189 // 'foo'" result, and this will contain "http://foo/". | 193 // 'foo'" result, and this will contain "http://foo/". |
190 GURL alternate_nav_url_; | 194 GURL alternate_nav_url_; |
191 | 195 |
192 DISALLOW_COPY_AND_ASSIGN(AutocompleteResult); | 196 DISALLOW_COPY_AND_ASSIGN(AutocompleteResult); |
193 }; | 197 }; |
194 | 198 |
195 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_H_ | 199 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_H_ |
OLD | NEW |