[PS Cleanup] Remove deprecated Privacy Sandbox APIs syncable pref

This CL:
- Deprecates the old syncable pref for Privacy Sandbox APIs
- Updates some of the comments in clearing prefs to "Added" instead of
"Deprecated" for consistency.

Bug: 40213277
Change-Id: I21efff0ae6d8a17bf3a1e270305891e59b53e5df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5355850
Commit-Queue: Mariam Ali <[email protected]>
Commit-Queue: Rushan Suleymanov <[email protected]>
Reviewed-by: Theodore Olsauskas-Warren <[email protected]>
Reviewed-by: Rushan Suleymanov <[email protected]>
Auto-Submit: Mariam Ali <[email protected]>
Reviewed-by: Marc Treib <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1270828}
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index ed1dd72..bfdbe07 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -1027,6 +1027,9 @@
 // Deprecated 03/2024.
 constexpr char kPlusAddressLastFetchedTime[] = "plus_address.last_fetched_time";
 
+// Deprecated 03/2024.
+constexpr char kPrivacySandboxApisEnabled[] = "privacy_sandbox.apis_enabled";
+
 // Register local state used only for migration (clearing or moving to a new
 // key).
 void RegisterLocalStatePrefsForMigration(PrefRegistrySimple* registry) {
@@ -1458,6 +1461,9 @@
 
   // Deprecated 03/2024.
   registry->RegisterTimePref(kPlusAddressLastFetchedTime, base::Time());
+
+  // Deprecated 03/2024.
+  registry->RegisterBooleanPref(kPrivacySandboxApisEnabled, true);
 }
 
 void ClearSyncRequestedPrefAndMaybeMigrate(PrefService* profile_prefs) {
@@ -2613,12 +2619,12 @@
                                                                   profile_path);
 #endif
 
-  // Deprecated 11/2023.
+  // Added 11/2023.
   profile_prefs->ClearPref(kPasswordChangeSuccessTrackerFlows);
   profile_prefs->ClearPref(kPasswordChangeSuccessTrackerVersion);
 
 #if BUILDFLAG(IS_CHROMEOS_ASH)
-  // Deprecated 11/2023.
+  // Added 11/2023.
   profile_prefs->ClearPref(kImageSearchPrivacyNotice);
 #endif  // BUILDFLAG(IS_CHROMEOS_ASH)
 
@@ -2642,10 +2648,10 @@
   profile_prefs->ClearPref(kDesktopSiteDisplaySettingEnabled);
 #endif
 
-  // Deprecated 12/2023.
+  // Added 12/2023.
   profile_prefs->ClearPref(kDownloadDuplicateFilePromptEnabled);
 
-  // Deprecated 12/2023.
+  // Added 12/2023.
   profile_prefs->ClearPref(kModelQualityLoggingClientId);
 
   // Added 12/2023.
@@ -2678,14 +2684,14 @@
   // Added 01/2024.
   profile_prefs->ClearPref(kDownloadBubbleIphSuppression);
 
-  // Deprecated 01/2024.
+  // Added 01/2024.
 #if BUILDFLAG(IS_CHROMEOS_ASH)
   profile_prefs->ClearPref(kPersistedSystemExtensions);
   profile_prefs->ClearPref(kBorealisVmTokenHash);
 #endif  // BUILDFLAG(IS_CHROMEOS_ASH)
 
 #if !BUILDFLAG(IS_ANDROID)
-  // Deprecated 1/2024.
+  // Added 1/2024.
   performance_manager::user_tuning::prefs::MigrateTabDiscardingExceptionsPref(
       profile_prefs);
 #endif
@@ -2694,37 +2700,37 @@
   profile_prefs->ClearPref(kNtpShownPage);
   profile_prefs->ClearPref(kNtpAppPageNames);
 
-  // Deprecated 01/2024.
+  // Added 01/2024.
 #if BUILDFLAG(IS_WIN)
   profile_prefs->ClearPref(kSearchResultsPagePrimaryFontsPref);
   profile_prefs->ClearPref(kSearchResultsPageFallbackFontsPref);
 #endif
 
-  // Deprecated 01/2024.
+  // Added 01/2024.
 #if BUILDFLAG(IS_CHROMEOS_ASH)
   profile_prefs->ClearPref(kUpdateNotificationLastShownMilestone);
 #endif
 
-  // Deprecated 01/2024.
+  // Added 01/2024.
 #if BUILDFLAG(IS_ANDROID)
   profile_prefs->ClearPref(kSavePasswordsSuspendedByError);
 #endif
 
-  // Deprecated 02/2024
+  // Added 02/2024
   profile_prefs->ClearPref(kSafeBrowsingDeepScanPromptSeen);
   profile_prefs->ClearPref(kSafeBrowsingEsbEnabledTimestamp);
 
-  // Deprecated 02/2024.
+  // Added 02/2024.
 #if BUILDFLAG(IS_CHROMEOS_ASH)
   for (const char* pref : kWelcomeTourTimeBucketsOfFirstInteractions) {
     profile_prefs->ClearPref(pref);
   }
 
-  // Deprecated 02/2024.
+  // Added 02/2024.
   profile_prefs->ClearPref(kDiscoverTabSuggestionChipTimesLeftToShow);
 #endif
 
-  // Deprecated 02/2024.
+  // Added 02/2024.
 #if BUILDFLAG(IS_CHROMEOS_ASH)
   profile_prefs->ClearPref(kHatsSmartLockSurveyCycleEndTs);
   profile_prefs->ClearPref(kHatsSmartLockDeviceIsSelected);
@@ -2732,18 +2738,22 @@
   profile_prefs->ClearPref(kHatsUnlockDeviceIsSelected);
 #endif
 
