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/omnibox/omnibox_field_trial.h" | |
14 #include "chrome/browser/search/search.h" | 13 #include "chrome/browser/search/search.h" |
15 #include "components/metrics/proto/omnibox_event.pb.h" | 14 #include "components/metrics/proto/omnibox_event.pb.h" |
16 #include "components/metrics/proto/omnibox_input_type.pb.h" | 15 #include "components/metrics/proto/omnibox_input_type.pb.h" |
17 #include "components/omnibox/autocomplete_input.h" | 16 #include "components/omnibox/autocomplete_input.h" |
18 #include "components/omnibox/autocomplete_match.h" | 17 #include "components/omnibox/autocomplete_match.h" |
19 #include "components/omnibox/autocomplete_provider.h" | 18 #include "components/omnibox/autocomplete_provider.h" |
| 19 #include "components/omnibox/omnibox_field_trial.h" |
20 #include "content/public/common/url_constants.h" | 20 #include "content/public/common/url_constants.h" |
21 #include "url/url_constants.h" | 21 #include "url/url_constants.h" |
22 | 22 |
23 using metrics::OmniboxEventProto; | 23 using metrics::OmniboxEventProto; |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 // This class implements a special version of AutocompleteMatch::MoreRelevant | 27 // This class implements a special version of AutocompleteMatch::MoreRelevant |
28 // that allows matches of particular types to be demoted in AutocompleteResult. | 28 // that allows matches of particular types to be demoted in AutocompleteResult. |
29 class CompareWithDemoteByType { | 29 class CompareWithDemoteByType { |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 i != old_matches.rend() && delta > 0; ++i) { | 459 i != old_matches.rend() && delta > 0; ++i) { |
460 if (!HasMatchByDestination(*i, new_matches)) { | 460 if (!HasMatchByDestination(*i, new_matches)) { |
461 AutocompleteMatch match = *i; | 461 AutocompleteMatch match = *i; |
462 match.relevance = std::min(max_relevance, match.relevance); | 462 match.relevance = std::min(max_relevance, match.relevance); |
463 match.from_previous = true; | 463 match.from_previous = true; |
464 matches_.push_back(match); | 464 matches_.push_back(match); |
465 delta--; | 465 delta--; |
466 } | 466 } |
467 } | 467 } |
468 } | 468 } |
OLD | NEW |