SyncToSigninMigration: Plumb migration logic on all platforms

No behavioral changes as the feature is disabled by default. The rest of
the changes, including IdentityManager's pref registration, are pure
refactorings (at least outside tests).

The ios-specific logic in browser_prefs.mm, introduced in
https://crrev.com/c/4983933, is now ported to other platforms, which use
the non-ios counterpart browser_prefs.cc.

A browser test is introduced for Bookmarks, which diverge most from
iOS in terms of how the storage of account bookmarks is implemented.

These integration tests also prove that the iOS implementation can be
reused as is. Therefore, the ifdefs are removed from
GetSyncToSigninMigrationDecision(), the implementation unified and the
unit-tests enabled everywhere. Outside iOS, the plan is that a single
BookmarkModel exists, but it will still use two separate JSON files for
storage, and hence the migration logic can be shared across platforms.

Change-Id: I0e3816b1742ac77e396c525f9ea6e7af3afd33ed
Bug: 40282890, 41493391
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5307157
Commit-Queue: Mikel Astiz <[email protected]>
Reviewed-by: Victor Vianna <[email protected]>
Reviewed-by: Marc Treib <[email protected]>
Reviewed-by: David Roger <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1265229}
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 06a311d3..b0901ea 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -104,6 +104,7 @@
 #include "components/autofill/core/common/autofill_prefs.h"
 #include "components/blocked_content/safe_browsing_triggered_popup_blocker.h"
 #include "components/breadcrumbs/core/breadcrumbs_status.h"
+#include "components/browser_sync/sync_to_signin_migration.h"
 #include "components/browsing_data/core/pref_names.h"
 #include "components/certificate_transparency/pref_names.h"
 #include "components/commerce/core/pref_names.h"
@@ -2706,6 +2707,10 @@
   // Deprecated 02/2024
   profile_prefs->ClearPref(kResetCheckDefaultBrowser);
 
+  // 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);
+
   // Please don't delete the following line. It is used by PRESUBMIT.py.
   // END_MIGRATE_OBSOLETE_PROFILE_PREFS