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

Unified Diff: chrome/browser/search_engines/template_url_prepopulate_data.cc

Issue 10908226: Introduces a search term extraction mechanism working for arbitrary search providers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed keyword_table_unittest Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/search_engines/template_url_prepopulate_data.cc
diff --git a/chrome/browser/search_engines/template_url_prepopulate_data.cc b/chrome/browser/search_engines/template_url_prepopulate_data.cc
index c89a3f0ba8e87bb5ef328af118b2caebba37423d..abf8072b6c3a0c840618289d81bea1c290610787 100644
--- a/chrome/browser/search_engines/template_url_prepopulate_data.cc
+++ b/chrome/browser/search_engines/template_url_prepopulate_data.cc
@@ -9,6 +9,7 @@
#endif
#include "base/command_line.h"
+#include "base/json/json_reader.h"
#include "base/logging.h"
#include "base/memory/scoped_vector.h"
#include "base/string16.h"
@@ -31,6 +32,12 @@
#include "grit/theme_resources.h"
#include "ui/base/l10n/l10n_util.h"
+// TODO(beaudoin): Cleanup
Joao da Silva 2012/09/28 11:46:10 Remove this?
beaudoin 2012/10/02 17:43:29 OOops! Sorry... Done.
+#include "base/string_split.h"
+#include "base/string_util.h"
+#include "base/stringprintf.h"
+
+
#if defined(OS_WIN)
#undef IN // On Windows, windef.h defines this, which screws up "India" cases.
#elif defined(OS_MACOSX)
@@ -54,6 +61,9 @@ struct PrepopulatedEngine {
// suggestions.
const char* const instant_url; // If NULL, this engine does not support
// instant.
+ // A JSON array containing a list of URL patterns that can be used, in
+ // addition to |search_url|, to extract search terms from a URL. Can be NULL.
+ const char* const alternate_urls;
// SEARCH_ENGINE_OTHER if there is no matching type.
const SearchEngineType type;
// Unique id for this prepopulate engine (corresponds to
@@ -97,6 +107,7 @@ const PrepopulatedEngine abcsok = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_ABCSOK,
72,
};
@@ -109,6 +120,7 @@ const PrepopulatedEngine altavista = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_ALTAVISTA,
89,
};
@@ -121,6 +133,7 @@ const PrepopulatedEngine altavista_ar = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_ALTAVISTA,
89,
};
@@ -133,6 +146,7 @@ const PrepopulatedEngine altavista_se = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_ALTAVISTA,
89,
};
@@ -145,6 +159,7 @@ const PrepopulatedEngine aol = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
35,
};
@@ -157,6 +172,7 @@ const PrepopulatedEngine araby = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
12,
};
@@ -169,6 +185,7 @@ const PrepopulatedEngine ask = {
"UTF-8",
"http://ss.ask.com/query?q={searchTerms}&li=ff",
NULL,
+ NULL,
SEARCH_ENGINE_ASK,
4,
};
@@ -181,6 +198,7 @@ const PrepopulatedEngine ask_de = {
"UTF-8",
"http://ss.de.ask.com/query?q={searchTerms}&li=ff",
NULL,
+ NULL,
SEARCH_ENGINE_ASK,
4,
};
@@ -193,6 +211,7 @@ const PrepopulatedEngine ask_es = {
"UTF-8",
"http://ss.es.ask.com/query?q={searchTerms}&li=ff",
NULL,
+ NULL,
SEARCH_ENGINE_ASK,
4,
};
@@ -205,6 +224,7 @@ const PrepopulatedEngine ask_it = {
"UTF-8",
"http://ss.it.ask.com/query?q={searchTerms}&li=ff",
NULL,
+ NULL,
SEARCH_ENGINE_ASK,
4,
};
@@ -217,6 +237,7 @@ const PrepopulatedEngine ask_nl = {
"UTF-8",
"http://ss.nl.ask.com/query?q={searchTerms}&li=ff",
NULL,
+ NULL,
SEARCH_ENGINE_ASK,
4,
};
@@ -229,6 +250,7 @@ const PrepopulatedEngine ask_uk = {
"UTF-8",
"http://ss.uk.ask.com/query?q={searchTerms}&li=ff",
NULL,
+ NULL,
SEARCH_ENGINE_ASK,
4,
};
@@ -241,6 +263,7 @@ const PrepopulatedEngine atlas_cz = {
"windows-1250",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
27,
};
@@ -253,6 +276,7 @@ const PrepopulatedEngine atlas_sk = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
27,
};
@@ -265,6 +289,7 @@ const PrepopulatedEngine baidu = {
"GB2312",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_BAIDU,
21,
};
@@ -277,6 +302,7 @@ const PrepopulatedEngine bing = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -289,6 +315,7 @@ const PrepopulatedEngine bing_ar_XA = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
7, // Can't be 3 as this has to appear in the Arabian countries' lists
// alongside bing_en_XA.
@@ -302,6 +329,7 @@ const PrepopulatedEngine bing_bg_BG = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -314,6 +342,7 @@ const PrepopulatedEngine bing_cs_CZ = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -326,6 +355,7 @@ const PrepopulatedEngine bing_da_DK = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -338,6 +368,7 @@ const PrepopulatedEngine bing_de_AT = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -350,6 +381,7 @@ const PrepopulatedEngine bing_de_CH = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -362,6 +394,7 @@ const PrepopulatedEngine bing_de_DE = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -374,6 +407,7 @@ const PrepopulatedEngine bing_el_GR = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -386,6 +420,7 @@ const PrepopulatedEngine bing_en_AU = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -398,6 +433,7 @@ const PrepopulatedEngine bing_en_CA = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -410,6 +446,7 @@ const PrepopulatedEngine bing_en_GB = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -422,6 +459,7 @@ const PrepopulatedEngine bing_en_ID = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -434,6 +472,7 @@ const PrepopulatedEngine bing_en_IE = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -446,6 +485,7 @@ const PrepopulatedEngine bing_en_IN = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -458,6 +498,7 @@ const PrepopulatedEngine bing_en_MY = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -470,6 +511,7 @@ const PrepopulatedEngine bing_en_NZ = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -482,6 +524,7 @@ const PrepopulatedEngine bing_en_PH = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -494,6 +537,7 @@ const PrepopulatedEngine bing_en_SG = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -506,6 +550,7 @@ const PrepopulatedEngine bing_en_US = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -518,6 +563,7 @@ const PrepopulatedEngine bing_en_XA = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -530,6 +576,7 @@ const PrepopulatedEngine bing_en_ZA = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -542,6 +589,7 @@ const PrepopulatedEngine bing_es_AR = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -554,6 +602,7 @@ const PrepopulatedEngine bing_es_CL = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -566,6 +615,7 @@ const PrepopulatedEngine bing_es_ES = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -578,6 +628,7 @@ const PrepopulatedEngine bing_es_MX = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -590,6 +641,7 @@ const PrepopulatedEngine bing_es_XL = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -602,6 +654,7 @@ const PrepopulatedEngine bing_et_EE = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -614,6 +667,7 @@ const PrepopulatedEngine bing_fi_FI = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -626,6 +680,7 @@ const PrepopulatedEngine bing_fr_BE = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
7,
};
@@ -638,6 +693,7 @@ const PrepopulatedEngine bing_fr_CA = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
7,
};
@@ -650,6 +706,7 @@ const PrepopulatedEngine bing_fr_CH = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
7,
};
@@ -662,6 +719,7 @@ const PrepopulatedEngine bing_fr_FR = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -674,6 +732,7 @@ const PrepopulatedEngine bing_he_IL = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -686,6 +745,7 @@ const PrepopulatedEngine bing_hr_HR = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -698,6 +758,7 @@ const PrepopulatedEngine bing_hu_HU = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -710,6 +771,7 @@ const PrepopulatedEngine bing_it_IT = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -722,6 +784,7 @@ const PrepopulatedEngine bing_ja_JP = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -734,6 +797,7 @@ const PrepopulatedEngine bing_ko_KR = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -746,6 +810,7 @@ const PrepopulatedEngine bing_lt_LT = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -758,6 +823,7 @@ const PrepopulatedEngine bing_lv_LV = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -770,6 +836,7 @@ const PrepopulatedEngine bing_nb_NO = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -782,6 +849,7 @@ const PrepopulatedEngine bing_nl_BE = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -794,6 +862,7 @@ const PrepopulatedEngine bing_nl_NL = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -806,6 +875,7 @@ const PrepopulatedEngine bing_pl_PL = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -818,6 +888,7 @@ const PrepopulatedEngine bing_pt_BR = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -830,6 +901,7 @@ const PrepopulatedEngine bing_pt_PT = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -842,6 +914,7 @@ const PrepopulatedEngine bing_ro_RO = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -854,6 +927,7 @@ const PrepopulatedEngine bing_ru_RU = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -866,6 +940,7 @@ const PrepopulatedEngine bing_sl_SI = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -878,6 +953,7 @@ const PrepopulatedEngine bing_sk_SK = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -890,6 +966,7 @@ const PrepopulatedEngine bing_sv_SE = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -902,6 +979,7 @@ const PrepopulatedEngine bing_th_TH = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -914,6 +992,7 @@ const PrepopulatedEngine bing_tr_TR = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -926,6 +1005,7 @@ const PrepopulatedEngine bing_uk_UA = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -938,6 +1018,7 @@ const PrepopulatedEngine bing_zh_CN = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -950,6 +1031,7 @@ const PrepopulatedEngine bing_zh_HK = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -962,6 +1044,7 @@ const PrepopulatedEngine bing_zh_TW = {
"UTF-8",
"http://api.bing.com/osjson.aspx?query={searchTerms}&language={language}",
NULL,
+ NULL,
SEARCH_ENGINE_BING,
3,
};
@@ -974,6 +1057,7 @@ const PrepopulatedEngine centrum_cz = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_CENTRUM,
26,
};
@@ -986,6 +1070,7 @@ const PrepopulatedEngine centrum_sk = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_CENTRUM,
26,
};
@@ -999,6 +1084,7 @@ const PrepopulatedEngine daum = {
"http://sug.search.daum.net/search_nsuggest?mod=fxjson&code=utf_in_out&"
"q={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_DAUM,
68,
};
@@ -1011,6 +1097,7 @@ const PrepopulatedEngine delfi_lt = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_DELFI,
45,
};
@@ -1023,6 +1110,7 @@ const PrepopulatedEngine delfi_lv = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_DELFI,
45,
};
@@ -1035,6 +1123,7 @@ const PrepopulatedEngine diri = {
"windows-1251",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_DIRI,
32,
};
@@ -1047,6 +1136,7 @@ const PrepopulatedEngine eniro_fi = {
"ISO-8859-1",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
29,
};
@@ -1059,6 +1149,7 @@ const PrepopulatedEngine eniro_se = {
"ISO-8859-1",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
29,
};
@@ -1071,6 +1162,7 @@ const PrepopulatedEngine fonecta_02_fi = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
46,
};
@@ -1083,6 +1175,7 @@ const PrepopulatedEngine goo = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_GOO,
23,
};
@@ -1101,6 +1194,8 @@ const PrepopulatedEngine google = {
"sugkey={google:suggestAPIKeyParameter}",
"{google:baseURL}webhp?sourceid=chrome-instant&{google:RLZ}"
"{google:instantEnabledParameter}ie={inputEncoding}",
+ "[\"{google:baseURL}#q={searchTerms}\", "
+ "\"{google:baseURL}search#q={searchTerms}\"]",
SEARCH_ENGINE_GOOGLE,
1,
};
@@ -1113,6 +1208,7 @@ const PrepopulatedEngine guruji = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
38,
};
@@ -1125,6 +1221,7 @@ const PrepopulatedEngine hispavista = {
"iso-8859-1",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
18,
};
@@ -1137,6 +1234,7 @@ const PrepopulatedEngine in = {
"ISO-8859-7",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_IN,
54,
};
@@ -1149,6 +1247,7 @@ const PrepopulatedEngine jabse = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
19,
};
@@ -1161,6 +1260,7 @@ const PrepopulatedEngine jubii = {
"ISO-8859-1",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
28,
};
@@ -1173,6 +1273,7 @@ const PrepopulatedEngine kvasir = {
"ISO-8859-1",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
73,
};
@@ -1185,6 +1286,7 @@ const PrepopulatedEngine latne = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
71,
};
@@ -1197,6 +1299,7 @@ const PrepopulatedEngine leit = {
"ISO-8859-1",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
59,
};
@@ -1209,6 +1312,7 @@ const PrepopulatedEngine libero = {
"ISO-8859-1",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
63,
};
@@ -1221,6 +1325,7 @@ const PrepopulatedEngine mail_ru = {
"windows-1251",
"http://suggests.go.mail.ru/chrome?q={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_MAILRU,
83,
};
@@ -1233,6 +1338,7 @@ const PrepopulatedEngine maktoob = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
13,
};
@@ -1245,6 +1351,7 @@ const PrepopulatedEngine masrawy = {
"windows-1256",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
14,
};
@@ -1257,6 +1364,7 @@ const PrepopulatedEngine mynet = {
"windows-1254",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
101,
};
@@ -1269,6 +1377,7 @@ const PrepopulatedEngine najdi = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_NAJDI,
87,
};
@@ -1281,6 +1390,7 @@ const PrepopulatedEngine nate = {
"EUC-KR",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
69,
};
@@ -1294,6 +1404,7 @@ const PrepopulatedEngine naver = {
"http://ac.search.naver.com/autocompl?m=s&ie={inputEncoding}&oe=utf-8&"
"q={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_NAVER,
67,
};
@@ -1306,6 +1417,7 @@ const PrepopulatedEngine neti = {
"ISO-8859-1",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_NETI,
44,
};
@@ -1318,6 +1430,7 @@ const PrepopulatedEngine netsprint = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_NETSPRINT,
30,
};
@@ -1330,6 +1443,7 @@ const PrepopulatedEngine nur_kz = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
20,
};
@@ -1342,6 +1456,7 @@ const PrepopulatedEngine ok = {
"ISO-8859-2",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OK,
6,
};
@@ -1354,6 +1469,7 @@ const PrepopulatedEngine onet = {
"ISO-8859-2",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
75,
};
@@ -1366,6 +1482,7 @@ const PrepopulatedEngine pogodak_rs = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_POGODAK,
24,
};
@@ -1378,6 +1495,7 @@ const PrepopulatedEngine rambler = {
"windows-1251",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_RAMBLER,
16,
};
@@ -1390,6 +1508,7 @@ const PrepopulatedEngine rediff = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
37,
};
@@ -1402,6 +1521,7 @@ const PrepopulatedEngine rednano = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
41,
};
@@ -1414,6 +1534,7 @@ const PrepopulatedEngine sanook = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_SANOOK,
100,
};
@@ -1426,6 +1547,7 @@ const PrepopulatedEngine sapo = {
"UTF-8",
"http://pesquisa.sapo.pt/livesapo?q={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_SAPO,
77,
};
@@ -1438,6 +1560,7 @@ const PrepopulatedEngine search_de_CH = {
"ISO-8859-1",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
51,
};
@@ -1450,6 +1573,7 @@ const PrepopulatedEngine search_fr_CH = {
"ISO-8859-1",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
22,
};
@@ -1463,6 +1587,7 @@ const PrepopulatedEngine seznam = {
"http:///suggest.fulltext.seznam.cz/?dict=fulltext_ff&phrase={searchTerms}&"
"encoding={inputEncoding}&response_encoding=utf-8",
NULL,
+ NULL,
SEARCH_ENGINE_SEZNAM,
25,
};
@@ -1475,6 +1600,7 @@ const PrepopulatedEngine terra_ar = {
"ISO-8859-1",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
90,
};
@@ -1487,6 +1613,7 @@ const PrepopulatedEngine terra_es = {
"ISO-8859-1",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
90,
};
@@ -1499,6 +1626,7 @@ const PrepopulatedEngine tut = {
"windows-1251",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_TUT,
17,
};
@@ -1511,6 +1639,7 @@ const PrepopulatedEngine uol = {
"ISO-8859-1",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
82,
};
@@ -1523,6 +1652,7 @@ const PrepopulatedEngine virgilio = {
"ISO-8859-1",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_VIRGILIO,
62,
};
@@ -1535,6 +1665,7 @@ const PrepopulatedEngine walla = {
"windows-1255",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_WALLA,
55,
};
@@ -1547,6 +1678,7 @@ const PrepopulatedEngine wp = {
"ISO-8859-2",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
76,
};
@@ -1559,6 +1691,7 @@ const PrepopulatedEngine yahoo = {
"UTF-8",
"http://ff.search.yahoo.com/gossip?output=fxjson&command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1576,6 +1709,7 @@ const PrepopulatedEngine yahoo_ar = {
"http://ar-sayt.ff.search.yahoo.com/gossip-ar-sayt?output=fxjson&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1589,6 +1723,7 @@ const PrepopulatedEngine yahoo_at = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1603,6 +1738,7 @@ const PrepopulatedEngine yahoo_au = {
"http://aue-sayt.ff.search.yahoo.com/gossip-au-sayt?output=fxjson&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1617,6 +1753,7 @@ const PrepopulatedEngine yahoo_br = {
"http://br-sayt.ff.search.yahoo.com/gossip-br-sayt?output=fxjson&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1631,6 +1768,7 @@ const PrepopulatedEngine yahoo_ca = {
"http://gossip.ca.yahoo.com/gossip-ca-sayt?output=fxjsonp&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1644,6 +1782,7 @@ const PrepopulatedEngine yahoo_ch = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1658,6 +1797,7 @@ const PrepopulatedEngine yahoo_cl = {
"http://gossip.telemundo.yahoo.com/gossip-e1-sayt?output=fxjson&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1671,6 +1811,7 @@ const PrepopulatedEngine yahoo_cn = {
"GB2312",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1685,6 +1826,7 @@ const PrepopulatedEngine yahoo_co = {
"http://gossip.telemundo.yahoo.com/gossip-e1-sayt?output=fxjson&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1699,6 +1841,7 @@ const PrepopulatedEngine yahoo_de = {
"http://de-sayt.ff.search.yahoo.com/gossip-de-sayt?output=fxjson&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1712,6 +1855,7 @@ const PrepopulatedEngine yahoo_dk = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1726,6 +1870,7 @@ const PrepopulatedEngine yahoo_es = {
"http://es-sayt.ff.search.yahoo.com/gossip-es-sayt?output=fxjson&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1739,6 +1884,7 @@ const PrepopulatedEngine yahoo_fi = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1753,6 +1899,7 @@ const PrepopulatedEngine yahoo_fr = {
"http://fr-sayt.ff.search.yahoo.com/gossip-fr-sayt?output=fxjson&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1766,6 +1913,7 @@ const PrepopulatedEngine yahoo_hk = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1780,6 +1928,7 @@ const PrepopulatedEngine yahoo_id = {
"http://id-sayt.ff.search.yahoo.com/gossip-id-sayt?output=fxjson&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1794,6 +1943,7 @@ const PrepopulatedEngine yahoo_in = {
"http://in-sayt.ff.search.yahoo.com/gossip-in-sayt?output=fxjson&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1808,6 +1958,7 @@ const PrepopulatedEngine yahoo_it = {
"http://it-sayt.ff.search.yahoo.com/gossip-it-sayt?output=fxjson&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1821,6 +1972,7 @@ const PrepopulatedEngine yahoo_jp = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_YAHOOJP,
2,
};
@@ -1835,6 +1987,7 @@ const PrepopulatedEngine yahoo_kr = {
"http://kr.atc.search.yahoo.com/atcx.php?property=main&ot=fxjson&"
"ei=utf8&eo=utf8&command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1849,6 +2002,7 @@ const PrepopulatedEngine yahoo_malaysia = {
"http://my-sayt.ff.search.yahoo.com/gossip-my-sayt?output=fxjson&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1863,6 +2017,7 @@ const PrepopulatedEngine yahoo_mx = {
"http://gossip.mx.yahoo.com/gossip-mx-sayt?output=fxjsonp&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1876,6 +2031,7 @@ const PrepopulatedEngine yahoo_nl = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1889,6 +2045,7 @@ const PrepopulatedEngine yahoo_no = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1903,6 +2060,7 @@ const PrepopulatedEngine yahoo_nz = {
"http://aue-sayt.ff.search.yahoo.com/gossip-nz-sayt?output=fxjson&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1917,6 +2075,7 @@ const PrepopulatedEngine yahoo_pe = {
"http://gossip.telemundo.yahoo.com/gossip-e1-sayt?output=fxjson&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1931,6 +2090,7 @@ const PrepopulatedEngine yahoo_ph = {
"http://ph-sayt.ff.search.yahoo.com/gossip-ph-sayt?output=fxjson&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1944,6 +2104,7 @@ const PrepopulatedEngine yahoo_qc = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_YAHOOQC,
5, // Can't be 2 as this has to appear in the Canada list alongside yahoo_ca.
};
@@ -1957,6 +2118,7 @@ const PrepopulatedEngine yahoo_ru = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1970,6 +2132,7 @@ const PrepopulatedEngine yahoo_se = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1984,6 +2147,7 @@ const PrepopulatedEngine yahoo_sg = {
"http://sg-sayt.ff.search.yahoo.com/gossip-sg-sayt?output=fxjson&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -1998,6 +2162,7 @@ const PrepopulatedEngine yahoo_th = {
"http://th-sayt.ff.search.yahoo.com/gossip-th-sayt?output=fxjson&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -2011,6 +2176,7 @@ const PrepopulatedEngine yahoo_tw = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -2025,6 +2191,7 @@ const PrepopulatedEngine yahoo_uk = {
"http://uk-sayt.ff.search.yahoo.com/gossip-uk-sayt?output=fxjson&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -2039,6 +2206,7 @@ const PrepopulatedEngine yahoo_ve = {
"http://gossip.telemundo.yahoo.com/gossip-e1-sayt?output=fxjson&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -2053,6 +2221,7 @@ const PrepopulatedEngine yahoo_vn = {
"http://vn-sayt.ff.search.yahoo.com/gossip-vn-sayt?output=fxjson&"
"command={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YAHOO,
2,
};
@@ -2065,6 +2234,7 @@ const PrepopulatedEngine yamli = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_OTHER,
11,
};
@@ -2077,6 +2247,7 @@ const PrepopulatedEngine yandex_ru = {
"UTF-8",
"http://suggest.yandex.net/suggest-ff.cgi?part={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YANDEX,
15,
};
@@ -2089,6 +2260,7 @@ const PrepopulatedEngine yandex_ua = {
"UTF-8",
"http://suggest.yandex.net/suggest-ff.cgi?part={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YANDEX,
15,
};
@@ -2101,6 +2273,7 @@ const PrepopulatedEngine zoznam = {
"windows-1250",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_ZOZNAM,
85,
};
@@ -2119,6 +2292,7 @@ const PrepopulatedEngine all_by = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_ALL_BY,
33,
};
@@ -2131,6 +2305,7 @@ const PrepopulatedEngine aport = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_APORT,
34,
};
@@ -2143,6 +2318,7 @@ const PrepopulatedEngine avg = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_AVG,
50,
};
@@ -2155,6 +2331,7 @@ const PrepopulatedEngine avg_i = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_AVG,
52,
};
@@ -2167,6 +2344,7 @@ const PrepopulatedEngine conduit = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_CONDUIT,
36,
};
@@ -2179,6 +2357,7 @@ const PrepopulatedEngine icq = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_ICQ,
39,
};
@@ -2191,6 +2370,7 @@ const PrepopulatedEngine meta_ua = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_META_UA,
40,
};
@@ -2203,6 +2383,7 @@ const PrepopulatedEngine metabot_ru = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_METABOT_RU,
42,
};
@@ -2215,6 +2396,7 @@ const PrepopulatedEngine nigma = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_NIGMA,
43,
};
@@ -2227,6 +2409,7 @@ const PrepopulatedEngine qip = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_QIP,
47,
};
@@ -2239,6 +2422,7 @@ const PrepopulatedEngine ukr_net = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_UKR_NET,
48,
};
@@ -2251,6 +2435,7 @@ const PrepopulatedEngine webalta = {
"UTF-8",
NULL,
NULL,
+ NULL,
SEARCH_ENGINE_WEBALTA,
49,
};
@@ -2263,6 +2448,7 @@ const PrepopulatedEngine yandex_tr = {
"UTF-8",
"http://suggest.yandex.net/suggest-ff.cgi?part={searchTerms}",
NULL,
+ NULL,
SEARCH_ENGINE_YANDEX,
15,
};
@@ -3329,28 +3515,40 @@ void RegisterUserPrefs(PrefService* prefs) {
int GetDataVersion(PrefService* prefs) {
// Increment this if you change the above data in ways that mean users with
// existing data should get a new version.
- const int kCurrentDataVersion = 43;
+ const int kCurrentDataVersion = 44;
// Allow tests to override the local version.
return (prefs && prefs->HasPrefPath(prefs::kSearchProviderOverridesVersion)) ?
prefs->GetInteger(prefs::kSearchProviderOverridesVersion) :
kCurrentDataVersion;
}
-TemplateURL* MakePrepopulatedTemplateURL(Profile* profile,
- const string16& name,
- const string16& keyword,
- const base::StringPiece& search_url,
- const base::StringPiece& suggest_url,
- const base::StringPiece& instant_url,
- const base::StringPiece& favicon_url,
- const base::StringPiece& encoding,
- int id) {
+TemplateURL* MakePrepopulatedTemplateURL(
+ Profile* profile,
+ const string16& name,
+ const string16& keyword,
+ const base::StringPiece& search_url,
+ const base::StringPiece& suggest_url,
+ const base::StringPiece& instant_url,
+ const ListValue& alternate_urls,
+ const base::StringPiece& favicon_url,
+ const base::StringPiece& encoding,
+ int id) {
+
TemplateURLData data;
+ std::string alternate_url;
+
data.short_name = name;
data.SetKeyword(keyword);
data.SetURL(search_url.as_string());
data.suggestions_url = suggest_url.as_string();
data.instant_url = instant_url.as_string();
+ for (size_t i = 0; i < alternate_urls.GetSize(); ++i) {
+ if (alternate_urls.GetString(i, &alternate_url)) {
+ data.alternate_urls.push_back(alternate_url);
+ } else {
+ LOG(ERROR) << "Invalid alternate url, expected a string.";
+ }
+ }
data.favicon_url = GURL(favicon_url.as_string());
data.show_in_default_list = true;
data.safe_for_autoreplace = true;
@@ -3376,6 +3574,7 @@ void GetPrepopulatedTemplateFromPrefs(Profile* profile,
std::string search_url;
std::string suggest_url;
std::string instant_url;
+ const ListValue* alternate_urls;
std::string favicon_url;
std::string encoding;
int id;
@@ -3389,6 +3588,7 @@ void GetPrepopulatedTemplateFromPrefs(Profile* profile,
engine->GetString("search_url", &search_url) &&
engine->GetString("suggest_url", &suggest_url) &&
engine->GetString("instant_url", &instant_url) &&
+ engine->GetList("alternate_urls", &alternate_urls) &&
engine->GetString("favicon_url", &favicon_url) &&
engine->GetString("encoding", &encoding) &&
engine->GetInteger("id", &id)) {
@@ -3401,7 +3601,8 @@ void GetPrepopulatedTemplateFromPrefs(Profile* profile,
continue;
}
t_urls->push_back(MakePrepopulatedTemplateURL(profile, name, keyword,
- search_url, suggest_url, instant_url, favicon_url, encoding, id));
+ search_url, suggest_url, instant_url, *alternate_urls, favicon_url,
+ encoding, id));
}
}
@@ -3409,9 +3610,27 @@ void GetPrepopulatedTemplateFromPrefs(Profile* profile,
TemplateURL* MakePrepopulatedTemplateURLFromPrepopulateEngine(
Profile* profile,
const PrepopulatedEngine& engine) {
+
+ ListValue* alternate_urls = NULL;
dhollowa 2012/09/28 18:06:29 nit: How about initializing to |&empty_list| here
beaudoin 2012/10/02 17:43:29 Good catch! I thought "value->GetAsList(&alternate
+ // Will hold the result of |ReadToValue|, which we own.
+ scoped_ptr<Value> value;
+ if (engine.alternate_urls) {
+ base::JSONReader json_reader;
+ value.reset(json_reader.ReadToValue(std::string(engine.alternate_urls)));
+ if (value.get())
+ value->GetAsList(&alternate_urls);
+ if (!alternate_urls)
+ LOG(ERROR) << "Cannot parse alternate_urls as JSON list.";
+ }
+ // Use an empty list if there are no alternate_urls.
+ ListValue empty_list;
+ if (!alternate_urls)
+ alternate_urls = &empty_list;
+
return MakePrepopulatedTemplateURL(profile, WideToUTF16(engine.name),
WideToUTF16(engine.keyword), engine.search_url, engine.suggest_url,
- engine.instant_url, engine.favicon_url, engine.encoding, engine.id);
+ engine.instant_url, *alternate_urls,
+ engine.favicon_url, engine.encoding, engine.id);
}
void GetPrepopulatedEngines(Profile* profile,

Powered by Google App Engine
This is Rietveld 408576698