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/browser/shortcuts_provider.h" | 5 #include "components/omnibox/browser/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 10 matching lines...) Expand all Loading... |
21 #include "components/history/core/browser/history_service.h" | 21 #include "components/history/core/browser/history_service.h" |
22 #include "components/metrics/proto/omnibox_input_type.pb.h" | 22 #include "components/metrics/proto/omnibox_input_type.pb.h" |
23 #include "components/omnibox/browser/autocomplete_i18n.h" | 23 #include "components/omnibox/browser/autocomplete_i18n.h" |
24 #include "components/omnibox/browser/autocomplete_input.h" | 24 #include "components/omnibox/browser/autocomplete_input.h" |
25 #include "components/omnibox/browser/autocomplete_match.h" | 25 #include "components/omnibox/browser/autocomplete_match.h" |
26 #include "components/omnibox/browser/autocomplete_provider_client.h" | 26 #include "components/omnibox/browser/autocomplete_provider_client.h" |
27 #include "components/omnibox/browser/autocomplete_result.h" | 27 #include "components/omnibox/browser/autocomplete_result.h" |
28 #include "components/omnibox/browser/history_provider.h" | 28 #include "components/omnibox/browser/history_provider.h" |
29 #include "components/omnibox/browser/omnibox_field_trial.h" | 29 #include "components/omnibox/browser/omnibox_field_trial.h" |
30 #include "components/omnibox/browser/url_prefix.h" | 30 #include "components/omnibox/browser/url_prefix.h" |
31 #include "components/url_fixer/url_fixer.h" | 31 #include "components/url_formatter/url_fixer.h" |
32 #include "url/third_party/mozilla/url_parse.h" | 32 #include "url/third_party/mozilla/url_parse.h" |
33 | 33 |
34 namespace { | 34 namespace { |
35 | 35 |
36 class DestinationURLEqualsURL { | 36 class DestinationURLEqualsURL { |
37 public: | 37 public: |
38 explicit DestinationURLEqualsURL(const GURL& url) : url_(url) {} | 38 explicit DestinationURLEqualsURL(const GURL& url) : url_(url) {} |
39 bool operator()(const AutocompleteMatch& match) const { | 39 bool operator()(const AutocompleteMatch& match) const { |
40 return match.destination_url == url_; | 40 return match.destination_url == url_; |
41 } | 41 } |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 const double kMaxDecaySpeedDivisor = 5.0; | 412 const double kMaxDecaySpeedDivisor = 5.0; |
413 const double kNumUsesPerDecaySpeedDivisorIncrement = 5.0; | 413 const double kNumUsesPerDecaySpeedDivisorIncrement = 5.0; |
414 double decay_divisor = std::min( | 414 double decay_divisor = std::min( |
415 kMaxDecaySpeedDivisor, | 415 kMaxDecaySpeedDivisor, |
416 (shortcut.number_of_hits + kNumUsesPerDecaySpeedDivisorIncrement - 1) / | 416 (shortcut.number_of_hits + kNumUsesPerDecaySpeedDivisorIncrement - 1) / |
417 kNumUsesPerDecaySpeedDivisorIncrement); | 417 kNumUsesPerDecaySpeedDivisorIncrement); |
418 | 418 |
419 return static_cast<int>((base_score / exp(decay_exponent / decay_divisor)) + | 419 return static_cast<int>((base_score / exp(decay_exponent / decay_divisor)) + |
420 0.5); | 420 0.5); |
421 } | 421 } |
OLD | NEW |