Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/autocomplete.h" | 5 #include "chrome/browser/autocomplete/autocomplete.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 499 profile_ = profile; | 499 profile_ = profile; |
| 500 } | 500 } |
| 501 | 501 |
| 502 void AutocompleteProvider::Stop() { | 502 void AutocompleteProvider::Stop() { |
| 503 done_ = true; | 503 done_ = true; |
| 504 } | 504 } |
| 505 | 505 |
| 506 void AutocompleteProvider::DeleteMatch(const AutocompleteMatch& match) { | 506 void AutocompleteProvider::DeleteMatch(const AutocompleteMatch& match) { |
| 507 } | 507 } |
| 508 | 508 |
| 509 void AutocompleteProvider::PostProcessResult(AutocompleteResult* result) { | |
| 510 } | |
| 511 | |
| 509 AutocompleteProvider::~AutocompleteProvider() { | 512 AutocompleteProvider::~AutocompleteProvider() { |
| 510 Stop(); | 513 Stop(); |
| 511 } | 514 } |
| 512 | 515 |
| 513 // static | 516 // static |
| 514 bool AutocompleteProvider::HasHTTPScheme(const string16& input) { | 517 bool AutocompleteProvider::HasHTTPScheme(const string16& input) { |
| 515 std::string utf8_input(UTF16ToUTF8(input)); | 518 std::string utf8_input(UTF16ToUTF8(input)); |
| 516 url_parse::Component scheme; | 519 url_parse::Component scheme; |
| 517 if (url_util::FindAndCompareScheme(utf8_input, chrome::kViewSourceScheme, | 520 if (url_util::FindAndCompareScheme(utf8_input, chrome::kViewSourceScheme, |
| 518 &scheme)) | 521 &scheme)) |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 942 #ifndef NDEBUG | 945 #ifndef NDEBUG |
| 943 result_.Validate(); | 946 result_.Validate(); |
| 944 #endif | 947 #endif |
| 945 | 948 |
| 946 if (!done_) { | 949 if (!done_) { |
| 947 // This conditional needs to match the conditional in Start that invokes | 950 // This conditional needs to match the conditional in Start that invokes |
| 948 // StartExpireTimer. | 951 // StartExpireTimer. |
| 949 result_.CopyOldMatches(input_, last_result); | 952 result_.CopyOldMatches(input_, last_result); |
| 950 } | 953 } |
| 951 | 954 |
| 955 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); | |
|
Peter Kasting
2011/07/07 01:16:07
Nit: Should we DCHECK that the number of matches d
| |
| 956 ++i) | |
| 957 (*i)->PostProcessResult(&result_); | |
| 958 | |
| 952 bool notify_default_match = is_synchronous_pass; | 959 bool notify_default_match = is_synchronous_pass; |
| 953 if (!is_synchronous_pass) { | 960 if (!is_synchronous_pass) { |
| 954 const bool last_default_was_valid = | 961 const bool last_default_was_valid = |
| 955 last_result.default_match() != last_result.end(); | 962 last_result.default_match() != last_result.end(); |
| 956 const bool default_is_valid = result_.default_match() != result_.end(); | 963 const bool default_is_valid = result_.default_match() != result_.end(); |
| 957 // We've gotten async results. Send notification that the default match | 964 // We've gotten async results. Send notification that the default match |
| 958 // updated if fill_into_edit differs. We don't check the URL as that may | 965 // updated if fill_into_edit differs. We don't check the URL as that may |
| 959 // change for the default match even though the fill into edit hasn't | 966 // change for the default match even though the fill into edit hasn't |
| 960 // changed (see SearchProvider for one case of this). | 967 // changed (see SearchProvider for one case of this). |
| 961 notify_default_match = | 968 notify_default_match = |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 988 } | 995 } |
| 989 } | 996 } |
| 990 done_ = true; | 997 done_ = true; |
| 991 } | 998 } |
| 992 | 999 |
| 993 void AutocompleteController::StartExpireTimer() { | 1000 void AutocompleteController::StartExpireTimer() { |
| 994 if (result_.HasCopiedMatches()) | 1001 if (result_.HasCopiedMatches()) |
| 995 expire_timer_.Start(base::TimeDelta::FromMilliseconds(kExpireTimeMS), | 1002 expire_timer_.Start(base::TimeDelta::FromMilliseconds(kExpireTimeMS), |
| 996 this, &AutocompleteController::ExpireCopiedEntries); | 1003 this, &AutocompleteController::ExpireCopiedEntries); |
| 997 } | 1004 } |
| OLD | NEW |