From c72ff2f4b6af275eea5d7bf313cbfb5486152ce2 Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Tue, 9 Sep 2025 17:09:02 -0400 Subject: [PATCH] Remove old Brave Origin State code (#31116) This is in preparation for re-adding it as a Keyed Service This is to keep the PR size smaller for the next work to land. --- browser/brave_browser_process_impl.cc | 6 ---- components/brave_origin/BUILD.gn | 5 --- components/brave_origin/brave_origin_state.cc | 35 ------------------- components/brave_origin/brave_origin_state.h | 32 ----------------- 4 files changed, 78 deletions(-) delete mode 100644 components/brave_origin/brave_origin_state.cc delete mode 100644 components/brave_origin/brave_origin_state.h diff --git a/browser/brave_browser_process_impl.cc b/browser/brave_browser_process_impl.cc index b108431346a..1a233e48303 100644 --- a/browser/brave_browser_process_impl.cc +++ b/browser/brave_browser_process_impl.cc @@ -30,7 +30,6 @@ #include "brave/components/brave_ads/browser/component_updater/resource_component.h" #include "brave/components/brave_component_updater/browser/brave_component_updater_delegate.h" #include "brave/components/brave_component_updater/browser/local_data_files_service.h" -#include "brave/components/brave_origin/brave_origin_state.h" #include "brave/components/brave_referrals/browser/brave_referrals_service.h" #include "brave/components/brave_shields/content/browser/ad_block_service.h" #include "brave/components/brave_shields/content/browser/ad_block_subscription_service_manager.h" @@ -153,11 +152,6 @@ BraveBrowserProcessImpl::BraveBrowserProcessImpl(StartupData* startup_data) void BraveBrowserProcessImpl::Init() { BrowserProcessImpl::Init(); - // Initialize the Brave Origin state once in the browser process only - // This must be done early but only in the browser process, not child - // processes - BraveOriginState::GetInstance()->Initialize(); - UpdateBraveDarkMode(); pref_change_registrar_.Add( kBraveDarkMode, diff --git a/components/brave_origin/BUILD.gn b/components/brave_origin/BUILD.gn index 42daa37501c..481314dd6ae 100644 --- a/components/brave_origin/BUILD.gn +++ b/components/brave_origin/BUILD.gn @@ -3,13 +3,8 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at https://mozilla.org/MPL/2.0/. -import("//brave/components/brave_wayback_machine/buildflags/buildflags.gni") -import("//brave/components/speedreader/common/buildflags/buildflags.gni") - source_set("brave_origin") { sources = [ - "brave_origin_state.cc", - "brave_origin_state.h", "features.cc", "features.h", ] diff --git a/components/brave_origin/brave_origin_state.cc b/components/brave_origin/brave_origin_state.cc deleted file mode 100644 index ff8c9b92533..00000000000 --- a/components/brave_origin/brave_origin_state.cc +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (c) 2025 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. */ - -#include "brave/components/brave_origin/brave_origin_state.h" - -#include "base/logging.h" -#include "base/no_destructor.h" -#include "brave/components/brave_origin/features.h" - -BraveOriginState::BraveOriginState() - : is_brave_origin_user_(false), initialized_(false) {} - -BraveOriginState::~BraveOriginState() = default; - -BraveOriginState* BraveOriginState::GetInstance() { - static base::NoDestructor instance; - return instance.get(); -} - -void BraveOriginState::Initialize() { - // TODO(https://github.com/brave/brave-browser/issues/47463) - // Get the actual purchase state from SKU service. - is_brave_origin_user_ = - base::FeatureList::IsEnabled(brave_origin::features::kBraveOrigin); - initialized_ = true; -} - -bool BraveOriginState::IsBraveOriginUser() const { - if (!initialized_) { - return false; - } - return is_brave_origin_user_; -} diff --git a/components/brave_origin/brave_origin_state.h b/components/brave_origin/brave_origin_state.h deleted file mode 100644 index 136daf94ba6..00000000000 --- a/components/brave_origin/brave_origin_state.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (c) 2025 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. */ - -#ifndef BRAVE_COMPONENTS_BRAVE_ORIGIN_BRAVE_ORIGIN_STATE_H_ -#define BRAVE_COMPONENTS_BRAVE_ORIGIN_BRAVE_ORIGIN_STATE_H_ - -#include "base/files/file_path.h" -#include "base/values.h" - -class BraveOriginState { - public: - BraveOriginState(); - static BraveOriginState* GetInstance(); - - // Initialize the Brave Origin state. - // Should be called once during browser startup. - void Initialize(); - - // Returns true if the user is considered a Brave Origin user. - // Must be called after Initialize(). - bool IsBraveOriginUser() const; - - private: - ~BraveOriginState(); - - bool is_brave_origin_user_; - bool initialized_; -}; - -#endif // BRAVE_COMPONENTS_BRAVE_ORIGIN_BRAVE_ORIGIN_STATE_H_