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/autocomplete/autocomplete_match.h" | 13 #include "chrome/browser/autocomplete/autocomplete_match.h" |
14 #include "chrome/browser/autocomplete/autocomplete_provider.h" | 14 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
15 #include "chrome/browser/omnibox/omnibox_field_trial.h" | 15 #include "chrome/browser/omnibox/omnibox_field_trial.h" |
16 #include "chrome/browser/search/search.h" | 16 #include "chrome/browser/search/search.h" |
17 #include "chrome/common/autocomplete_match_type.h" | |
18 #include "components/autocomplete/autocomplete_input.h" | 17 #include "components/autocomplete/autocomplete_input.h" |
19 #include "components/metrics/proto/omnibox_event.pb.h" | 18 #include "components/metrics/proto/omnibox_event.pb.h" |
20 #include "components/metrics/proto/omnibox_input_type.pb.h" | 19 #include "components/metrics/proto/omnibox_input_type.pb.h" |
21 | 20 |
22 using metrics::OmniboxEventProto; | 21 using metrics::OmniboxEventProto; |
23 | 22 |
24 namespace { | 23 namespace { |
25 | 24 |
26 // This class implements a special version of AutocompleteMatch::MoreRelevant | 25 // This class implements a special version of AutocompleteMatch::MoreRelevant |
27 // that allows matches of particular types to be demoted in AutocompleteResult. | 26 // that allows matches of particular types to be demoted in AutocompleteResult. |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 i != old_matches.rend() && delta > 0; ++i) { | 446 i != old_matches.rend() && delta > 0; ++i) { |
448 if (!HasMatchByDestination(*i, new_matches)) { | 447 if (!HasMatchByDestination(*i, new_matches)) { |
449 AutocompleteMatch match = *i; | 448 AutocompleteMatch match = *i; |
450 match.relevance = std::min(max_relevance, match.relevance); | 449 match.relevance = std::min(max_relevance, match.relevance); |
451 match.from_previous = true; | 450 match.from_previous = true; |
452 matches_.push_back(match); | 451 matches_.push_back(match); |
453 delta--; | 452 delta--; |
454 } | 453 } |
455 } | 454 } |
456 } | 455 } |
OLD | NEW |