Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(713)

Side by Side Diff: chrome/browser/autocomplete/shortcuts_provider.cc

Issue 1152373003: url: Fix the TODO in url_parse.h header. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/shortcuts_provider.h" 5 #include "chrome/browser/autocomplete/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 15 matching lines...) Expand all
26 #include "chrome/common/pref_names.h" 26 #include "chrome/common/pref_names.h"
27 #include "chrome/common/url_constants.h" 27 #include "chrome/common/url_constants.h"
28 #include "components/history/core/browser/history_service.h" 28 #include "components/history/core/browser/history_service.h"
29 #include "components/metrics/proto/omnibox_input_type.pb.h" 29 #include "components/metrics/proto/omnibox_input_type.pb.h"
30 #include "components/omnibox/autocomplete_input.h" 30 #include "components/omnibox/autocomplete_input.h"
31 #include "components/omnibox/autocomplete_match.h" 31 #include "components/omnibox/autocomplete_match.h"
32 #include "components/omnibox/autocomplete_result.h" 32 #include "components/omnibox/autocomplete_result.h"
33 #include "components/omnibox/omnibox_field_trial.h" 33 #include "components/omnibox/omnibox_field_trial.h"
34 #include "components/omnibox/url_prefix.h" 34 #include "components/omnibox/url_prefix.h"
35 #include "components/url_fixer/url_fixer.h" 35 #include "components/url_fixer/url_fixer.h"
36 #include "url/url_parse.h" 36 #include "url/third_party/mozilla/url_parse.h"
37 37
38 namespace { 38 namespace {
39 39
40 class DestinationURLEqualsURL { 40 class DestinationURLEqualsURL {
41 public: 41 public:
42 explicit DestinationURLEqualsURL(const GURL& url) : url_(url) {} 42 explicit DestinationURLEqualsURL(const GURL& url) : url_(url) {}
43 bool operator()(const AutocompleteMatch& match) const { 43 bool operator()(const AutocompleteMatch& match) const {
44 return match.destination_url == url_; 44 return match.destination_url == url_;
45 } 45 }
46 private: 46 private:
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 // (1.0 / each 5 additional hits), up to a maximum of 5x as long. 401 // (1.0 / each 5 additional hits), up to a maximum of 5x as long.
402 const double kMaxDecaySpeedDivisor = 5.0; 402 const double kMaxDecaySpeedDivisor = 5.0;
403 const double kNumUsesPerDecaySpeedDivisorIncrement = 5.0; 403 const double kNumUsesPerDecaySpeedDivisorIncrement = 5.0;
404 double decay_divisor = std::min(kMaxDecaySpeedDivisor, 404 double decay_divisor = std::min(kMaxDecaySpeedDivisor,
405 (shortcut.number_of_hits + kNumUsesPerDecaySpeedDivisorIncrement - 1) / 405 (shortcut.number_of_hits + kNumUsesPerDecaySpeedDivisorIncrement - 1) /
406 kNumUsesPerDecaySpeedDivisorIncrement); 406 kNumUsesPerDecaySpeedDivisorIncrement);
407 407
408 return static_cast<int>((base_score / exp(decay_exponent / decay_divisor)) + 408 return static_cast<int>((base_score / exp(decay_exponent / decay_divisor)) +
409 0.5); 409 0.5);
410 } 410 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/history_url_provider.cc ('k') | chrome/browser/prerender/prerender_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698