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 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
| 14 #include "base/stl_util.h" |
14 #include "base/string16.h" | 15 #include "base/string16.h" |
15 #include "base/string_piece.h" | 16 #include "base/string_piece.h" |
16 #include "base/string_util.h" | 17 #include "base/string_util.h" |
17 #include "base/stl_util.h" | |
18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
19 #include "chrome/browser/google/google_util.h" | 19 #include "chrome/browser/google/google_util.h" |
| 20 #include "chrome/browser/prefs/pref_registry_syncable.h" |
20 #include "chrome/browser/prefs/pref_service.h" | 21 #include "chrome/browser/prefs/pref_service.h" |
21 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/search_engines/prepopulated_engines.h" | 23 #include "chrome/browser/search_engines/prepopulated_engines.h" |
23 #include "chrome/browser/search_engines/search_engine_type.h" | 24 #include "chrome/browser/search_engines/search_engine_type.h" |
24 #include "chrome/browser/search_engines/search_terms_data.h" | 25 #include "chrome/browser/search_engines/search_terms_data.h" |
25 #include "chrome/browser/search_engines/template_url.h" | 26 #include "chrome/browser/search_engines/template_url.h" |
26 #include "chrome/browser/search_engines/template_url_service.h" | 27 #include "chrome/browser/search_engines/template_url_service.h" |
27 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
28 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
29 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 }; | 1082 }; |
1082 | 1083 |
1083 const LogoURLs google_logos = { | 1084 const LogoURLs google_logos = { |
1084 "https://www.google.com/images/chrome_search/google_logo.png", | 1085 "https://www.google.com/images/chrome_search/google_logo.png", |
1085 "https://www.google.com/images/chrome_search/google_logo_2x.png", | 1086 "https://www.google.com/images/chrome_search/google_logo_2x.png", |
1086 }; | 1087 }; |
1087 | 1088 |
1088 | 1089 |
1089 //////////////////////////////////////////////////////////////////////////////// | 1090 //////////////////////////////////////////////////////////////////////////////// |
1090 | 1091 |
1091 void RegisterUserPrefs(PrefServiceSyncable* prefs) { | 1092 void RegisterUserPrefs(PrefRegistrySyncable* registry) { |
1092 prefs->RegisterIntegerPref(prefs::kCountryIDAtInstall, | 1093 registry->RegisterIntegerPref(prefs::kCountryIDAtInstall, |
1093 kCountryIDUnknown, | 1094 kCountryIDUnknown, |
1094 PrefServiceSyncable::UNSYNCABLE_PREF); | 1095 PrefRegistrySyncable::UNSYNCABLE_PREF); |
1095 prefs->RegisterListPref(prefs::kSearchProviderOverrides, | 1096 registry->RegisterListPref(prefs::kSearchProviderOverrides, |
1096 PrefServiceSyncable::UNSYNCABLE_PREF); | 1097 PrefRegistrySyncable::UNSYNCABLE_PREF); |
1097 prefs->RegisterIntegerPref(prefs::kSearchProviderOverridesVersion, | 1098 registry->RegisterIntegerPref(prefs::kSearchProviderOverridesVersion, |
1098 -1, | 1099 -1, |
1099 PrefServiceSyncable::UNSYNCABLE_PREF); | 1100 PrefRegistrySyncable::UNSYNCABLE_PREF); |
1100 // Obsolete pref, for migration. | 1101 // Obsolete pref, for migration. |
1101 prefs->RegisterIntegerPref(prefs::kGeoIDAtInstall, | 1102 registry->RegisterIntegerPref(prefs::kGeoIDAtInstall, |
1102 -1, | 1103 -1, |
1103 PrefServiceSyncable::UNSYNCABLE_PREF); | 1104 PrefRegistrySyncable::UNSYNCABLE_PREF); |
1104 } | 1105 } |
1105 | 1106 |
1106 int GetDataVersion(PrefService* prefs) { | 1107 int GetDataVersion(PrefService* prefs) { |
1107 // Allow tests to override the local version. | 1108 // Allow tests to override the local version. |
1108 return (prefs && prefs->HasPrefPath(prefs::kSearchProviderOverridesVersion)) ? | 1109 return (prefs && prefs->HasPrefPath(prefs::kSearchProviderOverridesVersion)) ? |
1109 prefs->GetInteger(prefs::kSearchProviderOverridesVersion) : | 1110 prefs->GetInteger(prefs::kSearchProviderOverridesVersion) : |
1110 kCurrentDataVersion; | 1111 kCurrentDataVersion; |
1111 } | 1112 } |
1112 | 1113 |
1113 TemplateURL* MakePrepopulatedTemplateURL( | 1114 TemplateURL* MakePrepopulatedTemplateURL( |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 GURL GetLogoURL(const TemplateURL& template_url, LogoSize size) { | 1288 GURL GetLogoURL(const TemplateURL& template_url, LogoSize size) { |
1288 if (GetEngineType(template_url.url()) == SEARCH_ENGINE_GOOGLE) { | 1289 if (GetEngineType(template_url.url()) == SEARCH_ENGINE_GOOGLE) { |
1289 return GURL((size == LOGO_200_PERCENT) ? | 1290 return GURL((size == LOGO_200_PERCENT) ? |
1290 google_logos.logo_200_percent_url : | 1291 google_logos.logo_200_percent_url : |
1291 google_logos.logo_100_percent_url); | 1292 google_logos.logo_100_percent_url); |
1292 } | 1293 } |
1293 return GURL(); | 1294 return GURL(); |
1294 } | 1295 } |
1295 | 1296 |
1296 } // namespace TemplateURLPrepopulateData | 1297 } // namespace TemplateURLPrepopulateData |
OLD | NEW |