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

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: -IWYU 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
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..4475104a5f5da096595ab786e6421d37f905842a 100644
--- a/chrome/browser/ui/search/search_tab_helper.cc
+++ b/chrome/browser/ui/search/search_tab_helper.cc
@@ -450,6 +450,12 @@ 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. Note that the |is_most_visited_item_url| is apparently
Charlie Reis 2016/02/04 18:37:53 Maybe this second sentence should be a TODO to rem
dcheng 2016/02/04 18:41:32 Hm... I think it's actually kind of important to d
Charlie Reis 2016/02/04 18:45:23 TODO(...): The |is_most_visited_item_url| is appar
dcheng 2016/02/04 19:05:01 Done.
+ // meaningless.
+ if (!instant_service_ || !instant_service_->IsValidURLForNavigation(url))
+ return;
+
if (is_most_visited_item_url) {
content::RecordAction(
base::UserMetricsAction("InstantExtended.MostVisitedClicked"));

Powered by Google App Engine
This is Rietveld 408576698