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.
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
@@ -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<BraveOriginState> 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_;
|
||||
}
|
||||
@@ -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_
|
||||
Reference in New Issue
Block a user