OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/omnibox/autocomplete_result.h" | 5 #include "components/omnibox/autocomplete_result.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 i->Validate(); | 366 i->Validate(); |
367 } | 367 } |
368 #endif | 368 #endif |
369 | 369 |
370 // static | 370 // static |
371 GURL AutocompleteResult::ComputeAlternateNavUrl( | 371 GURL AutocompleteResult::ComputeAlternateNavUrl( |
372 const AutocompleteInput& input, | 372 const AutocompleteInput& input, |
373 const AutocompleteMatch& match) { | 373 const AutocompleteMatch& match) { |
374 return ((input.type() == metrics::OmniboxInputType::UNKNOWN) && | 374 return ((input.type() == metrics::OmniboxInputType::UNKNOWN) && |
375 (AutocompleteMatch::IsSearchType(match.type)) && | 375 (AutocompleteMatch::IsSearchType(match.type)) && |
376 (match.transition != content::PAGE_TRANSITION_KEYWORD) && | 376 (match.transition != ui::PAGE_TRANSITION_KEYWORD) && |
377 (input.canonicalized_url() != match.destination_url)) ? | 377 (input.canonicalized_url() != match.destination_url)) ? |
378 input.canonicalized_url() : GURL(); | 378 input.canonicalized_url() : GURL(); |
379 } | 379 } |
380 | 380 |
381 void AutocompleteResult::DedupMatchesByDestination( | 381 void AutocompleteResult::DedupMatchesByDestination( |
382 OmniboxEventProto::PageClassification page_classification, | 382 OmniboxEventProto::PageClassification page_classification, |
383 bool set_duplicate_matches, | 383 bool set_duplicate_matches, |
384 ACMatches* matches) { | 384 ACMatches* matches) { |
385 DestinationSort destination_sort(page_classification); | 385 DestinationSort destination_sort(page_classification); |
386 // Sort matches such that duplicate matches are consecutive. | 386 // Sort matches such that duplicate matches are consecutive. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 i != old_matches.rend() && delta > 0; ++i) { | 457 i != old_matches.rend() && delta > 0; ++i) { |
458 if (!HasMatchByDestination(*i, new_matches)) { | 458 if (!HasMatchByDestination(*i, new_matches)) { |
459 AutocompleteMatch match = *i; | 459 AutocompleteMatch match = *i; |
460 match.relevance = std::min(max_relevance, match.relevance); | 460 match.relevance = std::min(max_relevance, match.relevance); |
461 match.from_previous = true; | 461 match.from_previous = true; |
462 matches_.push_back(match); | 462 matches_.push_back(match); |
463 delta--; | 463 delta--; |
464 } | 464 } |
465 } | 465 } |
466 } | 466 } |
OLD | NEW |