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

Side by Side Diff: components/omnibox/browser/shortcuts_provider.cc

Issue 1855423003: Interpret '?' and Ctrl-K or Ctrl-E as putting omnibox in keyword search mode for Default Search Pro… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add includes for mac tests Created 4 years, 6 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 "components/omnibox/browser/shortcuts_provider.h" 5 #include "components/omnibox/browser/shortcuts_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 109 }
110 } 110 }
111 111
112 void ShortcutsProvider::Start(const AutocompleteInput& input, 112 void ShortcutsProvider::Start(const AutocompleteInput& input,
113 bool minimal_changes) { 113 bool minimal_changes) {
114 TRACE_EVENT0("omnibox", "ShortcutsProvider::Start"); 114 TRACE_EVENT0("omnibox", "ShortcutsProvider::Start");
115 matches_.clear(); 115 matches_.clear();
116 116
117 if (input.from_omnibox_focus() || 117 if (input.from_omnibox_focus() ||
118 (input.type() == metrics::OmniboxInputType::INVALID) || 118 (input.type() == metrics::OmniboxInputType::INVALID) ||
119 (input.type() == metrics::OmniboxInputType::FORCED_QUERY) ||
120 input.text().empty() || !initialized_) 119 input.text().empty() || !initialized_)
121 return; 120 return;
122 121
123 base::TimeTicks start_time = base::TimeTicks::Now(); 122 base::TimeTicks start_time = base::TimeTicks::Now();
124 GetMatches(input); 123 GetMatches(input);
125 if (input.text().length() < 6) { 124 if (input.text().length() < 6) {
126 base::TimeTicks end_time = base::TimeTicks::Now(); 125 base::TimeTicks end_time = base::TimeTicks::Now();
127 std::string name = "ShortcutsProvider.QueryIndexTime." + 126 std::string name = "ShortcutsProvider.QueryIndexTime." +
128 base::SizeTToString(input.text().size()); 127 base::SizeTToString(input.text().size());
129 base::HistogramBase* counter = base::Histogram::FactoryGet( 128 base::HistogramBase* counter = base::Histogram::FactoryGet(
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 const double kMaxDecaySpeedDivisor = 5.0; 476 const double kMaxDecaySpeedDivisor = 5.0;
478 const double kNumUsesPerDecaySpeedDivisorIncrement = 5.0; 477 const double kNumUsesPerDecaySpeedDivisorIncrement = 5.0;
479 double decay_divisor = std::min( 478 double decay_divisor = std::min(
480 kMaxDecaySpeedDivisor, 479 kMaxDecaySpeedDivisor,
481 (shortcut.number_of_hits + kNumUsesPerDecaySpeedDivisorIncrement - 1) / 480 (shortcut.number_of_hits + kNumUsesPerDecaySpeedDivisorIncrement - 1) /
482 kNumUsesPerDecaySpeedDivisorIncrement); 481 kNumUsesPerDecaySpeedDivisorIncrement);
483 482
484 return static_cast<int>((base_score / exp(decay_exponent / decay_divisor)) + 483 return static_cast<int>((base_score / exp(decay_exponent / decay_divisor)) +
485 0.5); 484 0.5);
486 } 485 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/search_suggestion_parser.cc ('k') | components/search_engines/template_url_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698