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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/search/search_tab_helper.h" 5 #include "chrome/browser/ui/search/search_tab_helper.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 if (!omnibox->model()->popup_model()->IsOpen()) 443 if (!omnibox->model()->popup_model()->IsOpen())
444 web_contents()->Focus(); 444 web_contents()->Focus();
445 break; 445 break;
446 } 446 }
447 #endif 447 #endif
448 } 448 }
449 449
450 void SearchTabHelper::NavigateToURL(const GURL& url, 450 void SearchTabHelper::NavigateToURL(const GURL& url,
451 WindowOpenDisposition disposition, 451 WindowOpenDisposition disposition,
452 bool is_most_visited_item_url) { 452 bool is_most_visited_item_url) {
453 // Make sure the specified URL is actually on the most visited or suggested
454 // 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.
455 // meaningless.
456 if (!instant_service_ || !instant_service_->IsValidURLForNavigation(url))
457 return;
458
453 if (is_most_visited_item_url) { 459 if (is_most_visited_item_url) {
454 content::RecordAction( 460 content::RecordAction(
455 base::UserMetricsAction("InstantExtended.MostVisitedClicked")); 461 base::UserMetricsAction("InstantExtended.MostVisitedClicked"));
456 } 462 }
457 463
458 if (delegate_) 464 if (delegate_)
459 delegate_->NavigateOnThumbnailClick(url, disposition, web_contents_); 465 delegate_->NavigateOnThumbnailClick(url, disposition, web_contents_);
460 } 466 }
461 467
462 void SearchTabHelper::OnDeleteMostVisitedItem(const GURL& url) { 468 void SearchTabHelper::OnDeleteMostVisitedItem(const GURL& url) {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 596
591 bool SearchTabHelper::IsInputInProgress() const { 597 bool SearchTabHelper::IsInputInProgress() const {
592 OmniboxView* omnibox = GetOmniboxView(); 598 OmniboxView* omnibox = GetOmniboxView();
593 return !model_.mode().is_ntp() && omnibox && 599 return !model_.mode().is_ntp() && omnibox &&
594 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; 600 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE;
595 } 601 }
596 602
597 OmniboxView* SearchTabHelper::GetOmniboxView() const { 603 OmniboxView* SearchTabHelper::GetOmniboxView() const {
598 return delegate_ ? delegate_->GetOmniboxView() : NULL; 604 return delegate_ ? delegate_->GetOmniboxView() : NULL;
599 } 605 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698