[Tab Group Sync] Remove files for tab group store

This CL removes all files associated with TabGroupStore. This includes
tab group store, delegate, java implementation using shared prefs,
proto definition, and migration utilities.

After this change, tab group store is fully removed.

Bug: 351559077
Change-Id: I3e339a1b64741123c90c52e4a47e76fea88effe4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5681182
Reviewed-by: Calder Kitagawa <ckitagawa@chromium.org>
Commit-Queue: Shakti Sahu <shaktisahu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1324971}
diff --git a/components/saved_tab_groups/android/java/src/org/chromium/components/tab_group_sync/TabGroupMetadataPersistentStore.java b/components/saved_tab_groups/android/java/src/org/chromium/components/tab_group_sync/TabGroupMetadataPersistentStore.java
deleted file mode 100644
index 1fbcbb8..0000000
--- a/components/saved_tab_groups/android/java/src/org/chromium/components/tab_group_sync/TabGroupMetadataPersistentStore.java
+++ /dev/null
@@ -1,178 +0,0 @@
-// Copyright 2024 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.components.tab_group_sync;
-
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.util.Base64;
-import android.util.Pair;
-
-import androidx.annotation.Nullable;
-
-import com.google.protobuf.InvalidProtocolBufferException;
-
-import org.jni_zero.CalledByNative;
-import org.jni_zero.CalledByNativeForTesting;
-
-import org.chromium.base.ContextUtils;
-import org.chromium.base.Log;
-import org.chromium.components.tab_group_sync.proto.TabGroupIdMetadata.TabGroupIDMetadataProto;
-
-import java.nio.ByteBuffer;
-import java.util.HashMap;
-import java.util.Map;
-
-/** Persistent Storage */
-public class TabGroupMetadataPersistentStore {
-    private static final String TAG = "TabGroupStore";
-    static final String TAB_GROUP_METADATA_PERSISTENT_STORE_FILE_NAME =
-            "tab_group_metadata_persistent_store";
-
-    /**
-     * Stores a single mapping from a sync GUID to a proto.
-     *
-     * @param syncGuid the sync GUID for the item to store.
-     * @param proto the proto to store.
-     */
-    public void write(String syncGuid, TabGroupIDMetadataProto proto) {
-        try {
-            String base64Encoded = serializeProtoToBase64EncodedString(syncGuid, proto);
-            if (base64Encoded == null) {
-                // Failed to base64 encode the proto. Not storing.
-                return;
-            }
-            getSharedPreferences().edit().putString(syncGuid, base64Encoded).apply();
-        } catch (RuntimeException e) {
-            Log.e(TAG, "Unable to store data for sync GUID=", syncGuid);
-        }
-    }
-
-    @CalledByNativeForTesting
-    private static void storeDataForTesting(String syncGuid, String serializedToken) {
-        TabGroupMetadataPersistentStore store = new TabGroupMetadataPersistentStore();
-        TabGroupIDMetadataProto proto =
-                TabGroupIDMetadataProto.newBuilder().setSerializedToken(serializedToken).build();
-        store.write(syncGuid, proto);
-    }
-
-    /**
-     * Deletes a persisted entry.
-     *
-     * @param syncGuid the GUID of the entry to delete.
-     */
-    public void delete(String syncGuid) {
-        getSharedPreferences().edit().remove(syncGuid).apply();
-    }
-
-    /**
-     * Reads all persisted data from disk.
-     *
-     * <p>Skips entries for anything that failed to read or parse.
-     *
-     * @return a Map of each of the sync GUIDs to their respective proto.
-     */
-    public Map<String, TabGroupIDMetadataProto> readAll() {
-        try {
-            Map<String, TabGroupIDMetadataProto> result =
-                    new HashMap<String, TabGroupIDMetadataProto>();
-
-            Map<String, ?> storedValues = getSharedPreferences().getAll();
-            for (Map.Entry<String, ?> entry : storedValues.entrySet()) {
-                String syncGuid = entry.getKey();
-                Object rawValue = entry.getValue();
-                if (!(rawValue instanceof String)) {
-                    // `value` is null or not a String, skip entry.
-                    continue;
-                }
-                String base64EncodedProto = (String) rawValue;
-                @Nullable
-                TabGroupIDMetadataProto proto =
-                        parseProtoFromBase64EncodedString(syncGuid, base64EncodedProto);
-                if (proto == null) {
-                    // Failed to parse proto from base64 encoded value, skip entry.
-                    continue;
-                }
-                result.put(syncGuid, proto);
-            }
-            return result;
-        } catch (RuntimeException e) {
-            Log.e(TAG, "Unable to get all TabGroupIDMetadataProtos");
-            return new HashMap<String, TabGroupIDMetadataProto>();
-        }
-    }
-
-    @CalledByNative
-    private static Pair<String, String>[] readAllDataForMigration() {
-        TabGroupMetadataPersistentStore store = new TabGroupMetadataPersistentStore();
-        Map<String, TabGroupIDMetadataProto> protoMap = store.readAll();
-        Pair<String, String>[] idPairs = new Pair[protoMap.size()];
-
-        int i = 0;
-        for (Map.Entry<String, TabGroupIDMetadataProto> entry : protoMap.entrySet()) {
-            String syncId = entry.getKey();
-            String serializedToken = entry.getValue().getSerializedToken();
-            idPairs[i++] = new Pair<>(syncId, serializedToken);
-        }
-
-        return idPairs;
-    }
-
-    @CalledByNative
-    private static String getFirstFromPair(Pair<String, String> pair) {
-        return pair.first;
-    }
-
-    @CalledByNative
-    private static String getSecondFromPair(Pair<String, String> pair) {
-        return pair.second;
-    }
-
-    /** Deletes all stored content. */
-    @CalledByNative
-    static void clearAllData() {
-        getSharedPreferences().edit().clear().apply();
-    }
-
-    private static @Nullable String serializeProtoToBase64EncodedString(
-            String syncGuid, TabGroupIDMetadataProto proto) {
-        try {
-            ByteBuffer bb = proto.toByteString().asReadOnlyByteBuffer();
-            bb.rewind();
-            byte[] bytes = new byte[bb.remaining()];
-            bb.get(bytes);
-            return Base64.encodeToString(
-                    bytes, Base64.URL_SAFE | Base64.NO_PADDING | Base64.NO_WRAP);
-        } catch (RuntimeException e) {
-            Log.e(TAG, "Unable to store data for sync GUID=", syncGuid);
-            return null;
-        }
-    }
-
-    private static @Nullable TabGroupIDMetadataProto parseProtoFromBase64EncodedString(
-            String syncGuid, String base64Encoded) {
-        byte[] bytes;
-        try {
-            bytes =
-                    Base64.decode(
-                            base64Encoded, Base64.URL_SAFE | Base64.NO_PADDING | Base64.NO_WRAP);
-        } catch (RuntimeException e) {
-            Log.e(TAG, "Unable to decode base64 data=", syncGuid);
-            return null;
-        }
-
-        try {
-            return TabGroupIDMetadataProto.parseFrom(bytes);
-        } catch (InvalidProtocolBufferException e) {
-            Log.e(TAG, "Unable to decode proto for sync GUID=", syncGuid);
-            return null;
-        }
-    }
-
-    private static SharedPreferences getSharedPreferences() {
-        return ContextUtils.getApplicationContext()
-                .getSharedPreferences(
-                        TAB_GROUP_METADATA_PERSISTENT_STORE_FILE_NAME, Context.MODE_PRIVATE);
-    }
-}
diff --git a/components/saved_tab_groups/android/java/src/org/chromium/components/tab_group_sync/TabGroupMetadataPersistentStoreUnitTest.java b/components/saved_tab_groups/android/java/src/org/chromium/components/tab_group_sync/TabGroupMetadataPersistentStoreUnitTest.java
deleted file mode 100644
index 248d3e9..0000000
--- a/components/saved_tab_groups/android/java/src/org/chromium/components/tab_group_sync/TabGroupMetadataPersistentStoreUnitTest.java
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2024 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.components.tab_group_sync;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.annotation.Config;
-
-import org.chromium.base.test.BaseRobolectricTestRunner;
-import org.chromium.components.tab_group_sync.proto.TabGroupIdMetadata.TabGroupIDMetadataProto;
-
-import java.util.Map;
-
-@RunWith(BaseRobolectricTestRunner.class)
-@Config(manifest = Config.NONE)
-public class TabGroupMetadataPersistentStoreUnitTest {
-
-    @Test
-    public void testWriteAndReadMatches() {
-        TabGroupMetadataPersistentStore store = new TabGroupMetadataPersistentStore();
-
-        TabGroupIDMetadataProto source =
-                TabGroupIDMetadataProto.newBuilder()
-                        .setSerializedToken("mySerializedToken")
-                        .build();
-        store.write("myGuid", source);
-
-        Map<String, TabGroupIDMetadataProto> entries = store.readAll();
-        assertEquals(1, entries.keySet().size());
-        assertTrue(entries.keySet().contains("myGuid"));
-
-        TabGroupIDMetadataProto dest = entries.get("myGuid");
-        assertEquals("mySerializedToken", dest.getSerializedToken());
-    }
-
-    @Test
-    public void testWriteAndDelete() {
-        TabGroupMetadataPersistentStore store = new TabGroupMetadataPersistentStore();
-
-        TabGroupIDMetadataProto source =
-                TabGroupIDMetadataProto.newBuilder()
-                        .setSerializedToken("mySerializedToken")
-                        .build();
-        store.write("myGuid", source);
-        store.delete("myGuid");
-
-        Map<String, TabGroupIDMetadataProto> entries = store.readAll();
-        assertEquals(0, entries.keySet().size());
-    }
-
-    @Test
-    public void testMultipleWritesAndReads() {
-        TabGroupMetadataPersistentStore store = new TabGroupMetadataPersistentStore();
-
-        TabGroupIDMetadataProto source1 =
-                TabGroupIDMetadataProto.newBuilder()
-                        .setSerializedToken("mySerializedToken1")
-                        .build();
-        store.write("myGuid1", source1);
-
-        TabGroupIDMetadataProto source2 =
-                TabGroupIDMetadataProto.newBuilder()
-                        .setSerializedToken("mySerializedToken2")
-                        .build();
-        store.write("myGuid2", source2);
-
-        Map<String, TabGroupIDMetadataProto> entries = store.readAll();
-        assertEquals(2, entries.keySet().size());
-        assertTrue(entries.keySet().contains("myGuid1"));
-        assertTrue(entries.keySet().contains("myGuid2"));
-
-        TabGroupIDMetadataProto dest1 = entries.get("myGuid1");
-        assertEquals("mySerializedToken1", dest1.getSerializedToken());
-        TabGroupIDMetadataProto dest2 = entries.get("myGuid2");
-        assertEquals("mySerializedToken2", dest2.getSerializedToken());
-    }
-}
diff --git a/components/saved_tab_groups/android/java/src/org/chromium/components/tab_group_sync/TabGroupStoreDelegate.java b/components/saved_tab_groups/android/java/src/org/chromium/components/tab_group_sync/TabGroupStoreDelegate.java
deleted file mode 100644
index a6986fe..0000000
--- a/components/saved_tab_groups/android/java/src/org/chromium/components/tab_group_sync/TabGroupStoreDelegate.java
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2024 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.components.tab_group_sync;
-
-import org.jni_zero.CalledByNative;
-import org.jni_zero.JNINamespace;
-import org.jni_zero.NativeMethods;
-
-import org.chromium.components.tab_group_sync.proto.TabGroupIdMetadata.TabGroupIDMetadataProto;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/** Java counterpart to the C++ TabGroupStoreDelegateAndroid class. */
-@JNINamespace("tab_groups")
-public class TabGroupStoreDelegate {
-    private final TabGroupMetadataPersistentStore mStorage = new TabGroupMetadataPersistentStore();
-
-    private long mNativePtr;
-
-    @CalledByNative
-    private static TabGroupStoreDelegate create(long nativePtr) {
-        return new TabGroupStoreDelegate(nativePtr);
-    }
-
-    TabGroupStoreDelegate(long nativePtr) {
-        mNativePtr = nativePtr;
-    }
-
-    @CalledByNative
-    private void clearNativePtr() {
-        mNativePtr = 0;
-    }
-
-    @CalledByNative
-    private void storeTabGroupIDMetadata(String syncGuid, String serializedToken) {
-        TabGroupIDMetadataProto proto =
-                TabGroupIDMetadataProto.newBuilder().setSerializedToken(serializedToken).build();
-        mStorage.write(syncGuid, proto);
-    }
-
-    @CalledByNative
-    private void deleteTabGroupIDMetadata(String syncGuid) {
-        mStorage.delete(syncGuid);
-    }
-
-    @CalledByNative
-    private void getTabGroupIDMetadatas(long nativeCallbackPtr) {
-        if (mNativePtr == 0) {
-            // Native has been deleted, so ignore this request.
-            return;
-        }
-
-        List<String> syncGuidList = new ArrayList<>();
-        List<String> serializedTokenList = new ArrayList<>();
-
-        Map<String, TabGroupIDMetadataProto> persistedData = mStorage.readAll();
-        for (Map.Entry<String, TabGroupIDMetadataProto> entry : persistedData.entrySet()) {
-            String syncGuid = entry.getKey();
-            if (syncGuid == null) {
-                // The key from the storage engine is null, which is invalid. Skip this entry.
-                continue;
-            }
-            TabGroupIDMetadataProto proto = entry.getValue();
-            if (proto == null) {
-                // The store is not supposed to return empty protos, but we should not propagate.
-                continue;
-            }
-            String serializedToken = proto.getSerializedToken();
-
-            syncGuidList.add(syncGuid);
-            serializedTokenList.add(serializedToken);
-        }
-
-        TabGroupStoreDelegateJni.get()
-                .onGetTabGroupIDMetadata(
-                        mNativePtr,
-                        nativeCallbackPtr,
-                        syncGuidList.stream().toArray(String[]::new),
-                        serializedTokenList.stream().toArray(String[]::new));
-    }
-
-    @NativeMethods
-    interface Natives {
-        void onGetTabGroupIDMetadata(
-                long nativeTabGroupStoreDelegateAndroid,
-                long callbackPtr,
-                String[] syncGuids,
-                String[] serializedTokens);
-    }
-}
diff --git a/components/saved_tab_groups/android/java/src/org/chromium/components/tab_group_sync/TabGroupStoreDelegateTestSupport.java b/components/saved_tab_groups/android/java/src/org/chromium/components/tab_group_sync/TabGroupStoreDelegateTestSupport.java
deleted file mode 100644
index 5e45051e..0000000
--- a/components/saved_tab_groups/android/java/src/org/chromium/components/tab_group_sync/TabGroupStoreDelegateTestSupport.java
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2024 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.components.tab_group_sync;
-
-import org.jni_zero.CalledByNative;
-import org.jni_zero.JNINamespace;
-
-/**
- * Helper class for testing that provides functionality for clearing out {@link
- * TabGroupMetadataPersistentStore} over JNI.
- */
-@JNINamespace("tab_groups")
-public class TabGroupStoreDelegateTestSupport {
-    @CalledByNative
-    private static void clearTabGroupMetadataPeristentStore() {
-        TabGroupMetadataPersistentStore.clearAllData();
-    }
-}
diff --git a/components/saved_tab_groups/android/java/src/org/chromium/components/tab_group_sync/proto/tab_group_id_metadata.proto b/components/saved_tab_groups/android/java/src/org/chromium/components/tab_group_sync/proto/tab_group_id_metadata.proto
deleted file mode 100644
index 0d67207..0000000
--- a/components/saved_tab_groups/android/java/src/org/chromium/components/tab_group_sync/proto/tab_group_id_metadata.proto
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2024 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-syntax = "proto2";
-
-package org.chromium.components.tab_group_sync.proto;
-
-option java_package = "org.chromium.components.tab_group_sync.proto";
-
-// Store local metadata about a local tab group.
-message TabGroupIDMetadataProto {
-  // Serialized version of a base::Token.
-  optional string serialized_token = 1;
-}
diff --git a/components/saved_tab_groups/android/tab_group_store_delegate_android.cc b/components/saved_tab_groups/android/tab_group_store_delegate_android.cc
deleted file mode 100644
index 1abcadb..0000000
--- a/components/saved_tab_groups/android/tab_group_store_delegate_android.cc
+++ /dev/null
@@ -1,136 +0,0 @@
-// Copyright 2024 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/saved_tab_groups/android/tab_group_store_delegate_android.h"
-
-#include <memory>
-#include <optional>
-#include <vector>
-
-#include "base/android/jni_android.h"
-#include "base/android/jni_array.h"
-#include "base/android/jni_string.h"
-#include "base/android/scoped_java_ref.h"
-#include "base/functional/bind.h"
-#include "base/functional/callback.h"
-#include "base/task/single_thread_task_runner.h"
-#include "base/uuid.h"
-#include "components/saved_tab_groups/tab_group_store_delegate.h"
-#include "components/saved_tab_groups/tab_group_store_id.h"
-
-// Must come after all headers that specialize FromJniType() / ToJniType().
-#include "components/saved_tab_groups/jni_headers/TabGroupStoreDelegate_jni.h"
-
-using base::android::AttachCurrentThread;
-using base::android::ConvertJavaStringToUTF16;
-using base::android::JavaParamRef;
-using base::android::ScopedJavaLocalRef;
-
-namespace tab_groups {
-
-TabGroupStoreDelegateAndroid::TabGroupStoreDelegateAndroid() {
-  JNIEnv* env = base::android::AttachCurrentThread();
-  java_obj_.Reset(
-      env, Java_TabGroupStoreDelegate_create(env, reinterpret_cast<jlong>(this))
-               .obj());
-}
-
-TabGroupStoreDelegateAndroid::~TabGroupStoreDelegateAndroid() {
-  JNIEnv* env = base::android::AttachCurrentThread();
-  Java_TabGroupStoreDelegate_clearNativePtr(env, java_obj_);
-}
-
-void TabGroupStoreDelegateAndroid::GetAllTabGroupIDMetadatas(
-    GetCallback callback) {
-  JNIEnv* env = base::android::AttachCurrentThread();
-  std::unique_ptr<GetCallback> wrapped_callback =
-      std::make_unique<GetCallback>(std::move(callback));
-  CHECK(wrapped_callback.get());
-  jlong j_native_ptr = reinterpret_cast<jlong>(wrapped_callback.get());
-  // We store this callback in-memory, expecting Java to always call us back
-  // through JNI_TabGroupStoreDelegate_OnGetTabGroupIDMetadata
-  callbacks_.emplace(j_native_ptr, std::move(wrapped_callback));
-
-  base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
-      FROM_HERE,
-      base::BindOnce(&Java_TabGroupStoreDelegate_getTabGroupIDMetadatas, env,
-                     java_obj_, j_native_ptr));
-}
-
-void TabGroupStoreDelegateAndroid::OnGetTabGroupIDMetadata(
-    JNIEnv* env,
-    jlong callback_ptr,
-    const base::android::JavaParamRef<jobjectArray>& j_sync_guids,
-    const base::android::JavaParamRef<jobjectArray>& j_serialized_tokens) {
-  CHECK(callback_ptr);
-  // We here assume the callback is still alive, and take ownership over it.
-  auto it = callbacks_.find(callback_ptr);
-  if (it == callbacks_.end()) {
-    // Callback is not valid, and this is an invalid state.
-    CHECK(false);
-    return;
-  }
-
-  std::unique_ptr<GetCallback> callback = std::move(it->second);
-  callbacks_.erase(callback_ptr);
-
-  std::vector<std::string> sync_guid_strs;
-  base::android::AppendJavaStringArrayToStringVector(env, j_sync_guids,
-                                                     &sync_guid_strs);
-
-  // Convert string GUIDs to Uuids.
-  std::vector<base::Uuid> sync_guids;
-  for (auto& sync_guid : sync_guid_strs) {
-    sync_guids.emplace_back(base::Uuid::ParseCaseInsensitive(sync_guid));
-  }
-
-  std::vector<std::string> serialized_token_strs;
-  base::android::AppendJavaStringArrayToStringVector(env, j_serialized_tokens,
-                                                     &serialized_token_strs);
-  // Parse string base::Tokens to base::Tokens.
-  std::vector<std::optional<base::Token>> tokens;
-  CHECK(sync_guids.size() == serialized_token_strs.size());
-  for (const auto& serialized_token_str : serialized_token_strs) {
-    std::optional<base::Token> maybe_token =
-        base::Token::FromString(serialized_token_str);
-    tokens.emplace_back(std::move(maybe_token));
-  }
-
-  // For all entries with valid base::Tokens, return them.
-  CHECK(sync_guids.size() == tokens.size());
-  std::map<base::Uuid, TabGroupIDMetadata> result = {};
-  for (size_t i = 0; i < sync_guids.size(); ++i) {
-    if (!tokens[i]) {
-      // TODO(nyquist): Add cleanup task for deleting invalid data.
-      continue;
-    }
-    result.emplace(sync_guids[i], std::move(tokens[i].value()));
-  }
-
-  std::move(*callback).Run(std::move(result));
-}
-
-void TabGroupStoreDelegateAndroid::StoreTabGroupIDMetadata(
-    const base::Uuid& sync_guid,
-    const TabGroupIDMetadata& tab_group_id_metadata) {
-  JNIEnv* env = base::android::AttachCurrentThread();
-  std::string serialized_token =
-      tab_group_id_metadata.local_tab_group_id.ToString();
-  Java_TabGroupStoreDelegate_storeTabGroupIDMetadata(
-      env, java_obj_,
-      base::android::ConvertUTF8ToJavaString(env,
-                                             sync_guid.AsLowercaseString()),
-      base::android::ConvertUTF8ToJavaString(env, serialized_token));
-}
-
-void TabGroupStoreDelegateAndroid::DeleteTabGroupIDMetdata(
-    const base::Uuid& sync_guid) {
-  JNIEnv* env = base::android::AttachCurrentThread();
-  Java_TabGroupStoreDelegate_deleteTabGroupIDMetadata(
-      env, java_obj_,
-      base::android::ConvertUTF8ToJavaString(env,
-                                             sync_guid.AsLowercaseString()));
-}
-
-}  // namespace tab_groups
diff --git a/components/saved_tab_groups/android/tab_group_store_delegate_android.h b/components/saved_tab_groups/android/tab_group_store_delegate_android.h
deleted file mode 100644
index a904606..0000000
--- a/components/saved_tab_groups/android/tab_group_store_delegate_android.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2024 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_SAVED_TAB_GROUPS_ANDROID_TAB_GROUP_STORE_DELEGATE_ANDROID_H_
-#define COMPONENTS_SAVED_TAB_GROUPS_ANDROID_TAB_GROUP_STORE_DELEGATE_ANDROID_H_
-
-#include <optional>
-
-#include "base/android/jni_android.h"
-#include "base/functional/callback_forward.h"
-#include "base/uuid.h"
-#include "components/saved_tab_groups/tab_group_store_delegate.h"
-#include "components/saved_tab_groups/tab_group_store_id.h"
-
-using base::android::ScopedJavaGlobalRef;
-
-namespace tab_groups {
-
-// A Android specific implementation for retrieving and storing sync GUID ->
-// TabGroupIDMetadata mappings.
-class TabGroupStoreDelegateAndroid : public TabGroupStoreDelegate {
- public:
-  TabGroupStoreDelegateAndroid();
-  ~TabGroupStoreDelegateAndroid() override;
-
-  // Disallow copy/assign.
-  TabGroupStoreDelegateAndroid(const TabGroupStoreDelegateAndroid&) = delete;
-  TabGroupStoreDelegateAndroid& operator=(const TabGroupStoreDelegateAndroid&) =
-      delete;
-
-  // TabGroupStoreDelegate implementation.
-  void GetAllTabGroupIDMetadatas(GetCallback callback) override;
-  void StoreTabGroupIDMetadata(
-      const base::Uuid& sync_guid,
-      const TabGroupIDMetadata& tab_group_id_metadata) override;
-  void DeleteTabGroupIDMetdata(const base::Uuid& sync_guid) override;
-
-  // Callback for Java.
-  void OnGetTabGroupIDMetadata(
-      JNIEnv* env,
-      jlong callback_ptr,
-      const base::android::JavaParamRef<jobjectArray>& j_sync_guids,
-      const base::android::JavaParamRef<jobjectArray>& j_serialized_tokens);
-
- private:
-  // An in-memory map for outstanding callbacks. Used for verifying that a
-  // native pointer passed from Java is valid, and to ensure that we delete the
-  // callbacks when `this` is deleted.
-  std::map<jlong, std::unique_ptr<GetCallback>> callbacks_;
-
-  ScopedJavaGlobalRef<jobject> java_obj_;
-};
-
-}  // namespace tab_groups
-
-#endif  // COMPONENTS_SAVED_TAB_GROUPS_ANDROID_TAB_GROUP_STORE_DELEGATE_ANDROID_H_
diff --git a/components/saved_tab_groups/android/tab_group_store_migration_utils.cc b/components/saved_tab_groups/android/tab_group_store_migration_utils.cc
deleted file mode 100644
index 725f8afe..0000000
--- a/components/saved_tab_groups/android/tab_group_store_migration_utils.cc
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2024 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/saved_tab_groups/android/tab_group_store_migration_utils.h"
-
-#include "base/android/jni_android.h"
-#include "base/android/jni_array.h"
-#include "base/android/jni_string.h"
-#include "base/logging.h"
-#include "components/saved_tab_groups/android/tab_group_sync_conversions_utils.h"
-#include "components/saved_tab_groups/jni_headers/TabGroupMetadataPersistentStore_jni.h"
-
-using base::android::AttachCurrentThread;
-using base::android::ScopedJavaLocalRef;
-
-namespace tab_groups {
-
-std::map<base::Uuid, LocalTabGroupID>
-ReadAndClearIdMappingsForMigrationFromSharedPrefs() {
-  std::map<base::Uuid, LocalTabGroupID> id_mappings;
-
-  JNIEnv* env = base::android::AttachCurrentThread();
-
-  // Read the entire shared pref into key-value pairs where key is sync ID and
-  // value is the serialized local tab group ID.
-  ScopedJavaLocalRef<jobjectArray> entries_array =
-      Java_TabGroupMetadataPersistentStore_readAllDataForMigration(env);
-  if (!entries_array) {
-    LOG(ERROR) << "Failed to get entries array from SharedPreferences";
-    return id_mappings;
-  }
-
-  // Walk through the list of pairs obtained from shared prefs and insert them
-  // into the map.
-  const int count = env->GetArrayLength(entries_array.obj());
-  for (int i = 0; i < count; ++i) {
-    ScopedJavaLocalRef<jobject> pair_obj = ScopedJavaLocalRef<jobject>(
-        env, env->GetObjectArrayElement(entries_array.obj(), i));
-
-    std::string sync_id_str = base::android::ConvertJavaStringToUTF8(
-        Java_TabGroupMetadataPersistentStore_getFirstFromPair(env, pair_obj));
-    std::string serialized_token_str = base::android::ConvertJavaStringToUTF8(
-        Java_TabGroupMetadataPersistentStore_getSecondFromPair(env, pair_obj));
-
-    auto sync_id = base::Uuid::ParseCaseInsensitive(sync_id_str);
-    std::optional<base::Token> token =
-        base::Token::FromString(serialized_token_str);
-    if (!token) {
-      LOG(ERROR) << "Unable to parse the token, skipping";
-      continue;
-    }
-
-    id_mappings.emplace(sync_id, *token);
-  }
-
-  // Clear the SharedPreferences after migration so that next time the above
-  // migration loop is a no-op.
-  Java_TabGroupMetadataPersistentStore_clearAllData(env);
-
-  return id_mappings;
-}
-
-void WriteMappingToSharedPrefsForTesting(const base::Uuid& sync_id,  // IN-TEST
-                                         const LocalTabGroupID& local_id) {
-  JNIEnv* env = base::android::AttachCurrentThread();
-  auto j_sync_id = UuidToJavaString(env, sync_id);
-  auto j_serialized_token =
-      base::android::ConvertUTF8ToJavaString(env, local_id.ToString());
-
-  Java_TabGroupMetadataPersistentStore_storeDataForTesting(  // IN-TEST
-      env, j_sync_id, j_serialized_token);
-}
-
-void ClearSharedPrefsForTesting() {
-  JNIEnv* env = base::android::AttachCurrentThread();
-  Java_TabGroupMetadataPersistentStore_clearAllData(env);
-}
-
-}  // namespace tab_groups
diff --git a/components/saved_tab_groups/android/tab_group_store_migration_utils.h b/components/saved_tab_groups/android/tab_group_store_migration_utils.h
deleted file mode 100644
index e994365..0000000
--- a/components/saved_tab_groups/android/tab_group_store_migration_utils.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2024 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_SAVED_TAB_GROUPS_ANDROID_TAB_GROUP_STORE_MIGRATION_UTILS_H_
-#define COMPONENTS_SAVED_TAB_GROUPS_ANDROID_TAB_GROUP_STORE_MIGRATION_UTILS_H_
-
-#include <map>
-
-#include "base/uuid.h"
-#include "components/saved_tab_groups/types.h"
-
-namespace tab_groups {
-
-// For migration. Invoked on startup, which reads the stored tab group ID
-// mappings from Android SharedPreferences and then clears it out.
-std::map<base::Uuid, LocalTabGroupID>
-ReadAndClearIdMappingsForMigrationFromSharedPrefs();
-
-// For testing only.
-void WriteMappingToSharedPrefsForTesting(const base::Uuid& sync_id,
-                                         const LocalTabGroupID& local_id);
-void ClearSharedPrefsForTesting();
-
-}  // namespace tab_groups
-
-#endif  // COMPONENTS_SAVED_TAB_GROUPS_ANDROID_TAB_GROUP_STORE_MIGRATION_UTILS_H_
diff --git a/components/saved_tab_groups/android/tab_group_store_migration_utils_unittest.cc b/components/saved_tab_groups/android/tab_group_store_migration_utils_unittest.cc
deleted file mode 100644
index 3a99a0c..0000000
--- a/components/saved_tab_groups/android/tab_group_store_migration_utils_unittest.cc
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2024 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/saved_tab_groups/android/tab_group_store_migration_utils.h"
-
-#include "base/android/jni_android.h"
-#include "base/android/jni_string.h"
-#include "base/test/task_environment.h"
-#include "base/uuid.h"
-#include "components/saved_tab_groups/android/tab_group_sync_conversions_utils.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace tab_groups {
-
-class TabGroupStoreMigrationUtilsTest : public testing::Test {
- public:
-  TabGroupStoreMigrationUtilsTest() = default;
-  ~TabGroupStoreMigrationUtilsTest() override = default;
-
-  void SetUp() override {
-    // Start with clean shared prefs.
-    ClearSharedPrefsForTesting();
-  }
-
-  base::test::TaskEnvironment task_environment_;
-  base::android::ScopedJavaGlobalRef<jobject> j_test_;
-};
-
-TEST_F(TabGroupStoreMigrationUtilsTest, BasicMigrationTeset) {
-  base::Uuid uuid = base::Uuid::GenerateRandomV4();
-  base::Token token = base::Token::CreateRandom();
-
-  // Initialize with one entry in the shared prefs.
-  WriteMappingToSharedPrefsForTesting(uuid, token);
-
-  // Call migration. Expect one entry in the shared prefs.
-  std::map<base::Uuid, LocalTabGroupID> map =
-      ReadAndClearIdMappingsForMigrationFromSharedPrefs();
-
-  ASSERT_EQ(1u, map.size());
-  EXPECT_EQ(uuid, map.begin()->first);
-  EXPECT_EQ(token, map.begin()->second);
-
-  // Call migration again. Expect the entry to be removed from the shared prefs
-  // and the map to be empty.
-  map = ReadAndClearIdMappingsForMigrationFromSharedPrefs();
-  ASSERT_EQ(0u, map.size());
-}
-
-}  // namespace tab_groups
diff --git a/components/saved_tab_groups/empty_tab_group_store_delegate.cc b/components/saved_tab_groups/empty_tab_group_store_delegate.cc
deleted file mode 100644
index 45b56a2..0000000
--- a/components/saved_tab_groups/empty_tab_group_store_delegate.cc
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2024 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/saved_tab_groups/empty_tab_group_store_delegate.h"
-
-#include "base/functional/bind.h"
-#include "base/functional/callback.h"
-#include "base/task/single_thread_task_runner.h"
-#include "components/saved_tab_groups/tab_group_store_delegate.h"
-
-namespace tab_groups {
-
-namespace {
-void RunCallback(TabGroupStoreDelegate::GetCallback callback) {
-  std::move(callback).Run({});
-}
-}  // namespace
-
-EmptyTabGroupStoreDelegate::EmptyTabGroupStoreDelegate() = default;
-
-EmptyTabGroupStoreDelegate::~EmptyTabGroupStoreDelegate() = default;
-
-void EmptyTabGroupStoreDelegate::GetAllTabGroupIDMetadatas(
-    TabGroupStoreDelegate::GetCallback callback) {
-  base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
-      FROM_HERE, base::BindOnce(&RunCallback, std::move(callback)));
-}
-
-void EmptyTabGroupStoreDelegate::StoreTabGroupIDMetadata(
-    const base::Uuid& sync_guid,
-    const TabGroupIDMetadata& tab_group_id_metadata) {}
-
-void EmptyTabGroupStoreDelegate::DeleteTabGroupIDMetdata(
-    const base::Uuid& sync_guid) {}
-
-}  // namespace tab_groups
diff --git a/components/saved_tab_groups/empty_tab_group_store_delegate.h b/components/saved_tab_groups/empty_tab_group_store_delegate.h
deleted file mode 100644
index 8c3e2fe0..0000000
--- a/components/saved_tab_groups/empty_tab_group_store_delegate.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2024 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_SAVED_TAB_GROUPS_EMPTY_TAB_GROUP_STORE_DELEGATE_H_
-#define COMPONENTS_SAVED_TAB_GROUPS_EMPTY_TAB_GROUP_STORE_DELEGATE_H_
-
-#include "base/functional/callback_forward.h"
-#include "base/uuid.h"
-#include "components/saved_tab_groups/tab_group_store_delegate.h"
-#include "components/saved_tab_groups/tab_group_store_id.h"
-
-namespace tab_groups {
-
-// An empty implementation of the TabGroupStoreDelegate interface.
-// The only functionality it has is to in fact invoke the `GetCallback` with an
-// empty map when `GetAllTabGroupIDMetadatas(GetCallback)` is invoked. This is
-// to ensure that initialization flows for the TabGroupStore still can work
-// correctly.
-class EmptyTabGroupStoreDelegate : public TabGroupStoreDelegate {
- public:
-  EmptyTabGroupStoreDelegate();
-  ~EmptyTabGroupStoreDelegate() override;
-
-  // Disallow copy/assign.
-  EmptyTabGroupStoreDelegate(const EmptyTabGroupStoreDelegate&) = delete;
-  EmptyTabGroupStoreDelegate& operator=(const EmptyTabGroupStoreDelegate&) =
-      delete;
-
-  // TabGroupStoreDelegate implementation.
-  void GetAllTabGroupIDMetadatas(GetCallback callback) override;
-  void StoreTabGroupIDMetadata(
-      const base::Uuid& sync_guid,
-      const TabGroupIDMetadata& tab_group_id_metadata) override;
-  void DeleteTabGroupIDMetdata(const base::Uuid& sync_guid) override;
-};
-
-}  // namespace tab_groups
-
-#endif  // COMPONENTS_SAVED_TAB_GROUPS_EMPTY_TAB_GROUP_STORE_DELEGATE_H_
diff --git a/components/saved_tab_groups/tab_group_store.cc b/components/saved_tab_groups/tab_group_store.cc
deleted file mode 100644
index f541a5db..0000000
--- a/components/saved_tab_groups/tab_group_store.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2024 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/saved_tab_groups/tab_group_store.h"
-
-#include <optional>
-
-#include "base/functional/bind.h"
-#include "base/functional/callback.h"
-#include "components/saved_tab_groups/tab_group_store_delegate.h"
-
-namespace tab_groups {
-
-TabGroupStore::TabGroupStore(std::unique_ptr<TabGroupStoreDelegate> delegate)
-    : delegate_(std::move(delegate)) {
-  CHECK(delegate_);
-}
-
-TabGroupStore::~TabGroupStore() = default;
-
-void TabGroupStore::Initialize(InitCallback init_callback) {
-  delegate_->GetAllTabGroupIDMetadatas(
-      base::BindOnce(&TabGroupStore::OnGetTabGroupIdMetadatas,
-                     weak_ptr_factory_.GetWeakPtr(), std::move(init_callback)));
-}
-
-std::map<base::Uuid, TabGroupIDMetadata>
-TabGroupStore::GetAllTabGroupIDMetadata() const {
-  return cache_;
-}
-
-std::optional<TabGroupIDMetadata> TabGroupStore::GetTabGroupIDMetadata(
-    const base::Uuid& sync_guid) const {
-  auto it = cache_.find(sync_guid);
-  if (it == cache_.end()) {
-    return std::nullopt;
-  }
-  return it->second;
-}
-
-void TabGroupStore::StoreTabGroupIDMetadata(
-    const base::Uuid& sync_guid,
-    const TabGroupIDMetadata& metadata) {
-  cache_.emplace(sync_guid, metadata);
-  delegate_->StoreTabGroupIDMetadata(sync_guid, std::move(metadata));
-}
-
-void TabGroupStore::DeleteTabGroupIDMetadata(const base::Uuid& sync_guid) {
-  cache_.erase(sync_guid);
-  delegate_->DeleteTabGroupIDMetdata(sync_guid);
-}
-
-void TabGroupStore::OnGetTabGroupIdMetadatas(
-    InitCallback init_callback,
-    std::map<base::Uuid, TabGroupIDMetadata> mappings) {
-  for (const auto& mapping : mappings) {
-    cache_.emplace(mapping);
-  }
-  std::move(init_callback).Run();
-}
-
-}  // namespace tab_groups
diff --git a/components/saved_tab_groups/tab_group_store.h b/components/saved_tab_groups/tab_group_store.h
deleted file mode 100644
index 114951a..0000000
--- a/components/saved_tab_groups/tab_group_store.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2024 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_SAVED_TAB_GROUPS_TAB_GROUP_STORE_H_
-#define COMPONENTS_SAVED_TAB_GROUPS_TAB_GROUP_STORE_H_
-
-#include <map>
-#include <optional>
-#include <vector>
-
-#include "base/functional/callback_forward.h"
-#include "base/memory/weak_ptr.h"
-#include "base/uuid.h"
-#include "components/saved_tab_groups/tab_group_store_delegate.h"
-#include "components/saved_tab_groups/tab_group_store_id.h"
-
-namespace tab_groups {
-
-// Provides an in-memory cache and persistent storage for TabGroupIDMetadata.
-class TabGroupStore {
- public:
-  // Invoked when this has been initialized and is ready to serve requests.
-  using InitCallback = base::OnceCallback<void()>;
-
-  explicit TabGroupStore(std::unique_ptr<TabGroupStoreDelegate> delegate);
-  virtual ~TabGroupStore();
-
-  // Disallow copy/assign.
-  TabGroupStore(const TabGroupStore&) = delete;
-  TabGroupStore& operator=(const TabGroupStore&) = delete;
-
-  // Uses the TabGroupStoreDelegate to fetch LocalIDs based on platform specific
-  // storage. It is required to invoke this method before accessing the data.
-  virtual void Initialize(InitCallback init_callback);
-
-  // Returns all metadata known to the store.
-  virtual std::map<base::Uuid, TabGroupIDMetadata> GetAllTabGroupIDMetadata()
-      const;
-
-  // Returns the latest cached version of the TabGroupIDMetadata for the
-  // given sync GUID if it is known, else returns `std::nullopt`.
-  virtual std::optional<TabGroupIDMetadata> GetTabGroupIDMetadata(
-      const base::Uuid& sync_guid) const;
-
-  // Stores a mapping from sync GUID to TabGroupIDMetadata. If `metadata` is
-  // empty, deletes the entry.
-  virtual void StoreTabGroupIDMetadata(const base::Uuid& sync_guid,
-                                       const TabGroupIDMetadata& metadata);
-
-  // Deletes metadata associated with the given `sync_guid`.
-  virtual void DeleteTabGroupIDMetadata(const base::Uuid& sync_guid);
-
- private:
-  // Used as a callback to results from the `TabStoreDelegate`.
-  void OnGetTabGroupIdMetadatas(
-      InitCallback init_callback,
-      std::map<base::Uuid, TabGroupIDMetadata> mappings);
-
-  // The platform specific delegate.
-  std::unique_ptr<TabGroupStoreDelegate> delegate_;
-
-  // In-memory cache of sync GUID -> TabGroupIDMetadata mapping.
-  std::map<base::Uuid, TabGroupIDMetadata> cache_;
-
-  base::WeakPtrFactory<TabGroupStore> weak_ptr_factory_{this};
-};
-
-}  // namespace tab_groups
-
-#endif  // COMPONENTS_SAVED_TAB_GROUPS_TAB_GROUP_STORE_H_
diff --git a/components/saved_tab_groups/tab_group_store_delegate.h b/components/saved_tab_groups/tab_group_store_delegate.h
deleted file mode 100644
index 74e1f6e..0000000
--- a/components/saved_tab_groups/tab_group_store_delegate.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2024 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_SAVED_TAB_GROUPS_TAB_GROUP_STORE_DELEGATE_H_
-#define COMPONENTS_SAVED_TAB_GROUPS_TAB_GROUP_STORE_DELEGATE_H_
-
-#include <map>
-
-#include "base/functional/callback_forward.h"
-#include "base/uuid.h"
-#include "components/saved_tab_groups/tab_group_store_id.h"
-
-namespace tab_groups {
-
-// A platform specific implementation for retrieving and storing sync GUID ->
-// TabGroupIDMetadata mappings.
-class TabGroupStoreDelegate {
- public:
-  // A vector of sync GUID -> TabGroupIDMetadata mappings.
-  using GetCallback =
-      base::OnceCallback<void(std::map<base::Uuid, TabGroupIDMetadata>)>;
-
-  TabGroupStoreDelegate() = default;
-  virtual ~TabGroupStoreDelegate() = default;
-
-  // Disallow copy/assign.
-  TabGroupStoreDelegate(const TabGroupStoreDelegate&) = delete;
-  TabGroupStoreDelegate& operator=(const TabGroupStoreDelegate&) = delete;
-
-  // Retrieves all stored TabGroupIDMetadata.
-  virtual void GetAllTabGroupIDMetadatas(GetCallback callback) = 0;
-
-  // Maps the sync GUID to a TabGroupIDMetadata and store this in platform
-  // specific storage. If `tab_group_id_metadata` is empty, deletes the entry.
-  virtual void StoreTabGroupIDMetadata(
-      const base::Uuid& sync_guid,
-      const TabGroupIDMetadata& tab_group_id_metadata) = 0;
-
-  // Delete metadata for a particular `sync_guid`.
-  virtual void DeleteTabGroupIDMetdata(const base::Uuid& sync_guid) = 0;
-};
-
-}  // namespace tab_groups
-
-#endif  // COMPONENTS_SAVED_TAB_GROUPS_TAB_GROUP_STORE_DELEGATE_H_
diff --git a/components/saved_tab_groups/tab_group_store_id.cc b/components/saved_tab_groups/tab_group_store_id.cc
deleted file mode 100644
index fcc6829..0000000
--- a/components/saved_tab_groups/tab_group_store_id.cc
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2024 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/saved_tab_groups/tab_group_store_id.h"
-
-#include "components/saved_tab_groups/types.h"
-
-namespace tab_groups {
-
-TabGroupIDMetadata::TabGroupIDMetadata(LocalTabGroupID tab_group_id)
-    : local_tab_group_id(tab_group_id) {}
-
-bool TabGroupIDMetadata::operator==(const TabGroupIDMetadata& other) const {
-  return local_tab_group_id == other.local_tab_group_id;
-}
-
-}  // namespace tab_groups
diff --git a/components/saved_tab_groups/tab_group_store_id.h b/components/saved_tab_groups/tab_group_store_id.h
deleted file mode 100644
index 08bd9f0..0000000
--- a/components/saved_tab_groups/tab_group_store_id.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2024 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_SAVED_TAB_GROUPS_TAB_GROUP_STORE_ID_H_
-#define COMPONENTS_SAVED_TAB_GROUPS_TAB_GROUP_STORE_ID_H_
-
-#include <stdint.h>
-
-#include "components/saved_tab_groups/types.h"
-
-namespace tab_groups {
-
-// A generic representation of Tab Group ID metadata.
-struct TabGroupIDMetadata {
- public:
-  explicit TabGroupIDMetadata(LocalTabGroupID tab_group_id);
-
-  // A local and platform specific ID for the tab group.
-  LocalTabGroupID local_tab_group_id;
-
-  bool operator==(const TabGroupIDMetadata& other) const;
-};
-
-}  // namespace tab_groups
-
-#endif  // COMPONENTS_SAVED_TAB_GROUPS_TAB_GROUP_STORE_ID_H_