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

Unified Diff: components/omnibox/autocomplete_match.h

Issue 1098843004: Omnibox - Do Not Allow HTTP/HTTPS Equivalence if User Explicitly Entered A Scheme (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: peter's comments, slight refactoringpeter's comments, slight refactoring Created 5 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: components/omnibox/autocomplete_match.h
diff --git a/components/omnibox/autocomplete_match.h b/components/omnibox/autocomplete_match.h
index 0464d73ac275e41a2c753bc5a6925828ddc70cbd..53cf8283fc51750c6cb0d40c69924a6ce7981e34 100644
--- a/components/omnibox/autocomplete_match.h
+++ b/components/omnibox/autocomplete_match.h
@@ -10,6 +10,7 @@
#include <vector>
#include "base/memory/scoped_ptr.h"
+#include "components/omnibox/autocomplete_input.h"
#include "components/omnibox/autocomplete_match_type.h"
#include "components/search_engines/template_url.h"
#include "ui/base/page_transition_types.h"
@@ -183,22 +184,37 @@ struct AutocompleteMatch {
// left empty and the template URL (if any) is determined from the
// destination's hostname. The template URL is used to strip off query args
// other than the search terms themselves that would otherwise prevent doing
- // proper deduping.
- static GURL GURLToStrippedGURL(const GURL& url,
- TemplateURLService* template_url_service,
- const base::string16& keyword);
+ // proper deduping. |input_words| is used to decide if the scheme is allowed
+ // to be altered during stripping. (If the user indicated a desired scheme,
Peter Kasting 2015/06/06 01:31:24 Nit: Vague; "If the user indicated a desired schem
Mark P 2015/06/09 19:29:38 Done.
+ // we prevent two URLs with different schemes from having the same stripped
+ // GURL.)
+ static GURL GURLToStrippedGURL(
+ const GURL& url,
+ const std::vector<base::string16>& input_words,
+ TemplateURLService* template_url_service,
+ const base::string16& keyword);
// Computes the stripped destination URL (via GURLToStrippedGURL()) and
// stores the result in |stripped_destination_url|.
- void ComputeStrippedDestinationURL(TemplateURLService* template_url_service);
+ void ComputeStrippedDestinationURL(
+ const std::vector<base::string16>& input_words,
+ TemplateURLService* template_url_service);
// Sets |allowed_to_be_default_match| to true if this match is effectively
// the URL-what-you-typed match (i.e., would be dupped against the UWYT
// match when AutocompleteResult merges matches). |canonical_input_url| is
// the AutocompleteInput interpreted as a URL (i.e.,
- // AutocompleteInput::canonicalized_url()).
- void EnsureUWYTIsAllowedToBeDefault(const GURL& canonical_input_url,
- TemplateURLService* template_url_service);
+ // AutocompleteInput::canonicalized_url()). |inputs_words| is the input
+ // split based on spaces into words.
Peter Kasting 2015/06/06 01:31:24 Nit: "...is the original input string, tokenized i
Mark P 2015/06/09 19:29:38 Comment is now obsolete.
+ void EnsureUWYTIsAllowedToBeDefault(
+ const GURL& canonical_input_url,
+ const std::vector<base::string16>& input_words,
+ TemplateURLService* template_url_service);
+ // The same as above except only takes an AutocompleteInput and does the
+ // splitting internally.
+ void EnsureUWYTIsAllowedToBeDefault(
Peter Kasting 2015/06/06 01:31:24 My one concern with this API is that it will lead
Mark P 2015/06/06 17:10:11 I'm not philosophically keen on the notion of cach
Peter Kasting 2015/06/06 18:38:16 By "only one field needed" do you mean "only one a
Mark P 2015/06/06 20:23:06 Yes.
Peter Kasting 2015/06/08 20:26:59 We don't have any other places that need such a ve
Mark P 2015/06/09 19:29:38 Done.
+ const AutocompleteInput& input,
+ TemplateURLService* template_url_service);
// Gets data relevant to whether there should be any special keyword-related
// UI shown for this match. If this match represents a selected keyword, i.e.

Powered by Google App Engine
This is Rietveld 408576698