Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: chrome/browser/search_engines/template_url_service.cc

Issue 176843022: Move UTF16ToASCII, remove WideToASCII. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 return !!sync_data.count(turl->sync_guid()); 209 return !!sync_data.count(turl->sync_guid());
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 = base::UTF16ToASCII((*it)->keyword());
220 base::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++;
(...skipping 2502 matching lines...) Expand 10 before | Expand all | Expand 10 after
2732 new_dse = *i; 2732 new_dse = *i;
2733 break; 2733 break;
2734 } 2734 }
2735 } 2735 }
2736 } 2736 }
2737 } 2737 }
2738 if (!new_dse) 2738 if (!new_dse)
2739 new_dse = FindNewDefaultSearchProvider(); 2739 new_dse = FindNewDefaultSearchProvider();
2740 SetDefaultSearchProviderNoNotify(new_dse); 2740 SetDefaultSearchProviderNoNotify(new_dse);
2741 } 2741 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url_parser.cc ('k') | chrome/browser/sync/test/integration/search_engines_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698