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/search_provider.h" | 5 #include "chrome/browser/autocomplete/search_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 void SearchProvider::DoHistoryQuery(bool minimal_changes) { | 423 void SearchProvider::DoHistoryQuery(bool minimal_changes) { |
424 // The history query results are synchronous, so if minimal_changes is true, | 424 // The history query results are synchronous, so if minimal_changes is true, |
425 // we still have the last results and don't need to do anything. | 425 // we still have the last results and don't need to do anything. |
426 if (minimal_changes) | 426 if (minimal_changes) |
427 return; | 427 return; |
428 | 428 |
429 keyword_history_results_.clear(); | 429 keyword_history_results_.clear(); |
430 default_history_results_.clear(); | 430 default_history_results_.clear(); |
431 | 431 |
432 HistoryService* const history_service = | 432 HistoryService* const history_service = |
433 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); | 433 HistoryServiceFactory::GetForProfile( |
| 434 profile_, Profile::EXPLICIT_ACCESS).get(); |
434 history::URLDatabase* url_db = history_service ? | 435 history::URLDatabase* url_db = history_service ? |
435 history_service->InMemoryDatabase() : NULL; | 436 history_service->InMemoryDatabase() : NULL; |
436 if (!url_db) | 437 if (!url_db) |
437 return; | 438 return; |
438 | 439 |
439 // Request history for both the keyword and default provider. We grab many | 440 // Request history for both the keyword and default provider. We grab many |
440 // more matches than we'll ultimately clamp to so that if there are several | 441 // more matches than we'll ultimately clamp to so that if there are several |
441 // recent multi-word matches who scores are lowered (see | 442 // recent multi-word matches who scores are lowered (see |
442 // AddHistoryResultsToMap()), they won't crowd out older, higher-scoring | 443 // AddHistoryResultsToMap()), they won't crowd out older, higher-scoring |
443 // matches. Note that this doesn't fix the problem entirely, but merely | 444 // matches. Note that this doesn't fix the problem entirely, but merely |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 return match; | 1254 return match; |
1254 } | 1255 } |
1255 | 1256 |
1256 void SearchProvider::UpdateDone() { | 1257 void SearchProvider::UpdateDone() { |
1257 // We're done when the timer isn't running, there are no suggest queries | 1258 // We're done when the timer isn't running, there are no suggest queries |
1258 // pending, and we're not waiting on instant. | 1259 // pending, and we're not waiting on instant. |
1259 done_ = (!timer_.IsRunning() && (suggest_results_pending_ == 0) && | 1260 done_ = (!timer_.IsRunning() && (suggest_results_pending_ == 0) && |
1260 (instant_finalized_ || | 1261 (instant_finalized_ || |
1261 !InstantController::IsInstantEnabled(profile_))); | 1262 !InstantController::IsInstantEnabled(profile_))); |
1262 } | 1263 } |
OLD | NEW |