To add a new BraveVpnService implementation based on Architecture 2.0, which must co-exist with Architecture 1.0 for quite a while, we need to split service's interface and implementation. All the external components will keep accessing VPN service via the BraveVpnService interface, but the implementation mostly goes into BraveVpnServiceImpl. This change revisits the approach how Brave VPN is enabled in GN. New flags are introduced: enable_brave_vpn_v1 and enable_brave_vpn_v2. Currently, only V1 architecture is implemented, hence, the GN flag enable_brave_vpn_v1 is enabled by default, and enable_brave_vpn_v2 is disabled by default. enable_brave_vpn becomes a dependent flag: it is enabled when either enable_brave_vpn_v1, or enable_brave_vpn_v2, or both are enabled. Implements part of https://github.com/brave/brave-browser/issues/54597
138 lines
4.3 KiB
C++
138 lines
4.3 KiB
C++
/* Copyright (c) 2021 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 http://mozilla.org/MPL/2.0/. */
|
|
|
|
// This interface is for managing the global services of the application. Each
|
|
// service is lazily created when requested the first time. The service getters
|
|
// will return NULL if the service is not available, so callers must check for
|
|
// this condition.
|
|
|
|
#ifndef BRAVE_BROWSER_BRAVE_BROWSER_PROCESS_H_
|
|
#define BRAVE_BROWSER_BRAVE_BROWSER_PROCESS_H_
|
|
|
|
#include "brave/browser/brave_stats/buildflags.h"
|
|
#include "brave/components/brave_ads/buildflags/buildflags.h"
|
|
#include "brave/components/brave_vpn/common/buildflags/buildflags.h"
|
|
#include "brave/components/request_otr/common/buildflags/buildflags.h"
|
|
#include "brave/components/speedreader/common/buildflags/buildflags.h"
|
|
#include "brave/components/tor/buildflags/buildflags.h"
|
|
#include "build/build_config.h"
|
|
#include "extensions/buildflags/buildflags.h"
|
|
|
|
namespace brave {
|
|
class BraveReferralsService;
|
|
class URLSanitizerComponentInstaller;
|
|
} // namespace brave
|
|
|
|
#if BUILDFLAG(ENABLE_BRAVE_VPN_V1)
|
|
namespace brave_vpn {
|
|
class BraveVPNConnectionManager;
|
|
} // namespace brave_vpn
|
|
#endif
|
|
|
|
namespace brave_component_updater {
|
|
class LocalDataFilesService;
|
|
} // namespace brave_component_updater
|
|
|
|
namespace brave_shields {
|
|
class AdBlockService;
|
|
} // namespace brave_shields
|
|
|
|
#if BUILDFLAG(ENABLE_BRAVE_STATS_UPDATER)
|
|
namespace brave_stats {
|
|
class BraveStatsUpdater;
|
|
} // namespace brave_stats
|
|
#endif
|
|
|
|
namespace debounce {
|
|
class DebounceComponentInstaller;
|
|
} // namespace debounce
|
|
|
|
namespace https_upgrade_exceptions {
|
|
class HttpsUpgradeExceptionsService;
|
|
} // namespace https_upgrade_exceptions
|
|
|
|
namespace misc_metrics {
|
|
class ProcessMiscMetrics;
|
|
} // namespace misc_metrics
|
|
|
|
namespace request_otr {
|
|
#if BUILDFLAG(ENABLE_REQUEST_OTR)
|
|
class RequestOTRComponentInstallerPolicy;
|
|
#endif
|
|
} // namespace request_otr
|
|
|
|
namespace ntp_background_images {
|
|
class NTPBackgroundImagesService;
|
|
} // namespace ntp_background_images
|
|
|
|
namespace p3a {
|
|
class P3AService;
|
|
} // namespace p3a
|
|
|
|
namespace tor {
|
|
class BraveTorClientUpdater;
|
|
class BraveTorPluggableTransportUpdater;
|
|
} // namespace tor
|
|
|
|
namespace speedreader {
|
|
class SpeedreaderRewriterService;
|
|
}
|
|
|
|
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
|
namespace brave_ads {
|
|
class BraveStatsHelper;
|
|
class ResourceComponent;
|
|
} // namespace brave_ads
|
|
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
|
|
|
class BraveBrowserProcess {
|
|
public:
|
|
BraveBrowserProcess();
|
|
virtual ~BraveBrowserProcess();
|
|
virtual void StartBraveServices() = 0;
|
|
virtual brave_shields::AdBlockService* ad_block_service() = 0;
|
|
virtual https_upgrade_exceptions::HttpsUpgradeExceptionsService*
|
|
https_upgrade_exceptions_service() = 0;
|
|
virtual debounce::DebounceComponentInstaller*
|
|
debounce_component_installer() = 0;
|
|
#if BUILDFLAG(ENABLE_REQUEST_OTR)
|
|
virtual request_otr::RequestOTRComponentInstallerPolicy*
|
|
request_otr_component_installer() = 0;
|
|
#endif
|
|
virtual brave::URLSanitizerComponentInstaller*
|
|
URLSanitizerComponentInstaller() = 0;
|
|
virtual brave_component_updater::LocalDataFilesService*
|
|
local_data_files_service() = 0;
|
|
#if BUILDFLAG(ENABLE_TOR)
|
|
virtual tor::BraveTorClientUpdater* tor_client_updater() = 0;
|
|
virtual tor::BraveTorPluggableTransportUpdater*
|
|
tor_pluggable_transport_updater() = 0;
|
|
#endif
|
|
virtual p3a::P3AService* p3a_service() = 0;
|
|
virtual brave::BraveReferralsService* brave_referrals_service() = 0;
|
|
#if BUILDFLAG(ENABLE_BRAVE_STATS_UPDATER)
|
|
virtual brave_stats::BraveStatsUpdater* brave_stats_updater() = 0;
|
|
#endif
|
|
#if BUILDFLAG(ENABLE_BRAVE_ADS)
|
|
virtual brave_ads::BraveStatsHelper* ads_brave_stats_helper() = 0;
|
|
virtual brave_ads::ResourceComponent* resource_component() = 0;
|
|
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
|
|
virtual ntp_background_images::NTPBackgroundImagesService*
|
|
ntp_background_images_service() = 0;
|
|
#if BUILDFLAG(ENABLE_SPEEDREADER)
|
|
virtual speedreader::SpeedreaderRewriterService*
|
|
speedreader_rewriter_service() = 0;
|
|
#endif
|
|
#if BUILDFLAG(ENABLE_BRAVE_VPN_V1)
|
|
virtual brave_vpn::BraveVPNConnectionManager*
|
|
brave_vpn_connection_manager() = 0;
|
|
#endif
|
|
virtual misc_metrics::ProcessMiscMetrics* process_misc_metrics() = 0;
|
|
};
|
|
|
|
extern BraveBrowserProcess* g_brave_browser_process;
|
|
|
|
#endif // BRAVE_BROWSER_BRAVE_BROWSER_PROCESS_H_
|