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 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1203 for (size_t i = 0; i < engine.alternate_urls_size; ++i) | 1203 for (size_t i = 0; i < engine.alternate_urls_size; ++i) |
1204 alternate_urls.AppendString(std::string(engine.alternate_urls[i])); | 1204 alternate_urls.AppendString(std::string(engine.alternate_urls[i])); |
1205 } | 1205 } |
1206 | 1206 |
1207 return MakePrepopulatedTemplateURL(profile, WideToUTF16(engine.name), | 1207 return MakePrepopulatedTemplateURL(profile, WideToUTF16(engine.name), |
1208 WideToUTF16(engine.keyword), engine.search_url, engine.suggest_url, | 1208 WideToUTF16(engine.keyword), engine.search_url, engine.suggest_url, |
1209 engine.instant_url, engine.favicon_url, engine.encoding, alternate_urls, | 1209 engine.instant_url, engine.favicon_url, engine.encoding, alternate_urls, |
1210 engine.search_terms_replacement_key, engine.id); | 1210 engine.search_terms_replacement_key, engine.id); |
1211 } | 1211 } |
1212 | 1212 |
1213 TemplateURL* MakeTemplateURLFromPrepopulateId(Profile* profile, | |
1214 int prepopulate_id) { | |
1215 const PrepopulatedEngine* engine = | |
1216 GetPrepopulatedEngineFromID(prepopulate_id); | |
1217 if (engine == NULL) | |
Peter Kasting
2013/01/30 22:32:33
Nit: Or:
return engine ? MakePrepopulatedTemplate
beaudoin
2013/02/01 21:12:38
Function gone.
| |
1218 return NULL; | |
1219 return MakePrepopulatedTemplateURLFromPrepopulateEngine(profile, *engine); | |
1220 } | |
1221 | |
1213 void GetPrepopulatedEngines(Profile* profile, | 1222 void GetPrepopulatedEngines(Profile* profile, |
1214 std::vector<TemplateURL*>* t_urls, | 1223 std::vector<TemplateURL*>* t_urls, |
1215 size_t* default_search_provider_index) { | 1224 size_t* default_search_provider_index) { |
1216 // If there is a set of search engines in the preferences file, it overrides | 1225 // If there is a set of search engines in the preferences file, it overrides |
1217 // the built-in set. | 1226 // the built-in set. |
1218 *default_search_provider_index = 0; | 1227 *default_search_provider_index = 0; |
1219 GetPrepopulatedTemplateFromPrefs(profile, t_urls); | 1228 GetPrepopulatedTemplateFromPrefs(profile, t_urls); |
1220 if (!t_urls->empty()) | 1229 if (!t_urls->empty()) |
1221 return; | 1230 return; |
1222 | 1231 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1287 GURL GetLogoURL(const TemplateURL& template_url, LogoSize size) { | 1296 GURL GetLogoURL(const TemplateURL& template_url, LogoSize size) { |
1288 if (GetEngineType(template_url.url()) == SEARCH_ENGINE_GOOGLE) { | 1297 if (GetEngineType(template_url.url()) == SEARCH_ENGINE_GOOGLE) { |
1289 return GURL((size == LOGO_200_PERCENT) ? | 1298 return GURL((size == LOGO_200_PERCENT) ? |
1290 google_logos.logo_200_percent_url : | 1299 google_logos.logo_200_percent_url : |
1291 google_logos.logo_100_percent_url); | 1300 google_logos.logo_100_percent_url); |
1292 } | 1301 } |
1293 return GURL(); | 1302 return GURL(); |
1294 } | 1303 } |
1295 | 1304 |
1296 } // namespace TemplateURLPrepopulateData | 1305 } // namespace TemplateURLPrepopulateData |
OLD | NEW |