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

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

Issue 6322001: Remove wstring from TemplateURL and friends.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/util.h" 5 #include "chrome/browser/search_engines/util.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/browser_thread.h" 11 #include "chrome/browser/browser_thread.h"
13 #include "chrome/browser/search_engines/template_url.h" 12 #include "chrome/browser/search_engines/template_url.h"
14 #include "chrome/browser/search_engines/template_url_model.h" 13 #include "chrome/browser/search_engines/template_url_model.h"
15 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" 14 #include "chrome/browser/search_engines/template_url_prepopulate_data.h"
16 #include "chrome/browser/prefs/pref_service.h" 15 #include "chrome/browser/prefs/pref_service.h"
17 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
18 17
19 string16 GetDefaultSearchEngineName(Profile* profile) { 18 string16 GetDefaultSearchEngineName(Profile* profile) {
20 if (!profile) { 19 if (!profile) {
21 NOTREACHED(); 20 NOTREACHED();
22 return string16(); 21 return string16();
23 } 22 }
24 const TemplateURL* const default_provider = 23 const TemplateURL* const default_provider =
25 profile->GetTemplateURLModel()->GetDefaultSearchProvider(); 24 profile->GetTemplateURLModel()->GetDefaultSearchProvider();
26 if (!default_provider) { 25 if (!default_provider) {
27 // TODO(cpu): bug 1187517. It is possible to have no default provider. 26 // TODO(cpu): bug 1187517. It is possible to have no default provider.
28 // returning an empty string is a stopgap measure for the crash 27 // returning an empty string is a stopgap measure for the crash
29 // http://code.google.com/p/chromium/issues/detail?id=2573 28 // http://code.google.com/p/chromium/issues/detail?id=2573
30 return string16(); 29 return string16();
31 } 30 }
32 return WideToUTF16(default_provider->short_name()); 31 return default_provider->short_name();
33 } 32 }
34 33
35 // Removes (and deletes) TemplateURLs from |urls| that have duplicate 34 // Removes (and deletes) TemplateURLs from |urls| that have duplicate
36 // prepopulate ids. Duplicate prepopulate ids are not allowed, but due to a 35 // prepopulate ids. Duplicate prepopulate ids are not allowed, but due to a
37 // bug it was possible get dups. This step is only called when the version 36 // bug it was possible get dups. This step is only called when the version
38 // number changes. Only pass in a non-NULL value for |service| if the removed 37 // number changes. Only pass in a non-NULL value for |service| if the removed
39 // items should be removed from the DB. 38 // items should be removed from the DB.
40 static void RemoveDuplicatePrepopulateIDs( 39 static void RemoveDuplicatePrepopulateIDs(
41 std::vector<TemplateURL*>* template_urls, 40 std::vector<TemplateURL*>* template_urls,
42 WebDataService* service) { 41 WebDataService* service) {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 189 }
191 } 190 }
192 191
193 if (keyword_result.builtin_keyword_version != resource_keyword_version) { 192 if (keyword_result.builtin_keyword_version != resource_keyword_version) {
194 MergeEnginesFromPrepopulateData(prefs, service, template_urls, 193 MergeEnginesFromPrepopulateData(prefs, service, template_urls,
195 default_search_provider); 194 default_search_provider);
196 *new_resource_keyword_version = resource_keyword_version; 195 *new_resource_keyword_version = resource_keyword_version;
197 } 196 }
198 } 197 }
199 198
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url_unittest.cc ('k') | chrome/browser/tab_contents/render_view_context_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698