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 "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 // we're trying to only clear the popup, not touch the edit... this is all | 795 // we're trying to only clear the popup, not touch the edit... this is all |
796 // a mess and should be cleaned up :( | 796 // a mess and should be cleaned up :( |
797 } | 797 } |
798 latest_result_.CopyFrom(result_); | 798 latest_result_.CopyFrom(result_); |
799 } | 799 } |
800 | 800 |
801 void AutocompleteController::DeleteMatch(const AutocompleteMatch& match) { | 801 void AutocompleteController::DeleteMatch(const AutocompleteMatch& match) { |
802 DCHECK(match.deletable); | 802 DCHECK(match.deletable); |
803 match.provider->DeleteMatch(match); // This may synchronously call back to | 803 match.provider->DeleteMatch(match); // This may synchronously call back to |
804 // OnProviderUpdate(). | 804 // OnProviderUpdate(). |
| 805 DCHECK(updated_latest_result_); |
805 CommitResult(true); // Ensure any new result gets committed immediately. If | 806 CommitResult(true); // Ensure any new result gets committed immediately. If |
806 // it was committed already or hasn't been modified, this | 807 // it was committed already or hasn't been modified, this |
807 // is harmless. | 808 // is harmless. We need to notify the edit box, because |
| 809 // the default match may have been changed. |
808 } | 810 } |
809 | 811 |
810 void AutocompleteController::CommitIfQueryHasNeverBeenCommitted() { | 812 void AutocompleteController::CommitIfQueryHasNeverBeenCommitted() { |
811 if (!have_committed_during_this_query_) | 813 if (!have_committed_during_this_query_) |
812 CommitResult(true); | 814 CommitResult(true); |
813 } | 815 } |
814 | 816 |
815 void AutocompleteController::OnProviderUpdate(bool updated_matches) { | 817 void AutocompleteController::OnProviderUpdate(bool updated_matches) { |
816 CheckIfDone(); | 818 CheckIfDone(); |
817 if (updated_matches || done_) | 819 if (updated_matches || done_) |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 void AutocompleteController::CheckIfDone() { | 897 void AutocompleteController::CheckIfDone() { |
896 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); | 898 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); |
897 ++i) { | 899 ++i) { |
898 if (!(*i)->done()) { | 900 if (!(*i)->done()) { |
899 done_ = false; | 901 done_ = false; |
900 return; | 902 return; |
901 } | 903 } |
902 } | 904 } |
903 done_ = true; | 905 done_ = true; |
904 } | 906 } |
OLD | NEW |