OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/search_engines/template_url_model.h" | 5 #include "chrome/browser/search_engines/template_url_model.h" |
6 | 6 |
7 | 7 |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 std::string value_string = url.spec().substr(value.begin, value.len); | 981 std::string value_string = url.spec().substr(value.begin, value.len); |
982 QueryTerms::iterator query_terms_iterator = | 982 QueryTerms::iterator query_terms_iterator = |
983 query_terms->find(key_string); | 983 query_terms->find(key_string); |
984 if (query_terms_iterator != query_terms->end()) { | 984 if (query_terms_iterator != query_terms->end()) { |
985 if (!query_terms_iterator->second.empty() && | 985 if (!query_terms_iterator->second.empty() && |
986 query_terms_iterator->second != value_string) { | 986 query_terms_iterator->second != value_string) { |
987 // The term occurs in multiple places with different values. Treat | 987 // The term occurs in multiple places with different values. Treat |
988 // this as if the term doesn't occur by setting the value to an empty | 988 // this as if the term doesn't occur by setting the value to an empty |
989 // string. | 989 // string. |
990 (*query_terms)[key_string] = std::string(); | 990 (*query_terms)[key_string] = std::string(); |
991 DCHECK (valid_term_count > 0); | 991 DCHECK(valid_term_count > 0); |
992 valid_term_count--; | 992 valid_term_count--; |
993 } | 993 } |
994 } else { | 994 } else { |
995 valid_term_count++; | 995 valid_term_count++; |
996 (*query_terms)[key_string] = value_string; | 996 (*query_terms)[key_string] = value_string; |
997 } | 997 } |
998 } | 998 } |
999 } | 999 } |
1000 return (valid_term_count > 0); | 1000 return (valid_term_count > 0); |
1001 } | 1001 } |
(...skipping 10 matching lines...) Expand all Loading... |
1012 AddToMaps(t_url); | 1012 AddToMaps(t_url); |
1013 something_changed = true; | 1013 something_changed = true; |
1014 } | 1014 } |
1015 } | 1015 } |
1016 | 1016 |
1017 if (something_changed && loaded_) { | 1017 if (something_changed && loaded_) { |
1018 FOR_EACH_OBSERVER(TemplateURLModelObserver, model_observers_, | 1018 FOR_EACH_OBSERVER(TemplateURLModelObserver, model_observers_, |
1019 OnTemplateURLModelChanged()); | 1019 OnTemplateURLModelChanged()); |
1020 } | 1020 } |
1021 } | 1021 } |
OLD | NEW |