[companion] Deprecate companion prefs.

The companion is deprecated and is slated for removal. This also
removes the PromoHandler since its value was simply on updating
these prefs. All references to the prefs have been removed from
the companion code.

Change-Id: I489cb81883b86cbe0e5c3f1cd20a71f1a5732ca1
Bug: b:348678854
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5973300
Commit-Queue: Juan Mojica <[email protected]>
Reviewed-by: Marc Treib <[email protected]>
Reviewed-by: Ali Stanfield <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1375412}
diff --git a/chrome/browser/companion/core/BUILD.gn b/chrome/browser/companion/core/BUILD.gn
index 8ae79f3a..381744af 100644
--- a/chrome/browser/companion/core/BUILD.gn
+++ b/chrome/browser/companion/core/BUILD.gn
@@ -12,11 +12,8 @@
     "companion_permission_utils.h",
     "companion_url_builder.cc",
     "companion_url_builder.h",
-    "constants.h",
     "features.cc",
     "features.h",
-    "promo_handler.cc",
-    "promo_handler.h",
     "signin_delegate.h",
     "utils.cc",
     "utils.h",
@@ -47,7 +44,6 @@
     "companion_url_builder_unittest.cc",
     "mock_signin_delegate.cc",
     "mock_signin_delegate.h",
-    "promo_handler_unittest.cc",
     "utils_unittest.cc",
   ]
 
diff --git a/chrome/browser/companion/core/companion_metrics_logger.cc b/chrome/browser/companion/core/companion_metrics_logger.cc
index dfdcc89..2c816d094 100644
--- a/chrome/browser/companion/core/companion_metrics_logger.cc
+++ b/chrome/browser/companion/core/companion_metrics_logger.cc
@@ -11,7 +11,6 @@
 #include "base/metrics/histogram_macros.h"
 #include "base/notreached.h"
 #include "base/strings/strcat.h"
-#include "chrome/browser/companion/core/constants.h"
 #include "chrome/browser/companion/core/features.h"
 #include "services/metrics/public/cpp/metrics_utils.h"
 #include "services/metrics/public/cpp/ukm_builders.h"
diff --git a/chrome/browser/companion/core/companion_url_builder.cc b/chrome/browser/companion/core/companion_url_builder.cc
index f25382c..c09d75bf 100644
--- a/chrome/browser/companion/core/companion_url_builder.cc
+++ b/chrome/browser/companion/core/companion_url_builder.cc
@@ -8,7 +8,6 @@
 #include "base/feature_list.h"
 #include "base/time/time.h"
 #include "chrome/browser/companion/core/companion_permission_utils.h"
-#include "chrome/browser/companion/core/constants.h"
 #include "chrome/browser/companion/core/features.h"
 #include "chrome/browser/companion/core/proto/companion_url_params.pb.h"
 #include "chrome/browser/companion/core/signin_delegate.h"
@@ -133,18 +132,12 @@
 #endif
 
   companion::proto::PromoState* promo_state = url_params.mutable_promo_state();
