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

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

Issue 8387060: Enable ShortcutsProvider for omnibox on the trunk by default (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/autocomplete/autocomplete.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 shortcuts_backend_->RemoveObserver(this); 69 shortcuts_backend_->RemoveObserver(this);
70 } 70 }
71 71
72 void ShortcutsProvider::Start(const AutocompleteInput& input, 72 void ShortcutsProvider::Start(const AutocompleteInput& input,
73 bool minimal_changes) { 73 bool minimal_changes) {
74 matches_.clear(); 74 matches_.clear();
75 75
76 if (input.type() == AutocompleteInput::INVALID) 76 if (input.type() == AutocompleteInput::INVALID)
77 return; 77 return;
78 78
79 if (input.text().empty())
80 return;
81
79 if (!initialized_) 82 if (!initialized_)
80 return; 83 return;
81 84
82 base::TimeTicks start_time = base::TimeTicks::Now(); 85 base::TimeTicks start_time = base::TimeTicks::Now();
83 GetMatches(input); 86 GetMatches(input);
84 if (input.text().length() < 6) { 87 if (input.text().length() < 6) {
85 base::TimeTicks end_time = base::TimeTicks::Now(); 88 base::TimeTicks end_time = base::TimeTicks::Now();
86 std::string name = "ShortcutsProvider.QueryIndexTime." + 89 std::string name = "ShortcutsProvider.QueryIndexTime." +
87 base::IntToString(input.text().size()); 90 base::IntToString(input.text().size());
88 base::Histogram* counter = base::Histogram::FactoryGet( 91 base::Histogram* counter = base::Histogram::FactoryGet(
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 303
301 void ShortcutsProvider::set_shortcuts_backend( 304 void ShortcutsProvider::set_shortcuts_backend(
302 history::ShortcutsBackend* shortcuts_backend) { 305 history::ShortcutsBackend* shortcuts_backend) {
303 DCHECK(shortcuts_backend); 306 DCHECK(shortcuts_backend);
304 shortcuts_backend_ = shortcuts_backend; 307 shortcuts_backend_ = shortcuts_backend;
305 shortcuts_backend_->AddObserver(this); 308 shortcuts_backend_->AddObserver(this);
306 if (shortcuts_backend_->initialized()) 309 if (shortcuts_backend_->initialized())
307 initialized_ = true; 310 initialized_ = true;
308 } 311 }
309 312
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698