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

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

Issue 836213002: Assume all providers may give zero suggest responses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation issue in athena Created 5 years, 11 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/history_quick_provider.h" 5 #include "chrome/browser/autocomplete/history_quick_provider.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 using history::ScoredHistoryMatches; 49 using history::ScoredHistoryMatches;
50 50
51 bool HistoryQuickProvider::disabled_ = false; 51 bool HistoryQuickProvider::disabled_ = false;
52 52
53 HistoryQuickProvider::HistoryQuickProvider(Profile* profile) 53 HistoryQuickProvider::HistoryQuickProvider(Profile* profile)
54 : HistoryProvider(profile, AutocompleteProvider::TYPE_HISTORY_QUICK), 54 : HistoryProvider(profile, AutocompleteProvider::TYPE_HISTORY_QUICK),
55 languages_(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)) { 55 languages_(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)) {
56 } 56 }
57 57
58 void HistoryQuickProvider::Start(const AutocompleteInput& input, 58 void HistoryQuickProvider::Start(const AutocompleteInput& input,
59 bool minimal_changes) { 59 bool minimal_changes,
60 bool called_due_to_focus) {
60 matches_.clear(); 61 matches_.clear();
61 if (disabled_) 62 if (disabled_ || called_due_to_focus)
62 return; 63 return;
63 64
64 // Don't bother with INVALID and FORCED_QUERY. 65 // Don't bother with INVALID and FORCED_QUERY.
65 if ((input.type() == metrics::OmniboxInputType::INVALID) || 66 if ((input.type() == metrics::OmniboxInputType::INVALID) ||
66 (input.type() == metrics::OmniboxInputType::FORCED_QUERY)) 67 (input.type() == metrics::OmniboxInputType::FORCED_QUERY))
67 return; 68 return;
68 69
69 autocomplete_input_ = input; 70 autocomplete_input_ = input;
70 71
71 // TODO(pkasting): We should just block here until this loads. Any time 72 // TODO(pkasting): We should just block here until this loads. Any time
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 if (index_for_testing_.get()) 292 if (index_for_testing_.get())
292 return index_for_testing_.get(); 293 return index_for_testing_.get();
293 294
294 HistoryService* const history_service = 295 HistoryService* const history_service =
295 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); 296 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
296 if (!history_service) 297 if (!history_service)
297 return NULL; 298 return NULL;
298 299
299 return history_service->InMemoryIndex(); 300 return history_service->InMemoryIndex();
300 } 301 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/history_quick_provider.h ('k') | chrome/browser/autocomplete/history_quick_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698