-  promo_state->set_signin_promo_denial_count(
-      pref_service_->GetInteger(kSigninPromoDeclinedCountPref));
-  promo_state->set_msbb_promo_denial_count(
-      pref_service_->GetInteger(kMsbbPromoDeclinedCountPref));
-  promo_state->set_exps_promo_denial_count(
-      pref_service_->GetInteger(kExpsPromoDeclinedCountPref));
-  promo_state->set_exps_promo_shown_count(
-      pref_service_->GetInteger(kExpsPromoShownCountPref));
-  promo_state->set_pco_promo_shown_count(
-      pref_service_->GetInteger(kPcoPromoShownCountPref));
-  promo_state->set_pco_promo_denial_count(
-      pref_service_->GetInteger(kPcoPromoDeclinedCountPref));
+  promo_state->set_signin_promo_denial_count(0);
+  promo_state->set_msbb_promo_denial_count(0);
+  promo_state->set_exps_promo_denial_count(0);
+  promo_state->set_exps_promo_shown_count(0);
+  promo_state->set_pco_promo_shown_count(0);
+  promo_state->set_pco_promo_denial_count(0);
 
   // Set region search IPH state.
   promo_state->set_should_show_region_search_iph(
diff --git a/chrome/browser/companion/core/companion_url_builder_unittest.cc b/chrome/browser/companion/core/companion_url_builder_unittest.cc
index 6d0ccc07..febca6d8 100644
--- a/chrome/browser/companion/core/companion_url_builder_unittest.cc
+++ b/chrome/browser/companion/core/companion_url_builder_unittest.cc
@@ -8,10 +8,8 @@
 #include "base/logging.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/test/scoped_feature_list.h"
-#include "chrome/browser/companion/core/constants.h"
 #include "chrome/browser/companion/core/features.h"
 #include "chrome/browser/companion/core/mock_signin_delegate.h"
-#include "chrome/browser/companion/core/promo_handler.h"
 #include "chrome/browser/companion/core/proto/companion_url_params.pb.h"
 #include "chrome/common/pref_names.h"
 #include "components/prefs/pref_registry_simple.h"
@@ -48,9 +46,6 @@
     pref_service_.registry()->RegisterBooleanPref(
         unified_consent::prefs::kPageContentCollectionEnabled, false);
 
-    PromoHandler::RegisterProfilePrefs(pref_service_.registry());
-
-    pref_service_.SetUserPref(kSigninPromoDeclinedCountPref, base::Value(1));
     SetSignInAndMsbbExpectations(/*is_sign_in_allowed=*/true,
                                  /*is_signed_in=*/true,
                                  /*msbb_pref_enabled=*/true);
@@ -158,11 +153,9 @@
 }
 
 TEST_F(CompanionUrlBuilderTest, MsbbAndPcOff) {
-  pref_service_.SetUserPref(kSigninPromoDeclinedCountPref, base::Value(1));
   SetSignInAndMsbbExpectations(/*is_sign_in_allowed=*/true,
                                /*is_signed_in=*/true,
                                /*msbb_pref_enabled=*/false);
-  pref_service_.SetUserPref(kSigninPromoDeclinedCountPref, base::Value(1));
 
   GURL page_url(kValidUrl);
   GURL companion_url = url_builder_->BuildCompanionURL(page_url);
@@ -200,9 +193,6 @@
 TEST_F(CompanionUrlBuilderTest, MsbbAndPcOn) {
   EXPECT_CALL(signin_delegate_, IsSignedIn())
       .WillRepeatedly(testing::Return(true));
-  pref_service_.SetUserPref(kExpsPromoShownCountPref, base::Value(3));
-  pref_service_.SetUserPref(kPcoPromoShownCountPref, base::Value(2));
-  pref_service_.SetUserPref(kPcoPromoDeclinedCountPref, base::Value(1));
   pref_service_.SetUserPref(
       unified_consent::prefs::kPageContentCollectionEnabled, base::Value(true));
 
@@ -243,12 +233,12 @@
 
   // Verify promo state.
   EXPECT_TRUE(proto.has_promo_state());
-  EXPECT_EQ(1, proto.promo_state().signin_promo_denial_count());
+  EXPECT_EQ(0, proto.promo_state().signin_promo_denial_count());
   EXPECT_EQ(0, proto.promo_state().msbb_promo_denial_count());
   EXPECT_EQ(0, proto.promo_state().exps_promo_denial_count());
-  EXPECT_EQ(3, proto.promo_state().exps_promo_shown_count());
-  EXPECT_EQ(2, proto.promo_state().pco_promo_shown_count());
-  EXPECT_EQ(1, proto.promo_state().pco_promo_denial_count());
+  EXPECT_EQ(0, proto.promo_state().exps_promo_shown_count());
+  EXPECT_EQ(0, proto.promo_state().pco_promo_shown_count());
+  EXPECT_EQ(0, proto.promo_state().pco_promo_denial_count());
   EXPECT_TRUE(proto.promo_state().should_show_region_search_iph());
 }
 
diff --git a/chrome/browser/companion/core/constants.h b/chrome/browser/companion/core/constants.h
deleted file mode 100644
index dd294746..0000000
--- a/chrome/browser/companion/core/constants.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2023 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_COMPANION_CORE_CONSTANTS_H_
-#define CHROME_BROWSER_COMPANION_CORE_CONSTANTS_H_
-
-namespace companion {
-
-// Pref names for storing various promo states.
-const char kMsbbPromoDeclinedCountPref[] =
-    "Companion.Promo.MSBB.Declined.Count";
-const char kSigninPromoDeclinedCountPref[] =
-    "Companion.Promo.Signin.Declined.Count";
-const char kExpsPromoDeclinedCountPref[] =
-    "Companion.Promo.Exps.Declined.Count";
-const char kExpsPromoShownCountPref[] = "Companion.Promo.Exps.Shown.Count";
-const char kPcoPromoShownCountPref[] = "Companion.Promo.PCO.Shown.Count";
-const char kPcoPromoDeclinedCountPref[] = "Companion.Promo.PCO.Declined.Count";
-
-// Pref name for storing experience opt-in status.
-const char kExpsOptInStatusGrantedPref[] =
-    "Companion.Exps.OptIn.Status.Granted";
-
-// Pref name used for tracking whether the user has ever successfully navigated
-// to exps registration success page.
-const char kHasNavigatedToExpsSuccessPage[] =
-    "Companion.HasNavigatedToExpsSuccessPage";
-
-}  // namespace companion
-
-#endif  // CHROME_BROWSER_COMPANION_CORE_CONSTANTS_H_
diff --git a/chrome/browser/companion/core/promo_handler.cc b/chrome/browser/companion/core/promo_handler.cc
deleted file mode 100644
index 018b63b..0000000
--- a/chrome/browser/companion/core/promo_handler.cc
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright 2023 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/companion/core/promo_handler.h"
-
-#include "base/feature_list.h"
-#include "chrome/browser/companion/core/constants.h"
-#include "chrome/browser/companion/core/features.h"
-#include "chrome/browser/companion/core/mojom/companion.mojom.h"
-#include "chrome/browser/companion/core/signin_delegate.h"
-#include "components/prefs/pref_registry_simple.h"
-#include "components/prefs/pref_service.h"
-#include "components/unified_consent/pref_names.h"
-
-namespace companion {
-
-PromoHandler::PromoHandler(PrefService* pref_service,
-                           SigninDelegate* signin_delegate)
-    : pref_service_(pref_service), signin_delegate_(signin_delegate) {}
-
-PromoHandler::~PromoHandler() = default;
-
-// static
-void PromoHandler::RegisterProfilePrefs(PrefRegistrySimple* registry) {
-  registry->RegisterIntegerPref(kMsbbPromoDeclinedCountPref, 0);
-  registry->RegisterIntegerPref(kSigninPromoDeclinedCountPref, 0);
-  registry->RegisterIntegerPref(kExpsPromoDeclinedCountPref, 0);
-  registry->RegisterIntegerPref(kExpsPromoShownCountPref, 0);
-  registry->RegisterIntegerPref(kPcoPromoShownCountPref, 0);
-  registry->RegisterIntegerPref(kPcoPromoDeclinedCountPref, 0);
-  // TODO(shaktisahu): Move the pref registration to a better location.
-  registry->RegisterBooleanPref(kExpsOptInStatusGrantedPref, false);
-  registry->RegisterBooleanPref(kHasNavigatedToExpsSuccessPage, false);
-}
-
-void PromoHandler::OnPromoAction(PromoType promo_type,
-                                 PromoAction promo_action) {
-  switch (promo_type) {
-    case PromoType::kSignin:
-      OnSigninPromo(promo_action);
-      return;
-    case PromoType::kMsbb:
-      OnMsbbPromo(promo_action);
-      return;
-    case PromoType::kExps:
-      OnExpsPromo(promo_action);
-      return;
-    case PromoType::kPco:
-      OnPcoPromo(promo_action);
-      return;
-    default:
-      return;
-  }
-}
-
-void PromoHandler::OnSigninPromo(PromoAction promo_action) {
-  switch (promo_action) {
-    case PromoAction::kRejected:
-      IncrementPref(kSigninPromoDeclinedCountPref);
-      return;
-    case PromoAction::kAccepted:
-      signin_delegate_->StartSigninFlow();
-      return;
-    default:
-      return;
-  }
-}
-
-void PromoHandler::OnMsbbPromo(PromoAction promo_action) {
-  switch (promo_action) {
-    case PromoAction::kRejected:
-      IncrementPref(kMsbbPromoDeclinedCountPref);
-      return;
-    case PromoAction::kAccepted:
-      // Turn on MSBB.
-      signin_delegate_->EnableMsbb(true);
-      return;
-    default:
-      return;
-  }
-}
-
-void PromoHandler::OnExpsPromo(PromoAction promo_action) {
-  switch (promo_action) {
-    case PromoAction::kShown:
-      IncrementPref(kExpsPromoShownCountPref);
-      return;
-    case PromoAction::kRejected:
-      IncrementPref(kExpsPromoDeclinedCountPref);
-      return;
-    default:
-      return;
-  }
-}
-
-void PromoHandler::OnPcoPromo(PromoAction promo_action) {
-  switch (promo_action) {
-    case PromoAction::kShown:
-      IncrementPref(kPcoPromoShownCountPref);
-      return;
-    case PromoAction::kRejected:
-      IncrementPref(kPcoPromoDeclinedCountPref);
-      return;
-    case PromoAction::kAccepted:
-      // The promo shouldn't be shown unless the user has this feature enabled.
-      // But since this relies on google3 code, it's safer to use guard instead
-      // of `CHECK` and crash.
-      if (base::FeatureList::IsEnabled(features::kCompanionEnablePageContent)) {
-        pref_service_->SetBoolean(
-            unified_consent::prefs::kPageContentCollectionEnabled, true);
-      }
-      return;
-  }
-}
-
-void PromoHandler::IncrementPref(const std::string& pref_name) {
-  int current_val = pref_service_->GetInteger(pref_name);
-  pref_service_->SetInteger(pref_name, current_val + 1);
-}
-
-}  // namespace companion
diff --git a/chrome/browser/companion/core/promo_handler.h b/chrome/browser/companion/core/promo_handler.h
deleted file mode 100644
index afb12c6..0000000
--- a/chrome/browser/companion/core/promo_handler.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2023 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_COMPANION_CORE_PROMO_HANDLER_H_
-#define CHROME_BROWSER_COMPANION_CORE_PROMO_HANDLER_H_
-
-#include <memory>
-#include <string>
-
-#include "base/functional/callback.h"
-#include "base/memory/raw_ptr.h"
-#include "chrome/browser/companion/core/mojom/companion.mojom.h"
-
-class PrefRegistrySimple;
-class PrefService;
-
-namespace companion {
-using side_panel::mojom::PromoAction;
-using side_panel::mojom::PromoType;
-
-class SigninDelegate;
-
-// Central class to handle user actions on various promos displayed in the
-// search companion.
-class PromoHandler {
- public:
-  PromoHandler(PrefService* pref_service, SigninDelegate* signin_delegate);
-  ~PromoHandler();
-
-  // Disallow copy/assign.
-  PromoHandler(const PromoHandler&) = delete;
-  PromoHandler& operator=(const PromoHandler&) = delete;
-
-  // Registers preferences used by this class in the provided |registry|.  This
-  // should be called for the Profile registry.
-  static void RegisterProfilePrefs(PrefRegistrySimple* registry);
-
-  // Called in response to the mojo call from renderer. Takes necessary action
-  // to handle the user action on the promo.
-  void OnPromoAction(PromoType promo_type, PromoAction promo_action);
-
- private:
-  void OnSigninPromo(PromoAction promo_action);
-  void OnMsbbPromo(PromoAction promo_action);
-  void OnExpsPromo(PromoAction promo_action);
-  void OnPcoPromo(PromoAction promo_action);
-  void IncrementPref(const std::string& pref_name);
-
-  // Lifetime of the PrefService is bound to profile which outlives the lifetime
-  // of the companion page.
-  raw_ptr<PrefService> pref_service_;
-
-  // Delegate to handle promo acceptance flow.
-  raw_ptr<SigninDelegate> signin_delegate_;
-};
-
-}  // namespace companion
-
-#endif  // CHROME_BROWSER_COMPANION_CORE_PROMO_HANDLER_H_
diff --git a/chrome/browser/companion/core/promo_handler_unittest.cc b/chrome/browser/companion/core/promo_handler_unittest.cc
deleted file mode 100644
index d19678f..0000000
--- a/chrome/browser/companion/core/promo_handler_unittest.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2023 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/companion/core/promo_handler.h"
-
-#include "chrome/browser/companion/core/constants.h"
-#include "chrome/browser/companion/core/mock_signin_delegate.h"
-#include "chrome/browser/companion/core/mojom/companion.mojom.h"
-#include "components/prefs/pref_registry_simple.h"
-#include "components/prefs/testing_pref_service.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace companion {
-
-class PromoHandlerTest : public testing::Test {
- public:
-  PromoHandlerTest() = default;
-  ~PromoHandlerTest() override = default;
-
-  void SetUp() override {
-    PromoHandler::RegisterProfilePrefs(pref_service_.registry());
-    promo_handler_ =
-        std::make_unique<PromoHandler>(&pref_service_, &signin_delegate_);
-  }
-
- protected:
-  TestingPrefServiceSimple pref_service_;
-  MockSigninDelegate signin_delegate_;
-  std::unique_ptr<PromoHandler> promo_handler_;
-};
-
-TEST_F(PromoHandlerTest, MsbbPromo) {
-  promo_handler_->OnPromoAction(PromoType::kMsbb, PromoAction::kRejected);
-  EXPECT_EQ(1, pref_service_.GetInteger(kMsbbPromoDeclinedCountPref));
-
-  EXPECT_CALL(signin_delegate_, EnableMsbb(true)).Times(1);
-  promo_handler_->OnPromoAction(PromoType::kMsbb, PromoAction::kAccepted);
-}
-
-TEST_F(PromoHandlerTest, SigninPromo) {
-  promo_handler_->OnPromoAction(PromoType::kSignin, PromoAction::kRejected);
-  EXPECT_EQ(1, pref_service_.GetInteger(kSigninPromoDeclinedCountPref));
-
-  EXPECT_CALL(signin_delegate_, StartSigninFlow()).Times(1);
-  promo_handler_->OnPromoAction(PromoType::kSignin, PromoAction::kAccepted);
-}
-
-TEST_F(PromoHandlerTest, ExpsPromo) {
-  promo_handler_->OnPromoAction(PromoType::kExps, PromoAction::kShown);
-  EXPECT_EQ(1, pref_service_.GetInteger(kExpsPromoShownCountPref));
-
-  promo_handler_->OnPromoAction(PromoType::kExps, PromoAction::kRejected);
-  EXPECT_EQ(1, pref_service_.GetInteger(kExpsPromoDeclinedCountPref));
-}
-
-TEST_F(PromoHandlerTest, PcoPromo) {
-  promo_handler_->OnPromoAction(PromoType::kPco, PromoAction::kShown);
-  EXPECT_EQ(1, pref_service_.GetInteger(kPcoPromoShownCountPref));
-
-  promo_handler_->OnPromoAction(PromoType::kPco, PromoAction::kRejected);
-  EXPECT_EQ(1, pref_service_.GetInteger(kPcoPromoDeclinedCountPref));
-}
-
-}  // namespace companion
diff --git a/chrome/browser/companion/core/utils.cc b/chrome/browser/companion/core/utils.cc
index 55994f8c..029a0c1a 100644
--- a/chrome/browser/companion/core/utils.cc
+++ b/chrome/browser/companion/core/utils.cc
@@ -7,7 +7,6 @@
 #include <string_view>
 
 #include "base/containers/fixed_flat_set.h"
