https://chromiumcodereview.appspot.com/10537154/diff/38002/chrome/browser/autocomplete/autocomplete_match.cc
File chrome/browser/autocomplete/autocomplete_match.cc (right):
https://chromiumcodereview.appspot.com/10537154/diff/38002/chrome/browser/autocomplete/autocomplete_match.cc#newcode74
chrome/browser/autocomplete/autocomplete_match.cc:74: if
(match.associated_keyword.get())
Nit: For consistency, we could probably change these conditionals to
look like the unconditional reset() calls in operator=() below. (The
reverse change wouldn't be safe as they need to be unconditional in
operator=().)
https://chromiumcodereview.appspot.com/10537154/diff/62001/chrome/browser/search_engines/template_url.cc
File chrome/browser/search_engines/template_url.cc (right):
https://chromiumcodereview.appspot.com/10537154/diff/62001/chrome/browser/search_engines/template_url.cc#newcode219
chrome/browser/search_engines/template_url.cc:219: const std::string
kHttps("https");
Nit: Use chrome::kHttpsScheme from chrome/common/url_constants.h.
https://chromiumcodereview.appspot.com/10537154/diff/62001/chrome/browser/search_engines/template_url.cc#newcode221
chrome/browser/search_engines/template_url.cc:221: // Either search or
autocomplete base URL must be using HTTPS
This code isn't actually sufficient.
First, someone could manually create a search engine with the AQS
substitution arg and an HTTP scheme, and we'd happily send the data over
HTTP because we're assuming any URL that uses this is using the Google
base URLs.
Second, along similar lines, did you want to restrict AQS from being
sent to non-Google URLs? If so, you'd also want some sort of
IsGoogleHostname() or similar check besides what you have here.
Perhaps the best way to solve this is by doing something like:
* Recursively call ReplaceSearchTermsUsingTermsData(), but pass in a
SearchTermsArgs that has no AQS string to avoid infinite recursion.
This will give you a trustworthy "final URL".
* Check the scheme and other properties of this URL directly to see
whether it's safe to substitute in the AQS string.
* Add some unittests for TemplateURL that create some URLs that
violate the constraint(s) above to the test suite.
Finally, the comment here is both too short and confusing. Perhaps a
longer explanation of what AQS is, what the constraints on it are, and
why those constraints are necessary, should be added to some canonical
place that talks about AQS, and then this comment can reference there.
https://chromiumcodereview.appspot.com/10537154/