[cr148] Fix unwated kMaxStarterPackId replacement

The use of this constant for inserting a new key on the same enum class
is too fragile, and has fallen apart with with a new mention of
`kMaxStarterPackId` being introduced.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/ed834a558a91d08a5a47995444a932d66b5638ad

commit ed834a558a91d08a5a47995444a932d66b5638ad
Author: Amelie Schneider <amelies@google.com>
Date:   Tue Mar 17 10:54:29 2026 -0700

    [Search] Refactor disabled starter pack IDs retrieval

    Until now, it was determined directly in
    `TemplateURLTableModel::Reload()` whether starter packs should be
    disabled or not. Since we will have to use this logic directly inside
    the `TemplateURLService`, move it to the `SearchEnginesHandler` instead.

    Bug: 490314640
    Change-Id: I0f49443617b56cfdb71124b468a39200e90312a6
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7670799
    Reviewed-by: Nicolas Dossou-Gbété <dgn@chromium.org>
    Commit-Queue: Amelie Schneider <amelies@google.com>
    Cr-Commit-Position: refs/heads/main@{#1600663}
This commit is contained in:
Claudio DeSouza
2026-04-27 12:00:48 +01:00
parent 56924fa1f2
commit bf8ee61732
2 changed files with 16 additions and 4 deletions
@@ -6,17 +6,17 @@
#ifndef BRAVE_CHROMIUM_SRC_COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_STARTER_PACK_DATA_H_
#define BRAVE_CHROMIUM_SRC_COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_STARTER_PACK_DATA_H_
// Add an enum value for any Brave-defined search engine starter packs.
#define kMaxStarterPackId kAskBraveSearch, kMaxStarterPackId
// Rename upstream's GetStarterPackEngines` so that we can provide our own
// implementation. The original function is used in upstream unit tests.
#define GetStarterPackEngines GetStarterPackEngines_ChromiumImpl
// Add an enum value for any Brave-defined search engine starter packs.
#define BRAVE_TEMPLATE_URL_STARTER_PACK_ID_ENUM kAskBraveSearch,
#include <components/search_engines/template_url_starter_pack_data.h> // IWYU pragma: export
#undef BRAVE_TEMPLATE_URL_STARTER_PACK_ID_ENUM
#undef GetStarterPackEngines
#undef kMaxStarterPackId
namespace template_url_starter_pack_data {
@@ -0,0 +1,12 @@
diff --git a/components/search_engines/template_url_starter_pack_data.h b/components/search_engines/template_url_starter_pack_data.h
index a2800658774a8057b4d6b125d205826430e9081d..d7e925a06b6550597f2aca3ddec1cc21c7065024 100644
--- a/components/search_engines/template_url_starter_pack_data.h
+++ b/components/search_engines/template_url_starter_pack_data.h
@@ -34,6 +34,7 @@ enum class StarterPackId {
kPage = 5,
kAiMode = 6,
+ BRAVE_TEMPLATE_URL_STARTER_PACK_ID_ENUM
kMaxStarterPackId
};