-#include "chrome/browser/companion/core/constants.h"
 #include "chrome/browser/companion/core/features.h"
 #include "net/base/url_util.h"
 
diff --git a/chrome/browser/companion/core/utils_unittest.cc b/chrome/browser/companion/core/utils_unittest.cc
index 0d2eaad..31eb80b 100644
--- a/chrome/browser/companion/core/utils_unittest.cc
+++ b/chrome/browser/companion/core/utils_unittest.cc
@@ -5,7 +5,6 @@
 #include "chrome/browser/companion/core/utils.h"
 
 #include "base/test/scoped_feature_list.h"
-#include "chrome/browser/companion/core/constants.h"
 #include "chrome/browser/companion/core/features.h"
 #include "content/public/test/test_utils.h"
 #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/prefs/BUILD.gn b/chrome/browser/prefs/BUILD.gn
index 67b889e..a10e75d 100644
--- a/chrome/browser/prefs/BUILD.gn
+++ b/chrome/browser/prefs/BUILD.gn
@@ -260,7 +260,6 @@
     ]
   } else {
     deps += [
-      "//chrome/browser/companion/core",
       "//chrome/browser/on_device_translation:prefs",
       "//chrome/browser/promos:utils",
       "//chrome/browser/screen_ai:prefs",
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 9217bed..ffbebb9 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -269,7 +269,6 @@
 #include "components/webapps/browser/android/install_prompt_prefs.h"
 #else  // BUILDFLAG(IS_ANDROID)
 #include "chrome/browser/cart/cart_service.h"
-#include "chrome/browser/companion/core/promo_handler.h"
 #include "chrome/browser/device_api/device_service_impl.h"
 #include "chrome/browser/gcm/gcm_product_util.h"
 #include "chrome/browser/hid/hid_policy_allowed_devices.h"
@@ -1132,6 +1131,26 @@
 inline constexpr char kFirstTimeInterstitialBannerState[] =
     "profile.managed.banner_state";
 
+// Deprecated 10/2024
+inline constexpr char kSidePanelCompanionEntryPinnedToToolbar[] =
+    "side_panel.companion_pinned_to_toolbar";
+inline constexpr char kMsbbPromoDeclinedCountPref[] =
+    "Companion.Promo.MSBB.Declined.Count";
+inline constexpr char kSigninPromoDeclinedCountPref[] =
+    "Companion.Promo.Signin.Declined.Count";
+inline constexpr char kExpsPromoDeclinedCountPref[] =
+    "Companion.Promo.Exps.Declined.Count";
+inline constexpr char kExpsPromoShownCountPref[] =
+    "Companion.Promo.Exps.Shown.Count";
+inline constexpr char kPcoPromoShownCountPref[] =
+    "Companion.Promo.PCO.Shown.Count";
+inline constexpr char kPcoPromoDeclinedCountPref[] =
+    "Companion.Promo.PCO.Declined.Count";
+inline constexpr char kExpsOptInStatusGrantedPref[] =
+    "Companion.Exps.OptIn.Status.Granted";
+inline constexpr char kHasNavigatedToExpsSuccessPage[] =
+    "Companion.HasNavigatedToExpsSuccessPage";
+
 // Register local state used only for migration (clearing or moving to a new
 // key).
 void RegisterLocalStatePrefsForMigration(PrefRegistrySimple* registry) {
@@ -1601,6 +1620,17 @@
 
   // Deprecated 10/2024
   registry->RegisterIntegerPref(kFirstTimeInterstitialBannerState, 0);
+
+  // Deprecated 10/2024
+  registry->RegisterBooleanPref(kSidePanelCompanionEntryPinnedToToolbar, false);
+  registry->RegisterIntegerPref(kMsbbPromoDeclinedCountPref, 0);
+  registry->RegisterIntegerPref(kSigninPromoDeclinedCountPref, 0);
+  registry->RegisterIntegerPref(kExpsPromoDeclinedCountPref, 0);
+  registry->RegisterIntegerPref(kExpsPromoShownCountPref, 0);
+  registry->RegisterIntegerPref(kPcoPromoShownCountPref, 0);
+  registry->RegisterIntegerPref(kPcoPromoDeclinedCountPref, 0);
+  registry->RegisterBooleanPref(kExpsOptInStatusGrantedPref, false);
+  registry->RegisterBooleanPref(kHasNavigatedToExpsSuccessPage, false);
 }
 
 void ClearSyncRequestedPrefAndMaybeMigrate(PrefService* profile_prefs) {
@@ -2109,7 +2139,6 @@
   CartService::RegisterProfilePrefs(registry);
   ChromeAuthenticatorRequestDelegate::RegisterProfilePrefs(registry);
   commerce::CommerceUiTabHelper::RegisterProfilePrefs(registry);
-  companion::PromoHandler::RegisterProfilePrefs(registry);
   DeviceServiceImpl::RegisterProfilePrefs(registry);
   DevToolsWindow::RegisterProfilePrefs(registry);
   DriveService::RegisterProfilePrefs(registry);
@@ -2957,6 +2986,17 @@
   // Added 10/2024
   profile_prefs->ClearPref(kFirstTimeInterstitialBannerState);
 
+  // Added 10/2024
+  profile_prefs->ClearPref(kSidePanelCompanionEntryPinnedToToolbar);
+  profile_prefs->ClearPref(kMsbbPromoDeclinedCountPref);
+  profile_prefs->ClearPref(kSigninPromoDeclinedCountPref);
+  profile_prefs->ClearPref(kExpsPromoDeclinedCountPref);
+  profile_prefs->ClearPref(kExpsPromoShownCountPref);
+  profile_prefs->ClearPref(kPcoPromoShownCountPref);
+  profile_prefs->ClearPref(kPcoPromoDeclinedCountPref);
+  profile_prefs->ClearPref(kExpsOptInStatusGrantedPref);
+  profile_prefs->ClearPref(kHasNavigatedToExpsSuccessPage);
+
   // Please don't delete the following line. It is used by PRESUBMIT.py.
   // END_MIGRATE_OBSOLETE_PROFILE_PREFS
 
diff --git a/chrome/browser/ui/views/side_panel/companion/companion_utils.cc b/chrome/browser/ui/views/side_panel/companion/companion_utils.cc
index cd08a54..5dd6cb8 100644
--- a/chrome/browser/ui/views/side_panel/companion/companion_utils.cc
+++ b/chrome/browser/ui/views/side_panel/companion/companion_utils.cc
@@ -7,7 +7,6 @@
 #include "base/feature_list.h"
 #include "base/metrics/histogram_functions.h"
 #include "build/chromeos_buildflags.h"
-#include "chrome/browser/companion/core/constants.h"
 #include "chrome/browser/companion/core/features.h"
 #include "chrome/browser/companion/core/utils.h"
 #include "chrome/browser/profiles/profile.h"
@@ -100,24 +99,6 @@
   }
 
   if (include_runtime_checks) {
-    // If `kSidePanelCompanion` and `kSidePanelCompanion2` are disabled, then
-    // `kCompanionEnabledByObservingExpsNavigations` must be enabled and pref
-    // must be set to true.
-    if (!base::FeatureList::IsEnabled(
-            features::internal::kSidePanelCompanion) &&
-        !base::FeatureList::IsEnabled(
-            features::internal::kSidePanelCompanion2)) {
-      CHECK(base::FeatureList::IsEnabled(
-          features::internal::kCompanionEnabledByObservingExpsNavigations));
-      base::UmaHistogramBoolean(
-          "Companion.HasNavigatedToExpsSuccessPagePref.Status",
-          profile->GetPrefs()->GetBoolean(
-              companion::kHasNavigatedToExpsSuccessPage));
-      if (!profile->GetPrefs()->GetBoolean(kHasNavigatedToExpsSuccessPage)) {
-        return false;
-      }
-    }
-
     return search::DefaultSearchProviderIsGoogle(profile) &&
            IsCompanionFeatureEnabledByPolicy(profile->GetPrefs());
   }
diff --git a/chrome/browser/ui/views/side_panel/companion/exps_registration_success_observer.cc b/chrome/browser/ui/views/side_panel/companion/exps_registration_success_observer.cc
index 18f9531..f6477e8 100644
--- a/chrome/browser/ui/views/side_panel/companion/exps_registration_success_observer.cc
+++ b/chrome/browser/ui/views/side_panel/companion/exps_registration_success_observer.cc
@@ -6,7 +6,6 @@
 
 #include "base/strings/string_split.h"
 #include "base/strings/string_util.h"
-#include "chrome/browser/companion/core/constants.h"
 #include "chrome/browser/companion/core/features.h"
 #include "chrome/browser/companion/core/utils.h"
 #include "chrome/browser/profiles/profile.h"
@@ -44,22 +43,7 @@
 ExpsRegistrationSuccessObserver::~ExpsRegistrationSuccessObserver() = default;
 
 void ExpsRegistrationSuccessObserver::PrimaryPageChanged(content::Page& page) {
-  if (!web_contents() || !pref_service()) {
-    return;
-  }
-
-  if (pref_service()->GetBoolean(kHasNavigatedToExpsSuccessPage)) {
-    return;
-  }
-
-  const GURL& url = page.GetMainDocument().GetLastCommittedURL();
-  if (!DoesUrlMatchPatternsInList(url,
-                                  exps_registration_success_url_patterns_)) {
-    return;
-  }
-
-  // Save the status to a pref.
-  pref_service()->SetBoolean(kHasNavigatedToExpsSuccessPage, true);
+  // TODO(crbug.com/348678854): Remove this when removing all companion code.
 }
 
 PrefService* ExpsRegistrationSuccessObserver::pref_service() {
diff --git a/chrome/browser/ui/views/side_panel/companion/exps_registration_success_observer_unittest.cc b/chrome/browser/ui/views/side_panel/companion/exps_registration_success_observer_unittest.cc
index 38a3635..754e676 100644
--- a/chrome/browser/ui/views/side_panel/companion/exps_registration_success_observer_unittest.cc
+++ b/chrome/browser/ui/views/side_panel/companion/exps_registration_success_observer_unittest.cc
@@ -14,7 +14,6 @@
 #include "base/strings/strcat.h"
 #include "base/task/sequenced_task_runner.h"
 #include "base/test/scoped_feature_list.h"
-#include "chrome/browser/companion/core/constants.h"
 #include "chrome/browser/companion/core/features.h"
 #include "chrome/common/pref_names.h"
 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
@@ -36,7 +35,6 @@
 using ::testing::NiceMock;
 using ::testing::Return;
 
-constexpr char kDefaultUrl[] = "http://example.com";
 constexpr char kBlocklistedUrl[] = "https://labs.google.com/search";
 constexpr char kBlocklistedUrl2[] = "https://labs.google.com/search/playground";
 constexpr char kExpsRegistationSuccessUrl[] = "https://labs.google.com/search";
@@ -70,13 +68,6 @@
         .WillRepeatedly(testing::Return(true));
   }
 
-  void SetPrefValues(bool exps_granted, bool has_seen_success_page) {
-    pref_service_.registry()->RegisterBooleanPref(
-        companion::kExpsOptInStatusGrantedPref, exps_granted);
-    pref_service_.registry()->RegisterBooleanPref(
-        companion::kHasNavigatedToExpsSuccessPage, has_seen_success_page);
-  }
-
   void SetUpFeatureList() {
     base::FieldTrialParams enabled_params;
     enabled_params["exps-registration-success-page-urls"] =
@@ -101,32 +92,6 @@
 
 }  // namespace
 
-TEST_F(ExpsRegistrationSuccessObserverTest,
-       ExpsRegistrationSuccessUpdatesThePref) {
-  SetUpFeatureList();
-  SetPrefValues(/*exps_granted=*/false,
-                /*has_seen_success_page=*/false);
-  SetupExpsObserver();
-
-  NavigateAndCommit(GURL(kExpsRegistationSuccessUrl));
-
-  EXPECT_TRUE(
-      pref_service_.GetBoolean(companion::kHasNavigatedToExpsSuccessPage));
-}
-
-TEST_F(ExpsRegistrationSuccessObserverTest,
-       RandomUrlDoesntUpdateExpsRegistrationPref) {
-  SetUpFeatureList();
-  SetPrefValues(/*exps_granted=*/false,
-                /*has_seen_success_page=*/false);
-  SetupExpsObserver();
-
-  NavigateAndCommit(GURL(kDefaultUrl));
-
-  EXPECT_FALSE(
-      pref_service_.GetBoolean(companion::kHasNavigatedToExpsSuccessPage));
-}
-
 TEST_F(ExpsRegistrationSuccessObserverTest, MatchURL) {
   SetupExpsObserver();
 
diff --git a/chrome/browser/ui/views/side_panel/lens/lens_core_tab_side_panel_helper.cc b/chrome/browser/ui/views/side_panel/lens/lens_core_tab_side_panel_helper.cc
index ff05001b..9980929c 100644
--- a/chrome/browser/ui/views/side_panel/lens/lens_core_tab_side_panel_helper.cc
+++ b/chrome/browser/ui/views/side_panel/lens/lens_core_tab_side_panel_helper.cc
@@ -4,7 +4,6 @@
 
 #include "chrome/browser/ui/views/side_panel/lens/lens_core_tab_side_panel_helper.h"
 
-#include "chrome/browser/companion/core/constants.h"
 #include "chrome/browser/companion/core/features.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/search_engines/template_url_service_factory.h"
diff --git a/chrome/browser/ui/views/side_panel/search_companion/search_companion_side_panel_coordinator.cc b/chrome/browser/ui/views/side_panel/search_companion/search_companion_side_panel_coordinator.cc
index ee5c51d..f08976a 100644
--- a/chrome/browser/ui/views/side_panel/search_companion/search_companion_side_panel_coordinator.cc
+++ b/chrome/browser/ui/views/side_panel/search_companion/search_companion_side_panel_coordinator.cc
@@ -9,7 +9,6 @@
 #include "base/metrics/histogram.h"
 #include "base/metrics/histogram_functions.h"
 #include "chrome/app/vector_icons/vector_icons.h"
-#include "chrome/browser/companion/core/constants.h"
 #include "chrome/browser/companion/core/features.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/search/search.h"
@@ -88,18 +87,6 @@
       base::BindRepeating(
           &SearchCompanionSidePanelCoordinator::OnPolicyPrefChanged,
           base::Unretained(this)));
-
-  if (base::FeatureList::IsEnabled(
-          companion::features::internal::
-              kCompanionEnabledByObservingExpsNavigations)) {
-    exps_optin_pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>();
-    exps_optin_pref_change_registrar_->Init(pref_service_);
-    exps_optin_pref_change_registrar_->Add(
-        companion::kHasNavigatedToExpsSuccessPage,
-        base::BindRepeating(
-            &SearchCompanionSidePanelCoordinator::OnExpsPolicyPrefChanged,
-            base::Unretained(this)));
-  }
 }
 
 SearchCompanionSidePanelCoordinator::~SearchCompanionSidePanelCoordinator() =
@@ -286,9 +273,6 @@
   if (!pref_service_) {
     return;
   }
-  base::UmaHistogramBoolean(
-      "Companion.HasNavigatedToExpsSuccessPagePref.OnChanged",
-      pref_service_->GetBoolean(companion::kHasNavigatedToExpsSuccessPage));
 
   UpdateCompanionAvailabilityInSidePanel();
 
diff --git a/chrome/browser/ui/views/side_panel/side_panel_prefs.cc b/chrome/browser/ui/views/side_panel/side_panel_prefs.cc
index 98e9216..c2b67ba 100644
--- a/chrome/browser/ui/views/side_panel/side_panel_prefs.cc
+++ b/chrome/browser/ui/views/side_panel/side_panel_prefs.cc
@@ -5,8 +5,6 @@
 #include "chrome/browser/ui/views/side_panel/side_panel_prefs.h"
 #include "base/feature_list.h"
 #include "base/i18n/rtl.h"
-#include "chrome/browser/companion/core/features.h"
-#include "chrome/browser/ui/views/side_panel/companion/companion_utils.h"
 #include "chrome/browser/ui/ui_features.h"
 #include "chrome/common/pref_names.h"
 #include "components/pref_registry/pref_registry_syncable.h"
@@ -21,13 +19,6 @@
   // replace false and true respectively.
   registry->RegisterBooleanPref(prefs::kSidePanelHorizontalAlignment,
                                 !base::i18n::IsRTL());
-  if (companion::IsCompanionFeatureEnabled()) {
-    registry->RegisterBooleanPref(
-        prefs::kSidePanelCompanionEntryPinnedToToolbar,
-        base::FeatureList::IsEnabled(
-            features::kSidePanelCompanionDefaultPinned),
-        user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
-  }
   registry->RegisterBooleanPref(prefs::kGoogleSearchSidePanelEnabled, true);
   registry->RegisterDictionaryPref(prefs::kSidePanelIdToWidth);
 }
diff --git a/chrome/browser/ui/webui/side_panel/companion/companion_page_handler.cc b/chrome/browser/ui/webui/side_panel/companion/companion_page_handler.cc
index a9da285..3f83ab8 100644
--- a/chrome/browser/ui/webui/side_panel/companion/companion_page_handler.cc
+++ b/chrome/browser/ui/webui/side_panel/companion/companion_page_handler.cc
@@ -11,7 +11,6 @@
 #include "chrome/browser/companion/core/companion_permission_utils.h"
 #include "chrome/browser/companion/core/companion_url_builder.h"
 #include "chrome/browser/companion/core/features.h"
-#include "chrome/browser/companion/core/promo_handler.h"
 #include "chrome/browser/companion/core/utils.h"
 #include "chrome/browser/companion/text_finder/text_finder_manager.h"
 #include "chrome/browser/companion/text_finder/text_highlighter_manager.h"
@@ -62,8 +61,6 @@
       url_builder_(
           std::make_unique<CompanionUrlBuilder>(GetProfile()->GetPrefs(),
                                                 signin_delegate_.get())),
-      promo_handler_(std::make_unique<PromoHandler>(GetProfile()->GetPrefs(),
-                                                    signin_delegate_.get())),
       consent_helper_(unified_consent::UrlKeyedDataCollectionConsentHelper::
                           NewAnonymizedDataCollectionConsentHelper(
                               GetProfile()->GetPrefs())) {
@@ -324,7 +321,6 @@
     return;
   }
 
-  promo_handler_->OnPromoAction(promo_type, promo_action);
   metrics_logger_->OnPromoAction(promo_type, promo_action);
 }
 
