forked from uazo/cromite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdd-search-engine.patch
103 lines (94 loc) · 4.37 KB
/
Add-search-engine.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
From: csagan5 <[email protected]>
Date: Mon, 11 Dec 2017 22:42:11 +0100
Subject: Add search engine
Add a Google search engine that forces languages to English,
disable from all its searches RLZ and field experiments querystring parameters.
Add DuckDuckGo Lite
License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html
---
.../search_engines/prepopulated_engines.json | 31 +++++++++++++++++++
.../search_engines/search_engine_type.h | 5 +++
.../template_url_prepopulate_data.cc | 3 ++
3 files changed, 39 insertions(+)
diff --git a/components/search_engines/prepopulated_engines.json b/components/search_engines/prepopulated_engines.json
--- a/components/search_engines/prepopulated_engines.json
+++ b/components/search_engines/prepopulated_engines.json
@@ -113,6 +113,16 @@
"id": 92
},
+ "duckduckgo_light": {
+ "name": "DuckDuckGo Light",
+ "keyword": "duckduckgo.com/lite",
+ "favicon_url": "https://duckduckgo.com/favicon.ico",
+ "search_url": "https://duckduckgo.com/lite/?q={searchTerms}",
+ "suggest_url": "https://duckduckgo.com/ac/?q={searchTerms}&type=list",
+ "type": "SEARCH_ENGINE_DUCKDUCKGOLIGHT",
+ "id": 12
+ },
+
"ecosia": {
"name": "Ecosia",
"keyword": "ecosia.org",
@@ -171,6 +181,27 @@
"id": 111
},
+ "googleen": {
+ "name": "Google in English",
+ "keyword": "googleen",
+ "favicon_url": "https://www.google.com/favicon.ico",
+ "search_url": "{google:baseURL}search?q={searchTerms}&ie={inputEncoding}&hl=en",
+ "suggest_url": "{google:baseSuggestURL}search?client={google:suggestClient}&q={searchTerms}&hl=en",
+ "image_url": "{google:baseURL}searchbyimage/upload?hl=en",
+ "new_tab_url": "{google:baseURL}_/chrome/newtab?hl=en&ie={inputEncoding}",
+ "contextual_search_url": "{google:baseURL}_/contextualsearch?{google:contextualSearchVersion}{google:contextualSearchContextData}&hl=en",
+ "image_url_post_params": "encoded_image={google:imageThumbnail},image_url={google:imageURL},sbisrc={google:imageSearchSource},original_width={google:imageOriginalWidth},original_height={google:imageOriginalHeight}",
+ "alternate_urls": [
+ "{google:baseURL}?hl=en#q={searchTerms}",
+ "{google:baseURL}search?hl=en#q={searchTerms}",
+ "{google:baseURL}webhp?hl=en#q={searchTerms}",
+ "{google:baseURL}s?hl=en#q={searchTerms}",
+ "{google:baseURL}s?hl=en&q={searchTerms}"
+ ],
+ "type": "SEARCH_ENGINE_GOOGLE_EN",
+ "id": 13
+ },
+
"mail_ru": {
"name": "@MAIL.RU",
"keyword": "mail.ru",
diff --git a/components/search_engines/search_engine_type.h b/components/search_engines/search_engine_type.h
--- a/components/search_engines/search_engine_type.h
+++ b/components/search_engines/search_engine_type.h
@@ -90,10 +90,15 @@ enum SearchEngineType {
SEARCH_ENGINE_KARMA = 71,
SEARCH_ENGINE_YOU = 72,
SEARCH_ENGINE_STARTER_PACK_ASK_GOOGLE = 73,
+ SEARCH_ENGINE_GOOGLE_EN = 74,
+ SEARCH_ENGINE_DUCKDUCKGOLIGHT = 75,
SEARCH_ENGINE_MAX // Bounding value needed for UMA histogram macro.
};
+static_assert(SEARCH_ENGINE_DUCKDUCKGOLIGHT == (SEARCH_ENGINE_MAX - 1),
+ "Please check this patch");
+
// Enum to record the type of search engine a user used in keyword mode. This
// should be kept aligned with the `OmniboxBuiltinEngineType` enum in enums.xml.
// Entries should not be renumbered and numeric values should never be reused.
diff --git a/components/search_engines/template_url_prepopulate_data.cc b/components/search_engines/template_url_prepopulate_data.cc
--- a/components/search_engines/template_url_prepopulate_data.cc
+++ b/components/search_engines/template_url_prepopulate_data.cc
@@ -63,6 +63,7 @@ struct EngineAndTier {
// Default (for countries with no better engine set)
constexpr EngineAndTier engines_default[] = {
+ {SearchEngineTier::kTopEngines, &googleen},
{SearchEngineTier::kTopEngines, &google},
{SearchEngineTier::kTopEngines, &bing},
{SearchEngineTier::kTopEngines, &yahoo},
@@ -1683,6 +1684,8 @@ const std::vector<EngineAndTier> GetPrepopulationSetFromCountryID(
for (size_t i = 0; i < num_engines; i++) {
t_url.push_back(engines[i]);
}
+ t_url.push_back({SearchEngineTier::kTopEngines, &googleen});
+ t_url.push_back({SearchEngineTier::kTopEngines, &duckduckgo_light});
return t_url;
}
--