| Index: chrome/browser/autocomplete/autocomplete_result.cc
|
| diff --git a/chrome/browser/autocomplete/autocomplete_result.cc b/chrome/browser/autocomplete/autocomplete_result.cc
|
| index dda6ec58339463d3196f7966e1aad66dc86682b7..c723d3f4d47e5b5b14f3c8c99b2aca63c2595fa0 100644
|
| --- a/chrome/browser/autocomplete/autocomplete_result.cc
|
| +++ b/chrome/browser/autocomplete/autocomplete_result.cc
|
| @@ -134,13 +134,8 @@ void AutocompleteResult::SortAndCull(const AutocompleteInput& input,
|
| default_match_ = begin();
|
|
|
| // Set the alternate nav URL.
|
| - alternate_nav_url_ = GURL();
|
| - if (input.type() == AutocompleteInput::UNKNOWN &&
|
| - default_match_ != end() &&
|
| - AutocompleteMatch::IsSearchType(default_match_->type) &&
|
| - default_match_->transition != content::PAGE_TRANSITION_KEYWORD &&
|
| - input.canonicalized_url() != default_match_->destination_url)
|
| - alternate_nav_url_ = input.canonicalized_url();
|
| + alternate_nav_url_ = default_match_ == end() ? GURL() :
|
| + ComputeAlternateNavUrl(input, *default_match_);
|
| }
|
|
|
| bool AutocompleteResult::HasCopiedMatches() const {
|
| @@ -208,6 +203,17 @@ void AutocompleteResult::Validate() const {
|
| }
|
| #endif
|
|
|
| +// static
|
| +GURL AutocompleteResult::ComputeAlternateNavUrl(
|
| + const AutocompleteInput& input,
|
| + const AutocompleteMatch& match) {
|
| + return (input.type() == AutocompleteInput::UNKNOWN &&
|
| + AutocompleteMatch::IsSearchType(match.type) &&
|
| + match.transition != content::PAGE_TRANSITION_KEYWORD &&
|
| + input.canonicalized_url() != match.destination_url) ?
|
| + input.canonicalized_url() : GURL();
|
| +}
|
| +
|
| void AutocompleteResult::BuildProviderToMatches(
|
| ProviderToMatches* provider_to_matches) const {
|
| for (ACMatches::const_iterator i(begin()); i != end(); ++i)
|
|
|