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

Unified Diff: chrome/browser/ui/search_engines/search_engine_tab_helper.cc

Issue 10381016: Remove the "autogenerate keyword" bit on TemplateURL. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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/ui/search_engines/search_engine_tab_helper.cc
===================================================================
--- chrome/browser/ui/search_engines/search_engine_tab_helper.cc (revision 135424)
+++ chrome/browser/ui/search_engines/search_engine_tab_helper.cc (working copy)
@@ -12,6 +12,7 @@
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/ui/search_engines/template_url_fetcher_ui_callbacks.h"
#include "chrome/common/render_messages.h"
+#include "chrome/common/url_constants.h"
#include "content/public/browser/favicon_status.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
@@ -45,7 +46,16 @@
return string16();
}
- return TemplateURLService::GenerateKeyword(url, true);
+ // Don't autogenerate keywords for referrers that are anything other than HTTP
+ // or have a path.
+ //
+ // If we relax the path constraint, we need to be sure to sanitize the path
+ // elements and update AutocompletePopup to look for keywords using the path.
+ // See http://b/issue?id=863583.
+ if (!url.SchemeIs(chrome::kHttpScheme) || (url.path().length() > 1))
+ return string16();
+
+ return TemplateURLService::GenerateKeyword(url);
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698