| 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 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 // we're trying to only clear the popup, not touch the edit... this is all | 788 // we're trying to only clear the popup, not touch the edit... this is all |
| 789 // a mess and should be cleaned up :( | 789 // a mess and should be cleaned up :( |
| 790 } | 790 } |
| 791 latest_result_.CopyFrom(result_); | 791 latest_result_.CopyFrom(result_); |
| 792 } | 792 } |
| 793 | 793 |
| 794 void AutocompleteController::DeleteMatch(const AutocompleteMatch& match) { | 794 void AutocompleteController::DeleteMatch(const AutocompleteMatch& match) { |
| 795 DCHECK(match.deletable); | 795 DCHECK(match.deletable); |
| 796 match.provider->DeleteMatch(match); // This may synchronously call back to | 796 match.provider->DeleteMatch(match); // This may synchronously call back to |
| 797 // OnProviderUpdate(). | 797 // OnProviderUpdate(). |
| 798 DCHECK(updated_latest_result_); |
| 798 CommitResult(true); // Ensure any new result gets committed immediately. If | 799 CommitResult(true); // Ensure any new result gets committed immediately. If |
| 799 // it was committed already or hasn't been modified, this | 800 // it was committed already or hasn't been modified, this |
| 800 // is harmless. | 801 // is harmless. We need to notify the edit box, because |
| 802 // the default match may have been changed. |
| 801 } | 803 } |
| 802 | 804 |
| 803 void AutocompleteController::CommitIfQueryHasNeverBeenCommitted() { | 805 void AutocompleteController::CommitIfQueryHasNeverBeenCommitted() { |
| 804 if (!have_committed_during_this_query_) | 806 if (!have_committed_during_this_query_) |
| 805 CommitResult(true); | 807 CommitResult(true); |
| 806 } | 808 } |
| 807 | 809 |
| 808 void AutocompleteController::OnProviderUpdate(bool updated_matches) { | 810 void AutocompleteController::OnProviderUpdate(bool updated_matches) { |
| 809 CheckIfDone(); | 811 CheckIfDone(); |
| 810 if (updated_matches || done_) | 812 if (updated_matches || done_) |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 void AutocompleteController::CheckIfDone() { | 890 void AutocompleteController::CheckIfDone() { |
| 889 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); | 891 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); |
| 890 ++i) { | 892 ++i) { |
| 891 if (!(*i)->done()) { | 893 if (!(*i)->done()) { |
| 892 done_ = false; | 894 done_ = false; |
| 893 return; | 895 return; |
| 894 } | 896 } |
| 895 } | 897 } |
| 896 done_ = true; | 898 done_ = true; |
| 897 } | 899 } |
| OLD | NEW |