| 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 "components/omnibox/shortcuts_provider.h" | 5 #include "components/omnibox/shortcuts_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 !input.prevent_inline_autocomplete() || | 215 !input.prevent_inline_autocomplete() || |
| 216 match.inline_autocompletion.empty(); | 216 match.inline_autocompletion.empty(); |
| 217 } | 217 } |
| 218 } else { | 218 } else { |
| 219 const size_t inline_autocomplete_offset = | 219 const size_t inline_autocomplete_offset = |
| 220 URLPrefix::GetInlineAutocompleteOffset( | 220 URLPrefix::GetInlineAutocompleteOffset( |
| 221 input.text(), fixed_up_input_text, true, match.fill_into_edit); | 221 input.text(), fixed_up_input_text, true, match.fill_into_edit); |
| 222 if (inline_autocomplete_offset != base::string16::npos) { | 222 if (inline_autocomplete_offset != base::string16::npos) { |
| 223 match.inline_autocompletion = | 223 match.inline_autocompletion = |
| 224 match.fill_into_edit.substr(inline_autocomplete_offset); | 224 match.fill_into_edit.substr(inline_autocomplete_offset); |
| 225 match.StripLoneSlashOnInlineAutocompletion(); |
| 225 match.allowed_to_be_default_match = | 226 match.allowed_to_be_default_match = |
| 226 !HistoryProvider::PreventInlineAutocomplete(input) || | 227 !HistoryProvider::PreventInlineAutocomplete(input) || |
| 227 match.inline_autocompletion.empty(); | 228 match.inline_autocompletion.empty(); |
| 228 } | 229 } |
| 229 } | 230 } |
| 230 match.EnsureUWYTIsAllowedToBeDefault(input.canonicalized_url(), | 231 match.EnsureUWYTIsAllowedToBeDefault(input.canonicalized_url(), |
| 231 client_->GetTemplateURLService()); | 232 client_->GetTemplateURLService()); |
| 232 | 233 |
| 233 // Try to mark pieces of the contents and description as matches if they | 234 // Try to mark pieces of the contents and description as matches if they |
| 234 // appear in |input.text()|. | 235 // appear in |input.text()|. |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 const double kMaxDecaySpeedDivisor = 5.0; | 396 const double kMaxDecaySpeedDivisor = 5.0; |
| 396 const double kNumUsesPerDecaySpeedDivisorIncrement = 5.0; | 397 const double kNumUsesPerDecaySpeedDivisorIncrement = 5.0; |
| 397 double decay_divisor = std::min( | 398 double decay_divisor = std::min( |
| 398 kMaxDecaySpeedDivisor, | 399 kMaxDecaySpeedDivisor, |
| 399 (shortcut.number_of_hits + kNumUsesPerDecaySpeedDivisorIncrement - 1) / | 400 (shortcut.number_of_hits + kNumUsesPerDecaySpeedDivisorIncrement - 1) / |
| 400 kNumUsesPerDecaySpeedDivisorIncrement); | 401 kNumUsesPerDecaySpeedDivisorIncrement); |
| 401 | 402 |
| 402 return static_cast<int>((base_score / exp(decay_exponent / decay_divisor)) + | 403 return static_cast<int>((base_score / exp(decay_exponent / decay_divisor)) + |
| 403 0.5); | 404 0.5); |
| 404 } | 405 } |
| OLD | NEW |