| Index: chrome/browser/autocomplete/autocomplete_match.cc
|
| ===================================================================
|
| --- chrome/browser/autocomplete/autocomplete_match.cc (revision 80563)
|
| +++ chrome/browser/autocomplete/autocomplete_match.cc (working copy)
|
| @@ -94,15 +94,16 @@
|
| // Sort identical destination_urls together. Place the most relevant matches
|
| // first, so that when we call std::unique(), these are the ones that get
|
| // preserved.
|
| - return (elem1.destination_url != elem2.destination_url) ?
|
| - (elem1.destination_url < elem2.destination_url) :
|
| + return
|
| + (elem1.destination_url_normalized != elem2.destination_url_normalized) ?
|
| + (elem1.destination_url_normalized < elem2.destination_url_normalized) :
|
| MoreRelevant(elem1, elem2);
|
| }
|
|
|
| // static
|
| bool AutocompleteMatch::DestinationsEqual(const AutocompleteMatch& elem1,
|
| const AutocompleteMatch& elem2) {
|
| - return elem1.destination_url == elem2.destination_url;
|
| + return elem1.destination_url_normalized == elem2.destination_url_normalized;
|
| }
|
|
|
| // static
|
| @@ -151,6 +152,25 @@
|
| }
|
| }
|
|
|
| +void AutocompleteMatch::ComputeStrippedDestinationURL() {
|
| + static const char prefix[] = "www.";
|
| + static const size_t prefix_len = strlen(prefix);
|
| +
|
| + if (!destination_url_normalized.is_empty())
|
| + return;
|
| +
|
| + std::string host = destination_url.host();
|
| + if (destination_url.is_valid() && host.compare(0, prefix_len, prefix) == 0) {
|
| + host = host.substr(prefix_len);
|
| + GURL::Replacements replace_host;
|
| + replace_host.SetHostStr(host);
|
| + destination_url_normalized =
|
| + destination_url.ReplaceComponents(replace_host);
|
| + } else {
|
| + destination_url_normalized = destination_url;
|
| + }
|
| +}
|
| +
|
| #ifndef NDEBUG
|
| void AutocompleteMatch::Validate() const {
|
| ValidateClassifications(contents, contents_class);
|
|
|