| 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" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 const ACMatches& matches) { | 87 const ACMatches& matches) { |
| 88 for (const auto& i : matches) { | 88 for (const auto& i : matches) { |
| 89 #ifndef NDEBUG | 89 #ifndef NDEBUG |
| 90 DCHECK_EQ(AutocompleteMatch::SanitizeString(i.contents), i.contents); | 90 DCHECK_EQ(AutocompleteMatch::SanitizeString(i.contents), i.contents); |
| 91 DCHECK_EQ(AutocompleteMatch::SanitizeString(i.description), | 91 DCHECK_EQ(AutocompleteMatch::SanitizeString(i.description), |
| 92 i.description); | 92 i.description); |
| 93 #endif | 93 #endif |
| 94 matches_.push_back(i); | 94 matches_.push_back(i); |
| 95 if (!AutocompleteMatch::IsSearchType(i.type)) { | 95 if (!AutocompleteMatch::IsSearchType(i.type)) { |
| 96 const OmniboxFieldTrial::EmphasizeTitlesCondition condition( | 96 const OmniboxFieldTrial::EmphasizeTitlesCondition condition( |
| 97 OmniboxFieldTrial::GetEmphasizeTitlesConditionForInput(input.type())); | 97 OmniboxFieldTrial::GetEmphasizeTitlesConditionForInput(input)); |
| 98 bool emphasize = false; | 98 bool emphasize = false; |
| 99 switch (condition) { | 99 switch (condition) { |
| 100 case OmniboxFieldTrial::EMPHASIZE_WHEN_NONEMPTY: | 100 case OmniboxFieldTrial::EMPHASIZE_WHEN_NONEMPTY: |
| 101 emphasize = !i.description.empty(); | 101 emphasize = !i.description.empty(); |
| 102 break; | 102 break; |
| 103 case OmniboxFieldTrial::EMPHASIZE_WHEN_TITLE_MATCHES: | 103 case OmniboxFieldTrial::EMPHASIZE_WHEN_TITLE_MATCHES: |
| 104 emphasize = !i.description.empty() && | 104 emphasize = !i.description.empty() && |
| 105 AutocompleteMatch::HasMatchStyle(i.description_class); | 105 AutocompleteMatch::HasMatchStyle(i.description_class); |
| 106 break; | 106 break; |
| 107 case OmniboxFieldTrial::EMPHASIZE_WHEN_ONLY_TITLE_MATCHES: | 107 case OmniboxFieldTrial::EMPHASIZE_WHEN_ONLY_TITLE_MATCHES: |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 i != old_matches.rend() && delta > 0; ++i) { | 398 i != old_matches.rend() && delta > 0; ++i) { |
| 399 if (!HasMatchByDestination(*i, new_matches)) { | 399 if (!HasMatchByDestination(*i, new_matches)) { |
| 400 AutocompleteMatch match = *i; | 400 AutocompleteMatch match = *i; |
| 401 match.relevance = std::min(max_relevance, match.relevance); | 401 match.relevance = std::min(max_relevance, match.relevance); |
| 402 match.from_previous = true; | 402 match.from_previous = true; |
| 403 matches_.push_back(match); | 403 matches_.push_back(match); |
| 404 delta--; | 404 delta--; |
| 405 } | 405 } |
| 406 } | 406 } |
| 407 } | 407 } |
| OLD | NEW |