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_prepopulate_data.h" | 5 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
6 | 6 |
7 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 7 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
8 #include <locale.h> | 8 #include <locale.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1190 engine->GetList("alternate_urls", &alternate_urls); | 1190 engine->GetList("alternate_urls", &alternate_urls); |
1191 engine->GetString("search_terms_replacement_key", | 1191 engine->GetString("search_terms_replacement_key", |
1192 &search_terms_replacement_key); | 1192 &search_terms_replacement_key); |
1193 t_urls->push_back(MakePrepopulatedTemplateURL(profile, name, keyword, | 1193 t_urls->push_back(MakePrepopulatedTemplateURL(profile, name, keyword, |
1194 search_url, suggest_url, instant_url, favicon_url, encoding, | 1194 search_url, suggest_url, instant_url, favicon_url, encoding, |
1195 *alternate_urls, search_terms_replacement_key, id)); | 1195 *alternate_urls, search_terms_replacement_key, id)); |
1196 } | 1196 } |
1197 } | 1197 } |
1198 } | 1198 } |
1199 | 1199 |
1200 void ClearPrepopulatedEnginesInPrefs(Profile* profile) { | |
1201 if (!profile) | |
1202 return; | |
1203 | |
1204 PrefService* prefs = profile->GetPrefs(); | |
1205 DCHECK(prefs); | |
1206 prefs->ClearPref(prefs::kSearchProviderOverrides); | |
1207 prefs->ClearPref(prefs::kSearchProviderOverridesVersion); | |
Peter Kasting
2013/05/22 21:22:57
These prefs are supposed to only be set by tests a
Joao da Silva
2013/05/23 08:54:10
As Peter mentioned, these prefs can only come from
Joao da Silva
2013/05/23 09:12:51
I wasn't looking at this from the malware preventi
vasilii
2013/05/23 17:03:42
The purpose of this feature is to recover Chrome a
| |
1208 } | |
1209 | |
1200 // The caller owns the returned TemplateURL. | 1210 // The caller owns the returned TemplateURL. |
1201 TemplateURL* MakePrepopulatedTemplateURLFromPrepopulateEngine( | 1211 TemplateURL* MakePrepopulatedTemplateURLFromPrepopulateEngine( |
1202 Profile* profile, | 1212 Profile* profile, |
1203 const PrepopulatedEngine& engine) { | 1213 const PrepopulatedEngine& engine) { |
1204 | 1214 |
1205 ListValue alternate_urls; | 1215 ListValue alternate_urls; |
1206 if (engine.alternate_urls) { | 1216 if (engine.alternate_urls) { |
1207 for (size_t i = 0; i < engine.alternate_urls_size; ++i) | 1217 for (size_t i = 0; i < engine.alternate_urls_size; ++i) |
1208 alternate_urls.AppendString(std::string(engine.alternate_urls[i])); | 1218 alternate_urls.AppendString(std::string(engine.alternate_urls[i])); |
1209 } | 1219 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1291 GURL GetLogoURL(const TemplateURL& template_url, LogoSize size) { | 1301 GURL GetLogoURL(const TemplateURL& template_url, LogoSize size) { |
1292 if (GetEngineType(template_url.url()) == SEARCH_ENGINE_GOOGLE) { | 1302 if (GetEngineType(template_url.url()) == SEARCH_ENGINE_GOOGLE) { |
1293 return GURL((size == LOGO_200_PERCENT) ? | 1303 return GURL((size == LOGO_200_PERCENT) ? |
1294 google_logos.logo_200_percent_url : | 1304 google_logos.logo_200_percent_url : |
1295 google_logos.logo_100_percent_url); | 1305 google_logos.logo_100_percent_url); |
1296 } | 1306 } |
1297 return GURL(); | 1307 return GURL(); |
1298 } | 1308 } |
1299 | 1309 |
1300 } // namespace TemplateURLPrepopulateData | 1310 } // namespace TemplateURLPrepopulateData |
OLD | NEW |