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

Unified Diff: chrome/browser/ui/search/search_tab_helper.cc

Issue 1669723002: NTP: don't allow navigateContentWindow to navigate where it pleases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Better comments Created 4 years, 10 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
« no previous file with comments | « chrome/browser/search/instant_service_unittest.cc ('k') | chrome/renderer/searchbox/searchbox_extension.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/search/search_tab_helper.cc
diff --git a/chrome/browser/ui/search/search_tab_helper.cc b/chrome/browser/ui/search/search_tab_helper.cc
index 65a7f91dfcb29fec061217fa9cfedd27f0b308e7..2090147708a148bf4eba8afd5ecf8cd5a918dec8 100644
--- a/chrome/browser/ui/search/search_tab_helper.cc
+++ b/chrome/browser/ui/search/search_tab_helper.cc
@@ -450,6 +450,15 @@ void SearchTabHelper::FocusOmnibox(OmniboxFocusState state) {
void SearchTabHelper::NavigateToURL(const GURL& url,
WindowOpenDisposition disposition,
bool is_most_visited_item_url) {
+ // Make sure the specified URL is actually on the most visited or suggested
+ // items list.
+ // TODO(treib): The |is_most_visited_item_url| is meaningless: the way it's
+ // currently set by the renderer means it can't be used to decide which list
+ // of items (most visited or suggestions) to use for the validation check. Can
+ // it be removed?
+ if (!instant_service_ || !instant_service_->IsValidURLForNavigation(url))
+ return;
+
if (is_most_visited_item_url) {
content::RecordAction(
base::UserMetricsAction("InstantExtended.MostVisitedClicked"));
« no previous file with comments | « chrome/browser/search/instant_service_unittest.cc ('k') | chrome/renderer/searchbox/searchbox_extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698