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/autocomplete_controller.h" | 5 #include "components/omnibox/autocomplete_controller.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 result_.Reset(); | 400 result_.Reset(); |
401 | 401 |
402 AutocompleteResult last_result; | 402 AutocompleteResult last_result; |
403 last_result.Swap(&result_); | 403 last_result.Swap(&result_); |
404 | 404 |
405 for (Providers::const_iterator i(providers_.begin()); | 405 for (Providers::const_iterator i(providers_.begin()); |
406 i != providers_.end(); ++i) | 406 i != providers_.end(); ++i) |
407 result_.AppendMatches(input_, (*i)->matches()); | 407 result_.AppendMatches(input_, (*i)->matches()); |
408 | 408 |
409 // Sort the matches and trim to a small number of "best" matches. | 409 // Sort the matches and trim to a small number of "best" matches. |
410 result_.SortAndCull(input_, template_url_service_); | 410 result_.SortAndCull(input_, provider_client_->GetAcceptLanguages(), |
| 411 template_url_service_); |
411 | 412 |
412 // Need to validate before invoking CopyOldMatches as the old matches are not | 413 // Need to validate before invoking CopyOldMatches as the old matches are not |
413 // valid against the current input. | 414 // valid against the current input. |
414 #ifndef NDEBUG | 415 #ifndef NDEBUG |
415 result_.Validate(); | 416 result_.Validate(); |
416 #endif | 417 #endif |
417 | 418 |
418 if (!done_) { | 419 if (!done_) { |
419 // This conditional needs to match the conditional in Start that invokes | 420 // This conditional needs to match the conditional in Start that invokes |
420 // StartExpireTimer. | 421 // StartExpireTimer. |
421 result_.CopyOldMatches(input_, last_result, template_url_service_); | 422 result_.CopyOldMatches(input_, provider_client_->GetAcceptLanguages(), |
| 423 last_result, template_url_service_); |
422 } | 424 } |
423 | 425 |
424 UpdateKeywordDescriptions(&result_); | 426 UpdateKeywordDescriptions(&result_); |
425 UpdateAssociatedKeywords(&result_); | 427 UpdateAssociatedKeywords(&result_); |
426 UpdateAssistedQueryStats(&result_); | 428 UpdateAssistedQueryStats(&result_); |
427 if (search_provider_) | 429 if (search_provider_) |
428 search_provider_->RegisterDisplayedAnswers(result_); | 430 search_provider_->RegisterDisplayedAnswers(result_); |
429 | 431 |
430 const bool default_is_valid = result_.default_match() != result_.end(); | 432 const bool default_is_valid = result_.default_match() != result_.end(); |
431 base::string16 default_associated_keyword; | 433 base::string16 default_associated_keyword; |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 expire_timer_.Stop(); | 640 expire_timer_.Stop(); |
639 stop_timer_.Stop(); | 641 stop_timer_.Stop(); |
640 done_ = true; | 642 done_ = true; |
641 if (clear_result && !result_.empty()) { | 643 if (clear_result && !result_.empty()) { |
642 result_.Reset(); | 644 result_.Reset(); |
643 // NOTE: We pass in false since we're trying to only clear the popup, not | 645 // NOTE: We pass in false since we're trying to only clear the popup, not |
644 // touch the edit... this is all a mess and should be cleaned up :( | 646 // touch the edit... this is all a mess and should be cleaned up :( |
645 NotifyChanged(false); | 647 NotifyChanged(false); |
646 } | 648 } |
647 } | 649 } |
OLD | NEW |