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

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

Powered by Google App Engine
This is Rietveld 408576698