OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 // is harmless. | 896 // is harmless. |
897 } | 897 } |
898 | 898 |
899 void AutocompleteController::CommitIfQueryHasNeverBeenCommitted() { | 899 void AutocompleteController::CommitIfQueryHasNeverBeenCommitted() { |
900 if (!have_committed_during_this_query_) | 900 if (!have_committed_during_this_query_) |
901 CommitResult(true); | 901 CommitResult(true); |
902 } | 902 } |
903 | 903 |
904 void AutocompleteController::OnProviderUpdate(bool updated_matches) { | 904 void AutocompleteController::OnProviderUpdate(bool updated_matches) { |
905 CheckIfDone(); | 905 CheckIfDone(); |
906 if (updated_matches || done_) { | 906 if (updated_matches || done_) |
907 UpdateLatestResult(false); | 907 UpdateLatestResult(false); |
908 return; | |
909 } | |
910 } | 908 } |
911 | 909 |
912 void AutocompleteController::UpdateLatestResult(bool is_synchronous_pass) { | 910 void AutocompleteController::UpdateLatestResult(bool is_synchronous_pass) { |
913 // Add all providers' matches. | 911 // Add all providers' matches. |
914 latest_result_.Reset(); | 912 latest_result_.Reset(); |
915 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); | 913 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); |
916 ++i) | 914 ++i) |
917 latest_result_.AppendMatches((*i)->matches()); | 915 latest_result_.AppendMatches((*i)->matches()); |
918 updated_latest_result_ = true; | 916 updated_latest_result_ = true; |
919 | 917 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 void AutocompleteController::CheckIfDone() { | 1085 void AutocompleteController::CheckIfDone() { |
1088 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); | 1086 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); |
1089 ++i) { | 1087 ++i) { |
1090 if (!(*i)->done()) { | 1088 if (!(*i)->done()) { |
1091 done_ = false; | 1089 done_ = false; |
1092 return; | 1090 return; |
1093 } | 1091 } |
1094 } | 1092 } |
1095 done_ = true; | 1093 done_ = true; |
1096 } | 1094 } |
OLD | NEW |