| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 AutocompleteProvider::TYPE_HISTORY_QUICK), | 57 AutocompleteProvider::TYPE_HISTORY_QUICK), |
| 58 languages_(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)) { | 58 languages_(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)) { |
| 59 } | 59 } |
| 60 | 60 |
| 61 void HistoryQuickProvider::Start(const AutocompleteInput& input, | 61 void HistoryQuickProvider::Start(const AutocompleteInput& input, |
| 62 bool minimal_changes) { | 62 bool minimal_changes) { |
| 63 matches_.clear(); | 63 matches_.clear(); |
| 64 if (disabled_) | 64 if (disabled_) |
| 65 return; | 65 return; |
| 66 | 66 |
| 67 // Don't bother with INVALID and FORCED_QUERY. Also pass when looking for | 67 // Don't bother with INVALID and FORCED_QUERY. |
| 68 // BEST_MATCH and there is no inline autocompletion because none of the HQP | |
| 69 // matches can score highly enough to qualify. | |
| 70 if ((input.type() == AutocompleteInput::INVALID) || | 68 if ((input.type() == AutocompleteInput::INVALID) || |
| 71 (input.type() == AutocompleteInput::FORCED_QUERY) || | 69 (input.type() == AutocompleteInput::FORCED_QUERY)) |
| 72 (input.matches_requested() == AutocompleteInput::BEST_MATCH && | |
| 73 input.prevent_inline_autocomplete())) | |
| 74 return; | 70 return; |
| 75 | 71 |
| 76 autocomplete_input_ = input; | 72 autocomplete_input_ = input; |
| 77 | 73 |
| 78 // TODO(pkasting): We should just block here until this loads. Any time | 74 // TODO(pkasting): We should just block here until this loads. Any time |
| 79 // someone unloads the history backend, we'll get inconsistent inline | 75 // someone unloads the history backend, we'll get inconsistent inline |
| 80 // autocomplete behavior here. | 76 // autocomplete behavior here. |
| 81 if (GetIndex()) { | 77 if (GetIndex()) { |
| 82 base::TimeTicks start_time = base::TimeTicks::Now(); | 78 base::TimeTicks start_time = base::TimeTicks::Now(); |
| 83 DoAutocomplete(); | 79 DoAutocomplete(); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 if (index_for_testing_.get()) | 305 if (index_for_testing_.get()) |
| 310 return index_for_testing_.get(); | 306 return index_for_testing_.get(); |
| 311 | 307 |
| 312 HistoryService* const history_service = | 308 HistoryService* const history_service = |
| 313 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); | 309 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); |
| 314 if (!history_service) | 310 if (!history_service) |
| 315 return NULL; | 311 return NULL; |
| 316 | 312 |
| 317 return history_service->InMemoryIndex(); | 313 return history_service->InMemoryIndex(); |
| 318 } | 314 } |
| OLD | NEW |