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

Unified Diff: chrome/browser/autocomplete/search_provider.cc

Issue 16503: Fix issue 5806. If the suggest server returns a NAVIGATION... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 11 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/search_provider.cc
===================================================================
--- chrome/browser/autocomplete/search_provider.cc (revision 7711)
+++ chrome/browser/autocomplete/search_provider.cc (working copy)
@@ -10,6 +10,7 @@
#include "chrome/browser/google_util.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/template_url_model.h"
+#include "chrome/browser/url_fixer_upper.h"
#include "chrome/common/json_value_serializer.h"
#include "chrome/common/l10n_util.h"
#include "chrome/common/pref_names.h"
@@ -321,8 +322,15 @@
description_list && description_list->Get(i, &site_val) &&
site_val->IsType(Value::TYPE_STRING) &&
site_val->GetAsString(&site_name)) {
- navigation_results_.push_back(NavigationResult(GURL(suggestion_str),
- site_name));
+ // Navigation links might not be valid URLs. For example, the Google
+ // suggest server returns navigation links without a scheme if the
+ // scheme is http. Fix the URL, and verify that it's valid before
+ // adding it to the list.
+ GURL result_url = GURL(URLFixerUpper::FixupURL(suggestion_str, L""));
+ if (result_url.is_valid()) {
+ navigation_results_.push_back(NavigationResult(result_url,
+ site_name));
+ }
}
} else {
// TODO(kochi): Currently we treat a calculator result as a query, but it
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698