| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/autocomplete/autocomplete_result.h" | 5 #include "chrome/browser/autocomplete/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" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/browser/search/search.h" | |
| 14 #include "components/metrics/proto/omnibox_event.pb.h" | 13 #include "components/metrics/proto/omnibox_event.pb.h" |
| 15 #include "components/metrics/proto/omnibox_input_type.pb.h" | 14 #include "components/metrics/proto/omnibox_input_type.pb.h" |
| 16 #include "components/omnibox/autocomplete_input.h" | 15 #include "components/omnibox/autocomplete_input.h" |
| 17 #include "components/omnibox/autocomplete_match.h" | 16 #include "components/omnibox/autocomplete_match.h" |
| 18 #include "components/omnibox/autocomplete_provider.h" | 17 #include "components/omnibox/autocomplete_provider.h" |
| 19 #include "components/omnibox/omnibox_field_trial.h" | 18 #include "components/omnibox/omnibox_field_trial.h" |
| 19 #include "components/search/search.h" |
| 20 #include "components/url_fixer/url_fixer.h" | 20 #include "components/url_fixer/url_fixer.h" |
| 21 | 21 |
| 22 using metrics::OmniboxEventProto; | 22 using metrics::OmniboxEventProto; |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 // This class implements a special version of AutocompleteMatch::MoreRelevant | 26 // This class implements a special version of AutocompleteMatch::MoreRelevant |
| 27 // that allows matches of particular types to be demoted in AutocompleteResult. | 27 // that allows matches of particular types to be demoted in AutocompleteResult. |
| 28 class CompareWithDemoteByType { | 28 class CompareWithDemoteByType { |
| 29 public: | 29 public: |
| (...skipping 427 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 |