Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: components/omnibox/browser/autocomplete_result.h

Issue 1877833002: Optimize shortcuts provider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on master and minor format fix Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « components/omnibox/browser/autocomplete_match.cc ('k') | components/omnibox/browser/autocomplete_result.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698