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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_match.h

Issue 11198074: Initial implementation of dedupping search provider's URLs. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Addressed comments. Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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_MATCH_H_ 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_MATCH_H_
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_MATCH_H_ 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_MATCH_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 // Convenience function to check if |type| is a search (as opposed to a URL or 181 // Convenience function to check if |type| is a search (as opposed to a URL or
182 // an extension). 182 // an extension).
183 static bool IsSearchType(Type type); 183 static bool IsSearchType(Type type);
184 184
185 // Copies the destination_url with "www." stripped off to 185 // Copies the destination_url with "www." stripped off to
186 // |stripped_destination_url| and also converts https protocol to 186 // |stripped_destination_url| and also converts https protocol to
187 // http. These two conversions are merely to allow comparisons to 187 // http. These two conversions are merely to allow comparisons to
188 // remove likely duplicates; these URLs are not used as actual 188 // remove likely duplicates; these URLs are not used as actual
189 // destination URLs. This method is invoked internally by the 189 // destination URLs. This method is invoked internally by the
190 // AutocompleteResult and does not normally need to be invoked. 190 // AutocompleteResult and does not normally need to be invoked.
191 void ComputeStrippedDestinationURL(); 191 // If |profile| is not NULL, it is used to get a template URL corresponding
192 // to this match. The template is used to strip off time/position sensitive
193 // data that would otherwise prevent from proper dedupping.
Peter Kasting 2012/10/26 22:13:49 Nit: dedupping -> deduping (and in other files) I
Bart N. 2012/10/26 23:36:55 Done.
194 void ComputeStrippedDestinationURL(Profile* profile);
192 195
193 // Gets data relevant to whether there should be any special keyword-related 196 // Gets data relevant to whether there should be any special keyword-related
194 // UI shown for this match. If this match represents a selected keyword, i.e. 197 // UI shown for this match. If this match represents a selected keyword, i.e.
195 // the UI should be "in keyword mode", |keyword| will be set to the keyword 198 // the UI should be "in keyword mode", |keyword| will be set to the keyword
196 // and |is_keyword_hint| will be set to false. If this match has a non-NULL 199 // and |is_keyword_hint| will be set to false. If this match has a non-NULL
197 // |associated_keyword|, i.e. we should show a "Press [tab] to search ___" 200 // |associated_keyword|, i.e. we should show a "Press [tab] to search ___"
198 // hint and allow the user to toggle into keyword mode, |keyword| will be set 201 // hint and allow the user to toggle into keyword mode, |keyword| will be set
199 // to the associated keyword and |is_keyword_hint| will be set to true. Note 202 // to the associated keyword and |is_keyword_hint| will be set to true. Note
200 // that only one of these states can be in effect at once. In all other 203 // that only one of these states can be in effect at once. In all other
201 // cases, |keyword| will be cleared, even when our member variable |keyword| 204 // cases, |keyword| will be cleared, even when our member variable |keyword|
202 // is non-empty -- such as with non-substituting keywords or matches that 205 // is non-empty -- such as with non-substituting keywords or matches that
203 // represent searches using the default search engine. See also 206 // represent searches using the default search engine. See also
204 // GetSubstitutingExplicitlyInvokedKeyword(). 207 // GetSubstitutingExplicitlyInvokedKeyword().
205 void GetKeywordUIState(Profile* profile, 208 void GetKeywordUIState(Profile* profile,
206 string16* keyword, 209 string16* keyword,
207 bool* is_keyword_hint) const; 210 bool* is_keyword_hint) const;
208 211
209 // Returns |keyword|, but only if it represents a substituting keyword that 212 // Returns |keyword|, but only if it represents a substituting keyword that
210 // the user has explicitly invoked. If for example this match represents a 213 // the user has explicitly invoked. If for example this match represents a
211 // search with the default search engine (and the user didn't explicitly 214 // search with the default search engine (and the user didn't explicitly
212 // invoke its keyword), this returns the empty string. The result is that 215 // invoke its keyword), this returns the empty string. The result is that
213 // this function returns a non-empty string in the same cases as when the UI 216 // this function returns a non-empty string in the same cases as when the UI
214 // should show up as being "in keyword mode". 217 // should show up as being "in keyword mode".
215 string16 GetSubstitutingExplicitlyInvokedKeyword(Profile* profile) const; 218 string16 GetSubstitutingExplicitlyInvokedKeyword(Profile* profile) const;
216 219
217 // Returns the TemplateURL associated with this match. This may be NULL if 220 // Returns the TemplateURL associated with this match. This may be NULL if
218 // the match has no keyword OR if the keyword no longer corresponds to a valid 221 // the match has no keyword OR if the keyword no longer corresponds to a valid
219 // TemplateURL. See comments on |keyword| below. 222 // TemplateURL. See comments on |keyword| below.
223 // Simply delegates to GetTemplateURL(profile, false) below.
Peter Kasting 2012/10/26 22:13:49 Nit: Having two functions here is just another way
Bart N. 2012/10/26 23:36:55 Done.
220 TemplateURL* GetTemplateURL(Profile* profile) const; 224 TemplateURL* GetTemplateURL(Profile* profile) const;
221 225
226 // Same as above except it may peform additional template lookup using
227 // |destination_url|'s host if |check_host| is true.
Peter Kasting 2012/10/26 22:13:49 Nit: Be more clear. Something like "If |use_host|
Bart N. 2012/10/26 23:36:55 Done.
228 TemplateURL* GetTemplateURL(Profile* profile, bool use_host) const;
229
222 // Adds optional information to the |additional_info| dictionary. 230 // Adds optional information to the |additional_info| dictionary.
223 void RecordAdditionalInfo(const std::string& property, 231 void RecordAdditionalInfo(const std::string& property,
224 const std::string& value); 232 const std::string& value);
225 void RecordAdditionalInfo(const std::string& property, int value); 233 void RecordAdditionalInfo(const std::string& property, int value);
226 void RecordAdditionalInfo(const std::string& property, 234 void RecordAdditionalInfo(const std::string& property,
227 const base::Time& value); 235 const base::Time& value);
228 236
229 // The provider of this match, used to remember which provider the user had 237 // The provider of this match, used to remember which provider the user had
230 // selected when the input changes. This may be NULL, in which case there is 238 // selected when the input changes. This may be NULL, in which case there is
231 // no provider (or memory of the user's selection). 239 // no provider (or memory of the user's selection).
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 const string16& text, 341 const string16& text,
334 const ACMatchClassifications& classifications) const; 342 const ACMatchClassifications& classifications) const;
335 #endif 343 #endif
336 }; 344 };
337 345
338 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification; 346 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification;
339 typedef std::vector<ACMatchClassification> ACMatchClassifications; 347 typedef std::vector<ACMatchClassification> ACMatchClassifications;
340 typedef std::vector<AutocompleteMatch> ACMatches; 348 typedef std::vector<AutocompleteMatch> ACMatches;
341 349
342 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_MATCH_H_ 350 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_MATCH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698