| 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/browser/autocomplete_result.h" | 5 #include "components/omnibox/browser/autocomplete_result.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "components/metrics/proto/omnibox_event.pb.h" | 13 #include "components/metrics/proto/omnibox_event.pb.h" |
| 14 #include "components/metrics/proto/omnibox_input_type.pb.h" | 14 #include "components/metrics/proto/omnibox_input_type.pb.h" |
| 15 #include "components/omnibox/browser/autocomplete_input.h" | 15 #include "components/omnibox/browser/autocomplete_input.h" |
| 16 #include "components/omnibox/browser/autocomplete_match.h" | 16 #include "components/omnibox/browser/autocomplete_match.h" |
| 17 #include "components/omnibox/browser/autocomplete_provider.h" | 17 #include "components/omnibox/browser/autocomplete_provider.h" |
| 18 #include "components/omnibox/browser/match_compare.h" | 18 #include "components/omnibox/browser/match_compare.h" |
| 19 #include "components/omnibox/browser/omnibox_field_trial.h" | 19 #include "components/omnibox/browser/omnibox_field_trial.h" |
| 20 #include "components/omnibox/browser/omnibox_switches.h" | 20 #include "components/omnibox/browser/omnibox_switches.h" |
| 21 #include "components/search/search.h" | |
| 22 #include "components/url_formatter/url_fixer.h" | 21 #include "components/url_formatter/url_fixer.h" |
| 23 | 22 |
| 24 // static | 23 // static |
| 25 const size_t AutocompleteResult::kMaxMatches = 6; | 24 const size_t AutocompleteResult::kMaxMatches = 6; |
| 26 | 25 |
| 27 void AutocompleteResult::Selection::Clear() { | 26 void AutocompleteResult::Selection::Clear() { |
| 28 destination_url = GURL(); | 27 destination_url = GURL(); |
| 29 provider_affinity = NULL; | 28 provider_affinity = NULL; |
| 30 is_history_what_you_typed_match = false; | 29 is_history_what_you_typed_match = false; |
| 31 } | 30 } |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 i != old_matches.rend() && delta > 0; ++i) { | 387 i != old_matches.rend() && delta > 0; ++i) { |
| 389 if (!HasMatchByDestination(*i, new_matches)) { | 388 if (!HasMatchByDestination(*i, new_matches)) { |
| 390 AutocompleteMatch match = *i; | 389 AutocompleteMatch match = *i; |
| 391 match.relevance = std::min(max_relevance, match.relevance); | 390 match.relevance = std::min(max_relevance, match.relevance); |
| 392 match.from_previous = true; | 391 match.from_previous = true; |
| 393 matches_.push_back(match); | 392 matches_.push_back(match); |
| 394 delta--; | 393 delta--; |
| 395 } | 394 } |
| 396 } | 395 } |
| 397 } | 396 } |
| OLD | NEW |