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 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 L"{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}" | 1102 L"{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}" |
1103 L"{google:originalQueryForSuggestion}{google:searchFieldtrialParameter}" | 1103 L"{google:originalQueryForSuggestion}{google:searchFieldtrialParameter}" |
1104 L"{google:instantFieldTrialGroupParameter}" | 1104 L"{google:instantFieldTrialGroupParameter}" |
1105 L"sourceid=chrome&ie={inputEncoding}&q={searchTerms}", | 1105 L"sourceid=chrome&ie={inputEncoding}&q={searchTerms}", |
1106 "UTF-8", | 1106 "UTF-8", |
1107 L"{google:baseSuggestURL}search?{google:searchFieldtrialParameter}" | 1107 L"{google:baseSuggestURL}search?{google:searchFieldtrialParameter}" |
1108 L"{google:instantFieldTrialGroupParameter}" | 1108 L"{google:instantFieldTrialGroupParameter}" |
1109 L"client=chrome&hl={language}&q={searchTerms}", | 1109 L"client=chrome&hl={language}&q={searchTerms}", |
1110 L"{google:baseURL}webhp?{google:RLZ}sourceid=chrome-instant&" | 1110 L"{google:baseURL}webhp?{google:RLZ}sourceid=chrome-instant&" |
1111 L"{google:instantFieldTrialGroupParameter}" | 1111 L"{google:instantFieldTrialGroupParameter}" |
1112 L"ie={inputEncoding}&ion=1{searchTerms}", | 1112 L"ie={inputEncoding}{google:instantEnabledParameter}{searchTerms}", |
1113 SEARCH_ENGINE_GOOGLE, | 1113 SEARCH_ENGINE_GOOGLE, |
1114 1, | 1114 1, |
1115 }; | 1115 }; |
1116 | 1116 |
1117 const PrepopulatedEngine guruji = { | 1117 const PrepopulatedEngine guruji = { |
1118 L"guruji", | 1118 L"guruji", |
1119 L"guruji.com", | 1119 L"guruji.com", |
1120 "http://guruji.com/favicon.ico", | 1120 "http://guruji.com/favicon.ico", |
1121 L"http://guruji.com/search?q={searchTerms}", | 1121 L"http://guruji.com/search?q={searchTerms}", |
1122 "UTF-8", | 1122 "UTF-8", |
(...skipping 2042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3165 PrefService::UNSYNCABLE_PREF); | 3165 PrefService::UNSYNCABLE_PREF); |
3166 // Obsolete pref, for migration. | 3166 // Obsolete pref, for migration. |
3167 prefs->RegisterIntegerPref(prefs::kGeoIDAtInstall, | 3167 prefs->RegisterIntegerPref(prefs::kGeoIDAtInstall, |
3168 -1, | 3168 -1, |
3169 PrefService::UNSYNCABLE_PREF); | 3169 PrefService::UNSYNCABLE_PREF); |
3170 } | 3170 } |
3171 | 3171 |
3172 int GetDataVersion(PrefService* prefs) { | 3172 int GetDataVersion(PrefService* prefs) { |
3173 // Increment this if you change the above data in ways that mean users with | 3173 // Increment this if you change the above data in ways that mean users with |
3174 // existing data should get a new version. | 3174 // existing data should get a new version. |
3175 const int kCurrentDataVersion = 37; | 3175 const int kCurrentDataVersion = 38; |
3176 if (!prefs) | 3176 if (!prefs) |
3177 return kCurrentDataVersion; | 3177 return kCurrentDataVersion; |
3178 // If a version number exist in the preferences file, it overrides the | 3178 // If a version number exist in the preferences file, it overrides the |
3179 // version of the built-in data. | 3179 // version of the built-in data. |
3180 int version = | 3180 int version = |
3181 prefs->GetInteger(prefs::kSearchProviderOverridesVersion); | 3181 prefs->GetInteger(prefs::kSearchProviderOverridesVersion); |
3182 return (version >= 0) ? version : kCurrentDataVersion; | 3182 return (version >= 0) ? version : kCurrentDataVersion; |
3183 } | 3183 } |
3184 | 3184 |
3185 TemplateURL* MakePrepopulatedTemplateURL(const wchar_t* name, | 3185 TemplateURL* MakePrepopulatedTemplateURL(const wchar_t* name, |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3379 TemplateURL* FindPrepopulatedEngine(const std::string& search_url) { | 3379 TemplateURL* FindPrepopulatedEngine(const std::string& search_url) { |
3380 GURL search_origin(GetOriginForSearchURL(search_url)); | 3380 GURL search_origin(GetOriginForSearchURL(search_url)); |
3381 // First check if it is a Google URL. User may have a custom search provider | 3381 // First check if it is a Google URL. User may have a custom search provider |
3382 // with a hard-coded Google domain instead of {google:baseURL}. | 3382 // with a hard-coded Google domain instead of {google:baseURL}. |
3383 if (google_util::IsGoogleHomePageUrl((search_origin.spec()))) | 3383 if (google_util::IsGoogleHomePageUrl((search_origin.spec()))) |
3384 return MakePrepopulateTemplateURLFromPrepopulateEngine(google); | 3384 return MakePrepopulateTemplateURLFromPrepopulateEngine(google); |
3385 return GetEngineForOrigin(NULL, search_origin); | 3385 return GetEngineForOrigin(NULL, search_origin); |
3386 } | 3386 } |
3387 | 3387 |
3388 } // namespace TemplateURLPrepopulateData | 3388 } // namespace TemplateURLPrepopulateData |
OLD | NEW |