@@ -343,8 +339,6 @@
 
 void CompanionPageHandler::OnExpsOptInStatusAvailable(bool is_exps_opted_in) {
   metrics_logger_->OnExpsOptInStatusAvailable(is_exps_opted_in);
-  auto* pref_service = GetProfile()->GetPrefs();
-  pref_service->SetBoolean(kExpsOptInStatusGrantedPref, is_exps_opted_in);
   // Update default value for pref indicating whether companion should be
   // pinned to the toolbar.
   companion::UpdateCompanionDefaultPinnedToToolbarState(GetProfile());
diff --git a/chrome/browser/ui/webui/side_panel/companion/companion_page_handler.h b/chrome/browser/ui/webui/side_panel/companion/companion_page_handler.h
index 2105681..47ffceb 100644
--- a/chrome/browser/ui/webui/side_panel/companion/companion_page_handler.h
+++ b/chrome/browser/ui/webui/side_panel/companion/companion_page_handler.h
@@ -10,7 +10,6 @@
 #include "base/metrics/histogram_functions.h"
 #include "base/scoped_observation.h"
 #include "chrome/browser/companion/core/companion_metrics_logger.h"
-#include "chrome/browser/companion/core/constants.h"
 #include "chrome/browser/companion/core/mojom/companion.mojom.h"
 #include "chrome/browser/ui/views/side_panel/side_panel_enums.h"
 #include "components/lens/buildflags.h"
@@ -31,7 +30,6 @@
 namespace companion {
 class CompanionMetricsLogger;
 class CompanionUrlBuilder;
-class PromoHandler;
 class SigninDelegate;
 
 class CompanionPageHandler
@@ -145,7 +143,6 @@
   raw_ptr<CompanionSidePanelUntrustedUI> companion_untrusted_ui_ = nullptr;
   std::unique_ptr<SigninDelegate> signin_delegate_;
   std::unique_ptr<CompanionUrlBuilder> url_builder_;
-  std::unique_ptr<PromoHandler> promo_handler_;
   std::unique_ptr<unified_consent::UrlKeyedDataCollectionConsentHelper>
       consent_helper_;