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

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

Issue 13813006: Instant: Don't allow the page to set suggestions inappropriately. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | « no previous file | chrome/browser/ui/search/instant_extended_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/search/instant_controller.cc
diff --git a/chrome/browser/ui/search/instant_controller.cc b/chrome/browser/ui/search/instant_controller.cc
index 6a8c7ceed9e00c84ee458ce63e7d64b54861b1d8..49908b4dfa732758ca68eaf3827825cc938181d6 100644
--- a/chrome/browser/ui/search/instant_controller.cc
+++ b/chrome/browser/ui/search/instant_controller.cc
@@ -1133,6 +1133,7 @@ void InstantController::SetSuggestions(
// what it's showing, as the user arrows up/down through the page-provided
// suggestions). So, update these state variables here.
last_omnibox_text_ = suggestion.text;
+ last_user_text_.clear();
samarth 2013/04/09 16:11:34 IIRC, when you arrow back up into the omnibox, we
sreeram 2013/04/09 16:30:37 When you arrow back into the omnibox, you get a se
samarth 2013/04/09 20:32:15 Sorry if I'm missing something but I still don't s
sreeram 2013/04/09 20:58:24 FixSuggestions is only called for gray/blue sugges
samarth 2013/04/09 21:49:06 But what if we want to use last_user_text_ to vali
sreeram 2013/04/09 22:11:58 last_user_text_ is not needed for validating setVa
last_suggestion_ = InstantSuggestion();
last_match_was_search_ = suggestion.type == INSTANT_SUGGESTION_SEARCH;
LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf(
@@ -1545,6 +1546,10 @@ void InstantController::SendMostVisitedItems(
}
bool InstantController::FixSuggestion(InstantSuggestion* suggestion) const {
+ // If the page is attempting to set suggestions inappropriately, reject.
samarth 2013/04/09 16:11:34 Please be more specific--both here and in the chan
sreeram 2013/04/09 16:30:37 Done.
+ if (last_user_text_.empty())
+ return false;
+
// If the page is trying to set inline autocompletion in verbatim mode,
// instead try suggesting the exact omnibox text. This makes the omnibox
// interpret user text as an URL if possible while preventing unwanted
@@ -1619,4 +1624,3 @@ bool InstantController::ShouldSwitchToLocalNTP() const {
return chrome::IsAggressiveLocalNTPFallbackEnabled();
}
-
« no previous file with comments | « no previous file | chrome/browser/ui/search/instant_extended_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698