| 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 "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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |