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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 #endif | 119 #endif |
120 | 120 |
121 // Compute the "alternate navigation URL" for a given match. This is obtained | 121 // Compute the "alternate navigation URL" for a given match. This is obtained |
122 // by interpreting the user input directly as a URL. See comments on | 122 // by interpreting the user input directly as a URL. See comments on |
123 // |alternate_nav_url_|. | 123 // |alternate_nav_url_|. |
124 static GURL ComputeAlternateNavUrl(const AutocompleteInput& input, | 124 static GURL ComputeAlternateNavUrl(const AutocompleteInput& input, |
125 const AutocompleteMatch& match); | 125 const AutocompleteMatch& match); |
126 | 126 |
127 // Sort |matches| by destination, taking into account demotions based on | 127 // Sort |matches| by destination, taking into account demotions based on |
128 // |page_classification| when resolving ties about which of several | 128 // |page_classification| when resolving ties about which of several |
129 // duplicates to keep. The matches are also deduplicated. If | 129 // duplicates to keep. The matches are also deduplicated. Duplicate matches |
130 // |set_duplicate_matches| is true, the duplicate matches are stored in the | 130 // are stored in the |duplicate_matches| vector of the corresponding |
131 // |duplicate_matches| vector of the corresponding AutocompleteMatch. | 131 // AutocompleteMatch. |
132 static void DedupMatchesByDestination( | 132 static void SortAndDedupMatches( |
133 metrics::OmniboxEventProto::PageClassification page_classification, | 133 metrics::OmniboxEventProto::PageClassification page_classification, |
134 bool set_duplicate_matches, | |
135 ACMatches* matches); | 134 ACMatches* matches); |
136 | 135 |
137 private: | 136 private: |
138 friend class AutocompleteProviderTest; | 137 friend class AutocompleteProviderTest; |
139 | 138 |
140 typedef std::map<AutocompleteProvider*, ACMatches> ProviderToMatches; | 139 typedef std::map<AutocompleteProvider*, ACMatches> ProviderToMatches; |
141 | 140 |
142 #if defined(OS_ANDROID) | 141 #if defined(OS_ANDROID) |
143 // iterator::difference_type is not defined in the STL that we compile with on | 142 // iterator::difference_type is not defined in the STL that we compile with on |
144 // Android. | 143 // Android. |
(...skipping 30 matching lines...) Expand all Loading... |
175 // user's local intranet contains site "foo", and the user types "foo", we | 174 // user's local intranet contains site "foo", and the user types "foo", we |
176 // default to searching for "foo" when the user may have meant to navigate | 175 // default to searching for "foo" when the user may have meant to navigate |
177 // there. In cases like this, the default match will point to the "search for | 176 // there. In cases like this, the default match will point to the "search for |
178 // 'foo'" result, and this will contain "http://foo/". | 177 // 'foo'" result, and this will contain "http://foo/". |
179 GURL alternate_nav_url_; | 178 GURL alternate_nav_url_; |
180 | 179 |
181 DISALLOW_COPY_AND_ASSIGN(AutocompleteResult); | 180 DISALLOW_COPY_AND_ASSIGN(AutocompleteResult); |
182 }; | 181 }; |
183 | 182 |
184 #endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_RESULT_H_ | 183 #endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_RESULT_H_ |
OLD | NEW |