From: csagan5 <32685696+csagan5@users.noreply.github.com> 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_engine_choice/default_favicon.png | Bin 0 -> 903 bytes .../search_engine_choice_scaled_resources.grdp | 1 + .../search_engine_choice_utils.cc | 5 +---- .../search_engines/search_engine_countries-inc.cc | 3 +++ components/search_engines/search_engine_type.h | 5 +++++ .../template_url_prepopulate_data.cc | 1 - .../template_url_prepopulate_data.h | 7 ------- 7 files changed, 10 insertions(+), 12 deletions(-) create mode 100644 components/resources/default_100_percent/search_engine_choice/default_favicon.png diff --git a/components/resources/default_100_percent/search_engine_choice/default_favicon.png b/components/resources/default_100_percent/search_engine_choice/default_favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..6533419f2d6b40f7735054dec62c51ddf1ee1201 GIT binary patch literal 903 zcmV;219<$2P)u5dJaD%uTpU6K1Ny)MmAo?2~ki?Li;rI(@haGcz+YGo$8ZtH|rstmUBf-W*z< z`LqMyjQ;vbR=naxn4FxTa$SOo%Y^Yq3CiCp`IM5k@HhA$JOj`EJVrBqK*>90G)Ly==Qj#^Pm*zg`6NIm=nm~RX-}Ss_k_usva+)JncnmH^XI=4jNih$ zlz0y|WF4^Se4bG8m@v`L_#mWg6DB6I3T(&-XFfHecpOCzcg zpNwb+@DsmO2`6iI0DN;)MGkB;0q{--kR#0r9={VIfOiJ&qgPlcQV0O=qNN%EZUkK2 zXVWfZ`h5{40I)Gg`DG2UD`5mlRG3V0I)IO z^!VFvHvp@&1;F!4TUc56LN z%3gt$n(-Z(idK@zIi#qli66~IxloAGzuNPP+NSLfTs{_pT7f^J06kI9KUZ>A$&#d( z+ZUd3gy@cNAuWhQ3vePzWtVK-4H5_iqgo-eCg3jF08o2( zV+xr@B`n6nQmpYnUx3CSsDwu5Yyvoe1poxnZ<>do)Aj_?EW-9wQ^cQO=(N_*SpEcF zA!n{N_=ZMrDQ)uj`{u@re$c++TFQW?-c&%TJej=5G2dk zc*-y0$13Q-mVE%=HZZcm54P~5#qa<$Vkc|B{qUnjjUSTzPpE5qa;Lv>bM_w_-mwYy_S=Aoxnl--Y d#;kFnu^?NN9uE_uZ002ovPDHLkV1m60sc!%P literal 0 HcmV?d00001 diff --git a/components/resources/search_engine_choice_scaled_resources.grdp b/components/resources/search_engine_choice_scaled_resources.grdp --- a/components/resources/search_engine_choice_scaled_resources.grdp +++ b/components/resources/search_engine_choice_scaled_resources.grdp @@ -5,6 +5,7 @@ + diff --git a/components/search_engines/search_engine_choice/search_engine_choice_utils.cc b/components/search_engines/search_engine_choice/search_engine_choice_utils.cc --- a/components/search_engines/search_engine_choice/search_engine_choice_utils.cc +++ b/components/search_engines/search_engine_choice/search_engine_choice_utils.cc @@ -182,10 +182,7 @@ void RecordChoiceScreenDefaultSearchProviderType( } void RecordChoiceScreenSelectedIndex(int selected_engine_index) { - base::UmaHistogramExactLinear( - kSearchEngineChoiceScreenSelectedEngineIndexHistogram, - selected_engine_index, - TemplateURLPrepopulateData::kMaxEeaPrepopulatedEngines); + // do nothing in Cromite } void RecordChoiceScreenPositionsCountryMismatch(bool has_mismatch) { diff --git a/components/search_engines/search_engine_countries-inc.cc b/components/search_engines/search_engine_countries-inc.cc --- a/components/search_engines/search_engine_countries-inc.cc +++ b/components/search_engines/search_engine_countries-inc.cc @@ -38,6 +38,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}, @@ -1452,5 +1453,7 @@ const std::vector 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; } 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 @@ -91,10 +91,15 @@ enum SearchEngineType { SEARCH_ENGINE_YOU = 72, SEARCH_ENGINE_STARTER_PACK_GEMINI = 73, SEARCH_ENGINE_LILO = 74, + SEARCH_ENGINE_GOOGLE_EN = 75, + SEARCH_ENGINE_DUCKDUCKGOLIGHT = 76, 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 @@ -78,7 +78,6 @@ GetPrepopulatedEnginesForEeaRegionCountries(int country_id, generator.seed(profile_seed); std::shuffle(t_urls.begin(), t_urls.end(), generator); - CHECK_LE(t_urls.size(), kMaxEeaPrepopulatedEngines); return t_urls; } diff --git a/components/search_engines/template_url_prepopulate_data.h b/components/search_engines/template_url_prepopulate_data.h --- a/components/search_engines/template_url_prepopulate_data.h +++ b/components/search_engines/template_url_prepopulate_data.h @@ -32,13 +32,6 @@ struct PrepopulatedEngine; extern const int kMaxPrepopulatedEngineID; -// The maximum number of prepopulated search engines that can be returned in -// any of the EEA countries by `GetPrepopulatedEngines()`. -// -// Note: If this is increased, please also increase the declared variant count -// for the `Search.ChoiceScreenShowedEngineAt.Index{Index}` histogram. -inline constexpr size_t kMaxEeaPrepopulatedEngines = 8; - // The maximum number of prepopulated search engines that can be returned in // in the rest of the world by `GetPrepopulatedEngines()`. inline constexpr size_t kMaxRowPrepopulatedEngines = 5; --