Add scaffold of SetUsesSplitStoresAndUPMForLocal() and invoke it
This is the function that will be called on startup to set the
value of UsesSplitStoresAndUPMForLocal(). Per the doc linked in
https://crbug.com/1495626, it needs to be invoked before any keyed
services are created. This is done in MigrateObsoleteProfilePrefs(),
which is the same approach taken by https://crrev.com/c/5033264.
Also add a call to MigrateObsoleteProfilePrefs() to TestingProfile,
so the latter can be used for testing later.
No behavior change (not even behind flag) because the function is not
implemented yet.
Bug: 1495626
Change-Id: Ib8878a97f493d289e7c26c8fe681e175091da773
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5088792
Auto-Submit: Victor Vianna <[email protected]>
Commit-Queue: Monica Basta <[email protected]>
Reviewed-by: Ioana Pandele <[email protected]>
Reviewed-by: Dominic Battre <[email protected]>
Reviewed-by: Monica Basta <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1233943}
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 2c9e95b..9f162ca2 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -266,6 +266,7 @@
#include "chrome/browser/lens/android/lens_prefs.h"
#include "chrome/browser/media/android/cdm/media_drm_origin_id_manager.h"
#include "chrome/browser/notifications/notification_channels_provider_android.h"
+#include "chrome/browser/password_manager/android/password_manager_android_util.h"
#include "chrome/browser/readaloud/android/prefs.h"
#include "chrome/browser/ssl/known_interception_disclosure_infobar_delegate.h"
#include "components/cdm/browser/media_drm_storage_impl.h" // nogncheck crbug.com/1125897
@@ -2303,7 +2304,8 @@
// This method should be periodically pruned of year+ old migrations.
// See chrome/browser/prefs/README.md for details.
-void MigrateObsoleteProfilePrefs(PrefService* profile_prefs) {
+void MigrateObsoleteProfilePrefs(PrefService* profile_prefs,
+ const base::FilePath& profile_path) {
// IMPORTANT NOTE: This code is *not* run on iOS Chrome. If a pref is migrated
// or cleared here, and that pref is also used in iOS Chrome, it may also need
// to be migrated or cleared specifically for iOS as well. This could be by
@@ -2628,6 +2630,18 @@
profile_prefs);
#endif // !BUILDFLAG(IS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
+ // Added 11/2023, but DO NOT REMOVE after the usual year!
+ // TODO(crbug.com/1445497): The pref kPasswordsUseUPMLocalAndSeparateStores
+ // and this call (to compute said pref) should be removed once
+ // kUnifiedPasswordManagerLocalPasswordsAndroidWithMigration is launched and
+ // enough clients have migrated. UsesSplitStoresAndUPMForLocal() should be
+ // updated to check the GmsCoreVersion directly instead of the pref, or might
+ // be removed entirely, depending how the outdated GmsCore case is handled.
+ password_manager_android_util::SetUsesSplitStoresAndUPMForLocal(profile_prefs,
+ profile_path);
+#endif
+
// Deprecated 11/2023.
profile_prefs->ClearPref(kPasswordChangeSuccessTrackerFlows);
profile_prefs->ClearPref(kPasswordChangeSuccessTrackerVersion);