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

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

Issue 353223002: Omnibox: Fix URL-What-You-Typed Allowed-To-Be-Default-Match Issues (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix crashes on about: schemes Created 6 years, 5 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/autocomplete/autocomplete_result.cc
diff --git a/chrome/browser/autocomplete/autocomplete_result.cc b/chrome/browser/autocomplete/autocomplete_result.cc
index ca8155b8393bb4c2c35345b63aafa3e9bda71f04..1dbfa41cec763826e6e8b1615a298a0d268f1537 100644
--- a/chrome/browser/autocomplete/autocomplete_result.cc
+++ b/chrome/browser/autocomplete/autocomplete_result.cc
@@ -17,6 +17,8 @@
#include "components/autocomplete/autocomplete_input.h"
#include "components/metrics/proto/omnibox_event.pb.h"
#include "components/metrics/proto/omnibox_input_type.pb.h"
+#include "content/public/common/url_constants.h"
+#include "url/url_constants.h"
using metrics::OmniboxEventProto;
@@ -263,6 +265,17 @@ void AutocompleteResult::SortAndCull(
} else {
DCHECK_NE(metrics::OmniboxInputType::FORCED_QUERY, input.type())
<< debug_info;
+ // If the user explicitly typed a scheme, the default match should
+ // have the same scheme.
+ if ((input.type() == metrics::OmniboxInputType::URL) &&
+ input.parts().scheme.is_nonempty()) {
+ const std::string& in_scheme = base::UTF16ToUTF8(input.scheme());
+ const std::string& dest_scheme =
+ default_match_->destination_url.scheme();
+ DCHECK((in_scheme == dest_scheme) ||
+ ((in_scheme == url::kAboutScheme) &&
+ (dest_scheme == content::kChromeUIScheme))) << debug_info;
+ }
}
}
}
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_match.cc ('k') | chrome/browser/autocomplete/base_search_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698