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

Unified Diff: chrome/browser/instant/instant_loader.cc

Issue 5787008: Makes instant not suggest string that look like urls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge and convert active to displayable Created 10 years 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/instant/instant_loader.h ('k') | chrome/test/data/instant/suggest_google.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/instant/instant_loader.cc
diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc
index 328299fba62bb7deef214e834a81c9a8156832d7..bd76b5362ee279180cc6ad0bc193ac7cc8f2be33 100644
--- a/chrome/browser/instant/instant_loader.cc
+++ b/chrome/browser/instant/instant_loader.cc
@@ -13,6 +13,7 @@
#include "base/timer.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
+#include "chrome/browser/autocomplete/autocomplete.h"
#include "chrome/browser/favicon_service.h"
#include "chrome/browser/history/history_marshaling.h"
#include "chrome/browser/instant/instant_loader_delegate.h"
@@ -662,6 +663,15 @@ void InstantLoader::SetCompleteSuggestedText(
return;
}
+ AutocompleteInput::Type type =
+ AutocompleteInput::Parse(UTF16ToWide(complete_suggested_text),
+ std::wstring(), NULL, NULL);
+ if (type == AutocompleteInput::URL) {
+ // Ignore suggestions that look like urls. Otherwise the omnibox ends up
+ // showing what looks like a url but the page shows search results.
+ return;
+ }
+
string16 user_text_lower = l10n_util::ToLower(user_text_);
string16 complete_suggested_text_lower = l10n_util::ToLower(
complete_suggested_text);
« no previous file with comments | « chrome/browser/instant/instant_loader.h ('k') | chrome/test/data/instant/suggest_google.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698