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 "components/omnibox/browser/autocomplete_controller.h" | 5 #include "components/omnibox/browser/autocomplete_controller.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 result_.Reset(); | 417 result_.Reset(); |
418 | 418 |
419 AutocompleteResult last_result; | 419 AutocompleteResult last_result; |
420 last_result.Swap(&result_); | 420 last_result.Swap(&result_); |
421 | 421 |
422 for (Providers::const_iterator i(providers_.begin()); | 422 for (Providers::const_iterator i(providers_.begin()); |
423 i != providers_.end(); ++i) | 423 i != providers_.end(); ++i) |
424 result_.AppendMatches(input_, (*i)->matches()); | 424 result_.AppendMatches(input_, (*i)->matches()); |
425 | 425 |
426 // Sort the matches and trim to a small number of "best" matches. | 426 // Sort the matches and trim to a small number of "best" matches. |
427 result_.SortAndCull(input_, provider_client_->GetAcceptLanguages(), | 427 result_.SortAndCull(input_, template_url_service_); |
428 template_url_service_); | |
429 | 428 |
430 // Need to validate before invoking CopyOldMatches as the old matches are not | 429 // Need to validate before invoking CopyOldMatches as the old matches are not |
431 // valid against the current input. | 430 // valid against the current input. |
432 #ifndef NDEBUG | 431 #ifndef NDEBUG |
433 result_.Validate(); | 432 result_.Validate(); |
434 #endif | 433 #endif |
435 | 434 |
436 if (!done_) { | 435 if (!done_) { |
437 // This conditional needs to match the conditional in Start that invokes | 436 // This conditional needs to match the conditional in Start that invokes |
438 // StartExpireTimer. | 437 // StartExpireTimer. |
439 result_.CopyOldMatches(input_, provider_client_->GetAcceptLanguages(), | 438 result_.CopyOldMatches(input_, last_result, template_url_service_); |
440 last_result, template_url_service_); | |
441 } | 439 } |
442 | 440 |
443 UpdateKeywordDescriptions(&result_); | 441 UpdateKeywordDescriptions(&result_); |
444 UpdateAssociatedKeywords(&result_); | 442 UpdateAssociatedKeywords(&result_); |
445 UpdateAssistedQueryStats(&result_); | 443 UpdateAssistedQueryStats(&result_); |
446 if (search_provider_) | 444 if (search_provider_) |
447 search_provider_->RegisterDisplayedAnswers(result_); | 445 search_provider_->RegisterDisplayedAnswers(result_); |
448 | 446 |
449 const bool default_is_valid = result_.default_match() != result_.end(); | 447 const bool default_is_valid = result_.default_match() != result_.end(); |
450 base::string16 default_associated_keyword; | 448 base::string16 default_associated_keyword; |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 expire_timer_.Stop(); | 655 expire_timer_.Stop(); |
658 stop_timer_.Stop(); | 656 stop_timer_.Stop(); |
659 done_ = true; | 657 done_ = true; |
660 if (clear_result && !result_.empty()) { | 658 if (clear_result && !result_.empty()) { |
661 result_.Reset(); | 659 result_.Reset(); |
662 // NOTE: We pass in false since we're trying to only clear the popup, not | 660 // NOTE: We pass in false since we're trying to only clear the popup, not |
663 // touch the edit... this is all a mess and should be cleaned up :( | 661 // touch the edit... this is all a mess and should be cleaned up :( |
664 NotifyChanged(false); | 662 NotifyChanged(false); |
665 } | 663 } |
666 } | 664 } |
OLD | NEW |