| 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 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 CommitResult(true); // Ensure any new result gets committed immediately. If | 798 CommitResult(true); // Ensure any new result gets committed immediately. If |
| 799 // it was committed already or hasn't been modified, this | 799 // it was committed already or hasn't been modified, this |
| 800 // is harmless. | 800 // is harmless. We need to notify the edit box, because |
| 801 // the default match may have been changed. |
| 801 } | 802 } |
| 802 | 803 |
| 803 void AutocompleteController::CommitIfQueryHasNeverBeenCommitted() { | 804 void AutocompleteController::CommitIfQueryHasNeverBeenCommitted() { |
| 804 if (!have_committed_during_this_query_) | 805 if (!have_committed_during_this_query_) |
| 805 CommitResult(true); | 806 CommitResult(true); |
| 806 } | 807 } |
| 807 | 808 |
| 808 void AutocompleteController::OnProviderUpdate(bool updated_matches) { | 809 void AutocompleteController::OnProviderUpdate(bool updated_matches) { |
| 809 CheckIfDone(); | 810 CheckIfDone(); |
| 810 if (updated_matches || done_) | 811 if (updated_matches || done_) |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 void AutocompleteController::CheckIfDone() { | 889 void AutocompleteController::CheckIfDone() { |
| 889 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); | 890 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); |
| 890 ++i) { | 891 ++i) { |
| 891 if (!(*i)->done()) { | 892 if (!(*i)->done()) { |
| 892 done_ = false; | 893 done_ = false; |
| 893 return; | 894 return; |
| 894 } | 895 } |
| 895 } | 896 } |
| 896 done_ = true; | 897 done_ = true; |
| 897 } | 898 } |
| OLD | NEW |