diff --git a/chromium_src/components/search_engines/template_url_prepopulate_data.cc b/chromium_src/components/search_engines/template_url_prepopulate_data.cc index 673ca9f67fa2..c85b5d6bf5d2 100644 --- a/chromium_src/components/search_engines/template_url_prepopulate_data.cc +++ b/chromium_src/components/search_engines/template_url_prepopulate_data.cc @@ -49,6 +49,15 @@ const std::vector brave_engines_default = { }; // Variations of the order / default options by country. +const std::vector brave_engines_with_ecosia = { + PREPOPULATED_ENGINE_ID_GOOGLE, + PREPOPULATED_ENGINE_ID_DUCKDUCKGO, + PREPOPULATED_ENGINE_ID_QWANT, + PREPOPULATED_ENGINE_ID_BING, + PREPOPULATED_ENGINE_ID_STARTPAGE, + PREPOPULATED_ENGINE_ID_ECOSIA, +}; + const std::vector brave_engines_with_yahoo = { PREPOPULATED_ENGINE_ID_YAHOO, PREPOPULATED_ENGINE_ID_GOOGLE, @@ -58,6 +67,16 @@ const std::vector brave_engines_with_yahoo = { PREPOPULATED_ENGINE_ID_STARTPAGE, }; +const std::vector brave_engines_with_yahoo_ecosia = { + PREPOPULATED_ENGINE_ID_YAHOO, + PREPOPULATED_ENGINE_ID_GOOGLE, + PREPOPULATED_ENGINE_ID_DUCKDUCKGO, + PREPOPULATED_ENGINE_ID_QWANT, + PREPOPULATED_ENGINE_ID_BING, + PREPOPULATED_ENGINE_ID_STARTPAGE, + PREPOPULATED_ENGINE_ID_ECOSIA, +}; + const std::vector brave_engines_with_yandex = { PREPOPULATED_ENGINE_ID_YANDEX, PREPOPULATED_ENGINE_ID_GOOGLE, @@ -74,6 +93,7 @@ const std::vector brave_engines_DE = { PREPOPULATED_ENGINE_ID_GOOGLE, PREPOPULATED_ENGINE_ID_BING, PREPOPULATED_ENGINE_ID_STARTPAGE, + PREPOPULATED_ENGINE_ID_ECOSIA, }; const std::vector brave_engines_FR = { @@ -83,6 +103,7 @@ const std::vector brave_engines_FR = { PREPOPULATED_ENGINE_ID_DUCKDUCKGO, PREPOPULATED_ENGINE_ID_BING, PREPOPULATED_ENGINE_ID_STARTPAGE, + PREPOPULATED_ENGINE_ID_ECOSIA, }; const std::vector brave_engines_AU_NZ_IE = { @@ -91,7 +112,8 @@ const std::vector brave_engines_AU_NZ_IE = { PREPOPULATED_ENGINE_ID_GOOGLE, PREPOPULATED_ENGINE_ID_QWANT, PREPOPULATED_ENGINE_ID_BING, - PREPOPULATED_ENGINE_ID_STARTPAGE}; + PREPOPULATED_ENGINE_ID_STARTPAGE, +}; // A map to keep track of a full list of default engines for countries // that don't use the default list. @@ -107,6 +129,8 @@ const std::map*> &brave_engines_with_yahoo}, {country_codes::CountryCharsToCountryID('A', 'U'), &brave_engines_AU_NZ_IE}, + {country_codes::CountryCharsToCountryID('B', 'E'), + &brave_engines_with_ecosia}, {country_codes::CountryCharsToCountryID('B', 'R'), &brave_engines_with_yahoo}, {country_codes::CountryCharsToCountryID('B', 'Y'), @@ -114,23 +138,21 @@ const std::map*> {country_codes::CountryCharsToCountryID('C', 'A'), &brave_engines_with_yahoo}, {country_codes::CountryCharsToCountryID('C', 'H'), - &brave_engines_with_yahoo}, + &brave_engines_with_yahoo_ecosia}, {country_codes::CountryCharsToCountryID('C', 'L'), &brave_engines_with_yahoo}, {country_codes::CountryCharsToCountryID('C', 'O'), &brave_engines_with_yahoo}, - {country_codes::CountryCharsToCountryID('D', 'E'), - &brave_engines_DE}, + {country_codes::CountryCharsToCountryID('D', 'E'), &brave_engines_DE}, {country_codes::CountryCharsToCountryID('D', 'K'), &brave_engines_with_yahoo}, {country_codes::CountryCharsToCountryID('E', 'S'), &brave_engines_with_yahoo}, {country_codes::CountryCharsToCountryID('F', 'I'), &brave_engines_with_yahoo}, - {country_codes::CountryCharsToCountryID('F', 'R'), - &brave_engines_FR}, + {country_codes::CountryCharsToCountryID('F', 'R'), &brave_engines_FR}, {country_codes::CountryCharsToCountryID('G', 'B'), - &brave_engines_with_yahoo}, + &brave_engines_with_yahoo_ecosia}, {country_codes::CountryCharsToCountryID('H', 'K'), &brave_engines_with_yahoo}, {country_codes::CountryCharsToCountryID('I', 'D'), @@ -152,7 +174,7 @@ const std::map*> {country_codes::CountryCharsToCountryID('M', 'Y'), &brave_engines_with_yahoo}, {country_codes::CountryCharsToCountryID('N', 'L'), - &brave_engines_with_yahoo}, + &brave_engines_with_yahoo_ecosia}, {country_codes::CountryCharsToCountryID('N', 'O'), &brave_engines_with_yahoo}, {country_codes::CountryCharsToCountryID('N', 'Z'), @@ -164,7 +186,7 @@ const std::map*> {country_codes::CountryCharsToCountryID('R', 'U'), &brave_engines_with_yandex}, {country_codes::CountryCharsToCountryID('S', 'E'), - &brave_engines_with_yahoo}, + &brave_engines_with_yahoo_ecosia}, {country_codes::CountryCharsToCountryID('S', 'G'), &brave_engines_with_yahoo}, {country_codes::CountryCharsToCountryID('T', 'H'), @@ -176,7 +198,7 @@ const std::map*> {country_codes::CountryCharsToCountryID('T', 'W'), &brave_engines_with_yahoo}, {country_codes::CountryCharsToCountryID('U', 'S'), - &brave_engines_with_yahoo}, + &brave_engines_with_yahoo_ecosia}, {country_codes::CountryCharsToCountryID('U', 'Z'), &brave_engines_with_yandex}, {country_codes::CountryCharsToCountryID('V', 'E'), diff --git a/components/search_engines/brave_prepopulated_engines.cc b/components/search_engines/brave_prepopulated_engines.cc index d168528b5a63..dcb9263d4646 100644 --- a/components/search_engines/brave_prepopulated_engines.cc +++ b/components/search_engines/brave_prepopulated_engines.cc @@ -12,7 +12,7 @@ namespace TemplateURLPrepopulateData { // IMPORTANT! Make sure to bump this value if you make changes to the // engines below or add/remove engines. -const int kBraveCurrentDataVersion = 8; +const int kBraveCurrentDataVersion = 9; // DO NOT CHANGE THIS ONE. Used for backfilling kBraveDefaultSearchVersion. const int kBraveFirstTrackedDataVersion = 6; @@ -62,6 +62,7 @@ const std::map {PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE, &duckduckgo_au_nz_ie}, {PREPOPULATED_ENGINE_ID_QWANT, &qwant}, {PREPOPULATED_ENGINE_ID_STARTPAGE, &startpage}, + {PREPOPULATED_ENGINE_ID_ECOSIA, &brave_ecosia}, }; PrepopulatedEngine ModifyEngineParams(const PrepopulatedEngine& engine, @@ -152,6 +153,20 @@ const PrepopulatedEngine duckduckgo_lite = { }; #endif +const PrepopulatedEngine brave_ecosia = + ModifyEngineParams(ecosia, + NULL, + L":e", + "https://www.ecosia.org/search?tt=" +#if defined(OS_ANDROID) + "42b8ae98" +#else + "e8eb07a6" +#endif + "&q={{searchTerms}}", + "https://ac.ecosia.org/?q={searchTerms}", + PREPOPULATED_ENGINE_ID_ECOSIA); + const PrepopulatedEngine qwant = { L"Qwant", L":q", diff --git a/components/search_engines/brave_prepopulated_engines.h b/components/search_engines/brave_prepopulated_engines.h index 140bb0c63655..93003011d495 100644 --- a/components/search_engines/brave_prepopulated_engines.h +++ b/components/search_engines/brave_prepopulated_engines.h @@ -31,6 +31,7 @@ enum BravePrepopulatedEngineID : unsigned int { PREPOPULATED_ENGINE_ID_GOOGLE = 1, PREPOPULATED_ENGINE_ID_BING = 3, PREPOPULATED_ENGINE_ID_YANDEX = 15, + PREPOPULATED_ENGINE_ID_ECOSIA = 101, // These engine IDs are not defined in Chromium BRAVE_PREPOPULATED_ENGINES_START = 500, PREPOPULATED_ENGINE_ID_AMAZON = 500, // No longer in defaults (2/2019). @@ -38,7 +39,6 @@ enum BravePrepopulatedEngineID : unsigned int { #if defined(OS_ANDROID) PREPOPULATED_ENGINE_ID_DUCKDUCKGO_LITE, // No longer in defaults (7/2020). #endif - PREPOPULATED_ENGINE_ID_ECOSIA, // No longer in defaults (2/2019). PREPOPULATED_ENGINE_ID_FINDX, // No longer exists (11/2018). PREPOPULATED_ENGINE_ID_GITHUB, // No longer in defaults (2/2019). PREPOPULATED_ENGINE_ID_INFOGALACTIC, // No longer in defaults (2/2019). @@ -95,6 +95,7 @@ extern const PrepopulatedEngine duckduckgo_au_nz_ie; #if defined(OS_ANDROID) extern const PrepopulatedEngine duckduckgo_lite; #endif +extern const PrepopulatedEngine brave_ecosia; extern const PrepopulatedEngine qwant; extern const PrepopulatedEngine startpage; extern const PrepopulatedEngine brave_yandex;