OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_service.h" | 5 #include "chrome/browser/search_engines/template_url_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 } | 210 } |
211 | 211 |
212 // Log the number of instances of a keyword that exist, with zero or more | 212 // Log the number of instances of a keyword that exist, with zero or more |
213 // underscores, which could occur as the result of conflict resolution. | 213 // underscores, which could occur as the result of conflict resolution. |
214 void LogDuplicatesHistogram( | 214 void LogDuplicatesHistogram( |
215 const TemplateURLService::TemplateURLVector& template_urls) { | 215 const TemplateURLService::TemplateURLVector& template_urls) { |
216 std::map<std::string, int> duplicates; | 216 std::map<std::string, int> duplicates; |
217 for (TemplateURLService::TemplateURLVector::const_iterator it = | 217 for (TemplateURLService::TemplateURLVector::const_iterator it = |
218 template_urls.begin(); it != template_urls.end(); ++it) { | 218 template_urls.begin(); it != template_urls.end(); ++it) { |
219 std::string keyword = UTF16ToASCII((*it)->keyword()); | 219 std::string keyword = UTF16ToASCII((*it)->keyword()); |
220 TrimString(keyword, "_", &keyword); | 220 base::TrimString(keyword, "_", &keyword); |
221 duplicates[keyword]++; | 221 duplicates[keyword]++; |
222 } | 222 } |
223 | 223 |
224 // Count the keywords with duplicates. | 224 // Count the keywords with duplicates. |
225 int num_dupes = 0; | 225 int num_dupes = 0; |
226 for (std::map<std::string, int>::const_iterator it = duplicates.begin(); | 226 for (std::map<std::string, int>::const_iterator it = duplicates.begin(); |
227 it != duplicates.end(); ++it) { | 227 it != duplicates.end(); ++it) { |
228 if (it->second > 1) | 228 if (it->second > 1) |
229 num_dupes++; | 229 num_dupes++; |
230 } | 230 } |
(...skipping 2504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2735 new_dse = *i; | 2735 new_dse = *i; |
2736 break; | 2736 break; |
2737 } | 2737 } |
2738 } | 2738 } |
2739 } | 2739 } |
2740 } | 2740 } |
2741 if (!new_dse) | 2741 if (!new_dse) |
2742 new_dse = FindNewDefaultSearchProvider(); | 2742 new_dse = FindNewDefaultSearchProvider(); |
2743 SetDefaultSearchProviderNoNotify(new_dse); | 2743 SetDefaultSearchProviderNoNotify(new_dse); |
2744 } | 2744 } |
OLD | NEW |