Add SERP metrics prefs target (#34712)

The PR adds SERP metrics prefs target and includes
kDeprecatedSerpMetricsTimePeriodStorage preference to it.
This will allow us to use kDeprecatedSerpMetricsTimePeriodStorage
preference without duplication. The change is pre-requisite for
SERP metrics profile attribute migration.
This commit is contained in:
Aleksei Seren
2026-03-16 22:29:50 -05:00
committed by GitHub
parent 2049362be9
commit d700d81f46
4 changed files with 27 additions and 6 deletions
+3 -6
View File
@@ -6,7 +6,6 @@
#include "brave/browser/brave_profile_prefs.h"
#include <string>
#include <string_view>
#include "base/feature_list.h"
#include "brave/browser/brave_browser_features.h"
@@ -53,6 +52,7 @@
#include "brave/components/query_filter/pref_names.h"
#include "brave/components/request_otr/common/buildflags/buildflags.h"
#include "brave/components/search_engines/brave_prepopulated_engines.h"
#include "brave/components/serp_metrics/pref_names.h"
#include "brave/components/speedreader/common/buildflags/buildflags.h"
#include "brave/components/tor/buildflags/buildflags.h"
#include "brave/components/web_discovery/buildflags/buildflags.h"
@@ -176,10 +176,6 @@ namespace brave {
namespace {
// Deprecated 2026-03.
constexpr std::string_view kDeprecatedSerpMetricsTimePeriodStorage =
"brave.stats.serp_metrics";
void OverrideDefaultPrefValues(user_prefs::PrefRegistrySyncable* registry) {
#if BUILDFLAG(IS_ANDROID)
// Clear default popular sites
@@ -389,7 +385,8 @@ void RegisterProfilePrefsForMigration(
registry->RegisterBooleanPref(prefs::kAddOpenSearchEngines, false);
// Added 2026-03
registry->RegisterDictionaryPref(kDeprecatedSerpMetricsTimePeriodStorage);
registry->RegisterDictionaryPref(
serp_metrics::prefs::kDeprecatedSerpMetricsTimePeriodStorage);
}
void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
+1
View File
@@ -239,6 +239,7 @@ brave_chrome_browser_deps = [
"//brave/components/request_otr/common/buildflags",
"//brave/components/resources",
"//brave/components/serp_metrics",
"//brave/components/serp_metrics:prefs",
"//brave/components/skus/browser",
"//brave/components/skus/common",
"//brave/components/skus/common:mojom",
+4
View File
@@ -39,6 +39,10 @@ static_library("features") {
public_deps = [ "//base" ]
}
source_set("prefs") {
public = [ "pref_names.h" ]
}
source_set("unit_tests") {
testonly = true
+19
View File
@@ -0,0 +1,19 @@
/* Copyright (c) 2026 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at https://mozilla.org/MPL/2.0/. */
#ifndef BRAVE_COMPONENTS_SERP_METRICS_PREF_NAMES_H_
#define BRAVE_COMPONENTS_SERP_METRICS_PREF_NAMES_H_
#include <string_view>
namespace serp_metrics::prefs {
// Deprecated 2026-03.
inline constexpr std::string_view kDeprecatedSerpMetricsTimePeriodStorage =
"brave.stats.serp_metrics";
} // namespace serp_metrics::prefs
#endif // BRAVE_COMPONENTS_SERP_METRICS_PREF_NAMES_H_