-  // Deprecated 02/2024
+  // Added 02/2024
   profile_prefs->ClearPref(kResetCheckDefaultBrowser);
 
-  // Deprecated 02/2024
+  // Added 02/2024
   profile_prefs->ClearPref(kOfferReaderMode);
 
+  // Added 03/2024.
+  profile_prefs->ClearPref(kPlusAddressLastFetchedTime);
+
+  // Added 03/2024.
+  profile_prefs->ClearPref(kPrivacySandboxApisEnabled);
+
   // Added 02/2024, but DO NOT REMOVE after the usual year!
   // TODO(crbug.com/40282890): Remove ~one year after full launch.
   browser_sync::MaybeMigrateSyncingUserToSignedIn(profile_path, profile_prefs);
 
-  profile_prefs->ClearPref(kPlusAddressLastFetchedTime);
-
   // Please don't delete the following line. It is used by PRESUBMIT.py.
   // END_MIGRATE_OBSOLETE_PROFILE_PREFS
 
diff --git a/chrome/browser/sync/prefs/chrome_syncable_prefs_database.cc b/chrome/browser/sync/prefs/chrome_syncable_prefs_database.cc
index a97155e..d29f9937 100644
--- a/chrome/browser/sync/prefs/chrome_syncable_prefs_database.cc
+++ b/chrome/browser/sync/prefs/chrome_syncable_prefs_database.cc
@@ -220,7 +220,7 @@
   // kPageColors = 100162, (no longer synced)
   kPerformanceTracingEnabled = 100163,
   kPluginsAlwaysOpenPdfExternally = 100164,
-  kPrivacySandboxApisEnabled = 100165,
+  // kPrivacySandboxApisEnabled = 100165, (deprecated)
   kPrivacySandboxRelatedWebsiteSetsEnabled = 100166,
   // kPrivacySandboxManuallyControlled = 100167, (deprecated)
   kPromptForDownload = 100168,
@@ -1187,10 +1187,6 @@
      {syncable_prefs_ids::kPluginsAlwaysOpenPdfExternally, syncer::PREFERENCES,
       sync_preferences::PrefSensitivity::kNone,
       sync_preferences::MergeBehavior::kNone}},
-    {prefs::kPrivacySandboxApisEnabled,
-     {syncable_prefs_ids::kPrivacySandboxApisEnabled, syncer::PREFERENCES,
-      sync_preferences::PrefSensitivity::kNone,
-      sync_preferences::MergeBehavior::kNone}},
     {prefs::kPrivacySandboxRelatedWebsiteSetsEnabled,
      {syncable_prefs_ids::kPrivacySandboxRelatedWebsiteSetsEnabled,
       syncer::PREFERENCES, sync_preferences::PrefSensitivity::kNone,
diff --git a/components/privacy_sandbox/privacy_sandbox_prefs.cc b/components/privacy_sandbox/privacy_sandbox_prefs.cc
index ed64fe0e..3150690 100644
--- a/components/privacy_sandbox/privacy_sandbox_prefs.cc
+++ b/components/privacy_sandbox/privacy_sandbox_prefs.cc
@@ -11,9 +11,6 @@
 namespace privacy_sandbox {
 
 void RegisterProfilePrefs(PrefRegistrySimple* registry) {
-  registry->RegisterBooleanPref(
-      prefs::kPrivacySandboxApisEnabled, true,
-      user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
   registry->RegisterBooleanPref(prefs::kPrivacySandboxM1ConsentDecisionMade,
                                 false);
   registry->RegisterBooleanPref(prefs::kPrivacySandboxM1EEANoticeAcknowledged,
diff --git a/components/privacy_sandbox/privacy_sandbox_prefs.h b/components/privacy_sandbox/privacy_sandbox_prefs.h
index d6903ec..64b5486 100644
--- a/components/privacy_sandbox/privacy_sandbox_prefs.h
+++ b/components/privacy_sandbox/privacy_sandbox_prefs.h
@@ -48,14 +48,6 @@
 inline constexpr char kPrivacySandboxM1Restricted[] =
     "privacy_sandbox.m1.restricted";
 
-// Synced boolean pref. Privacy Sandbox APIs may only be enabled when this is
-// enabled, but each API will respect its own enabling logic if this pref is
-// true. When this pref is false ALL Privacy Sandbox APIs are disabled.
-// TODO(crbug.com/1292898): Deprecate this preference once all users have been
-// migrated to the V2 pref.
-inline constexpr char kPrivacySandboxApisEnabled[] =
-    "privacy_sandbox.apis_enabled";
-
 // The point in time from which history is eligible to be used when calculating
 // a user's Topics API topics.
 inline constexpr char kPrivacySandboxTopicsDataAccessibleSince[] =
diff --git a/tools/metrics/histograms/metadata/sync/enums.xml b/tools/metrics/histograms/metadata/sync/enums.xml
index f51b07cf..e6ee70a 100644
--- a/tools/metrics/histograms/metadata/sync/enums.xml
+++ b/tools/metrics/histograms/metadata/sync/enums.xml
@@ -411,7 +411,7 @@
   <int value="100162" label="(obsolete, no longer synced) PageColors"/>
   <int value="100163" label="PerformanceTracingEnabled"/>
   <int value="100164" label="PluginsAlwaysOpenPdfExternally"/>
-  <int value="100165" label="PrivacySandboxApisEnabled"/>
+  <int value="100165" label="(obsolete) PrivacySandboxApisEnabled"/>
   <int value="100166" label="PrivacySandboxRelatedWebsiteSetsEnabled"/>
   <int value="100167" label="(obsolete) PrivacySandboxManuallyControlled"/>
   <int value="100168" label="PromptForDownload"/>