Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash on first startup in EEA #1369

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 49 additions & 2 deletions build/patches/Add-search-engine.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ 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_engines/prepopulated_engines.json | 31 ++++++++++++++++++
.../search_engine_choice_utils.cc | 5 +--
.../search_engine_countries-inc.cc | 3 ++
.../search_engines/search_engine_type.h | 5 +++
5 files changed, 40 insertions(+)
.../template_url_prepopulate_data.cc | 1 -
.../template_url_prepopulate_data.h | 7 ----
8 files changed, 41 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
Expand Down Expand Up @@ -102,6 +105,21 @@ diff --git a/components/search_engines/prepopulated_engines.json b/components/se
"mail_ru": {
"name": "@MAIL.RU",
"keyword": "mail.ru",
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
@@ -226,10 +226,7 @@ void RecordChoiceScreenDefaultSearchProviderType(SearchEngineType engine_type) {
}

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
Expand Down Expand Up @@ -140,4 +158,33 @@ diff --git a/components/search_engines/search_engine_type.h b/components/search_
// 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
@@ -80,7 +80,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
@@ -31,13 +31,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;
--