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

Unified Diff: chrome/browser/autocomplete/autocomplete_match.h

Issue 353223002: Omnibox: Fix URL-What-You-Typed Allowed-To-Be-Default-Match Issues (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: polish Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autocomplete/autocomplete_match.h
diff --git a/chrome/browser/autocomplete/autocomplete_match.h b/chrome/browser/autocomplete/autocomplete_match.h
index e92766ae9999422ce2f56f8d3838869726ce20b4..6d10058fcf794708f5a15919355a3f92f2f53b7d 100644
--- a/chrome/browser/autocomplete/autocomplete_match.h
+++ b/chrome/browser/autocomplete/autocomplete_match.h
@@ -168,16 +168,21 @@ struct AutocompleteMatch {
// like entity, personalized, profile or postfix.
static bool IsSpecializedSearchType(Type type);
- // Copies the destination_url with "www." stripped off to
- // |stripped_destination_url| and also converts https protocol to
- // http. These two conversions are merely to allow comparisons to
- // remove likely duplicates; these URLs are not used as actual
- // destination URLs. This method is invoked internally by the
- // AutocompleteResult and does not normally need to be invoked.
- // If |profile| is not NULL, it is used to get a template URL corresponding
- // to this match. The template is used to strip off query args other than
- // the search terms themselves that would otherwise prevent from proper
- // deduping.
+ // Returns |url| altered by stripping off "www.", converting https protocol
Peter Kasting 2014/06/30 23:02:58 Nit: https protocol to http -> "https" to "http"
Mark P 2014/06/30 23:27:36 Done.
+ // to http, and stripping excess query parameters. These conversions are
+ // merely to allow comparisons to remove likely duplicates; these URLs are
+ // not used as actual destination URLs. If |profile| is not NULL, it is
+ // used to get a template URL corresponding to this match. If the match's
+ // keyword is known, it can be passed in. Otherwise, it can be left empty
+ // and the template URL (if any) is determined from the |url|'s hostname.
+ // The template URL is used to strip off query args other than the search
+ // terms themselves that would otherwise prevent from proper deduping.
+ static GURL GURLToStrippedGURL(const GURL& url,
+ Profile* profile,
Peter Kasting 2014/06/30 23:02:58 Pass a TemplateURLService* here instead (see https
Mark P 2014/06/30 23:27:36 I will wait for that to land and then make the cor
+ const base::string16& keyword);
+
+ // Computes the stripped destination URL (via GURLToStrippedGURL()) and
+ // stores the result in |stripped_destination_url|.
void ComputeStrippedDestinationURL(Profile* profile);
// Gets data relevant to whether there should be any special keyword-related
@@ -214,6 +219,15 @@ struct AutocompleteMatch {
TemplateURL* GetTemplateURL(Profile* profile,
bool allow_fallback_to_destination_host) const;
+ // A static version GetTemplateURL() that takes the match's keyword and
+ // match's hostname as parameters. In short, returns the TemplateURL
+ // associated with |keyword| if it exists; otherwise returns the TemplateURL
+ // associated with |host| if it exists.
+ static TemplateURL* GetTemplateURLWithKeyword(
Peter Kasting 2014/06/30 23:02:58 Nit: Put this with the other static functions.
Mark P 2014/06/30 23:27:36 Done.
+ Profile* profile,
+ const base::string16& keyword,
+ const std::string& host);
+
// Adds optional information to the |additional_info| dictionary.
void RecordAdditionalInfo(const std::string& property,
const std::string& value);
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_match.cc » ('j') | chrome/browser/autocomplete/autocomplete_match.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698