Add IPFS Component build flag, some other review suggestions follow up (#25979)

Add IPFS Component build flag, some other review suggestions follow up

Signed-off-by: Vadym Struts <vstruts@brave.com>
This commit is contained in:
vadims
2024-10-17 11:05:08 +02:00
committed by GitHub
parent d115392c34
commit 4cea285253
6 changed files with 42 additions and 18 deletions
+7 -3
View File
@@ -18,6 +18,7 @@
#include "brave/components/brave_sync/features.h"
#include "brave/components/constants/brave_constants.h"
#include "brave/components/constants/pref_names.h"
#include "brave/components/ipfs/buildflags/buildflags.h"
#include "brave/components/speedreader/common/buildflags/buildflags.h"
#include "brave/components/tor/buildflags/buildflags.h"
#include "build/build_config.h"
@@ -56,7 +57,6 @@
#include "brave/browser/infobars/brave_confirm_p3a_infobar_delegate.h"
#include "brave/browser/infobars/brave_sync_account_deleted_infobar_delegate.h"
#include "brave/browser/infobars/sync_cannot_run_infobar_delegate.h"
#include "brave/components/ipfs/ipfs_component_cleaner.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "components/infobars/content/content_infobar_manager.h"
@@ -70,6 +70,10 @@
#include "extensions/browser/extension_system.h"
#endif
#if BUILDFLAG(DEPRECATE_IPFS)
#include "brave/components/ipfs/ipfs_component_cleaner.h"
#endif // BUILDFLAG(DEPRECATE_IPFS)
ChromeBrowserMainParts::ChromeBrowserMainParts(bool is_integration_test,
StartupData* startup_data)
: ChromeBrowserMainParts_ChromiumImpl(is_integration_test, startup_data) {}
@@ -163,10 +167,10 @@ void ChromeBrowserMainParts::PostBrowserStart() {
}
#endif // !BUILDFLAG(IS_ANDROID)
#if !BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(DEPRECATE_IPFS)
ipfs::CleanupIpfsComponent(
base::PathService::CheckedGet(chrome::DIR_USER_DATA));
#endif // !BUILDFLAG(IS_ANDROID)
#endif // BUILDFLAG(DEPRECATE_IPFS)
}
void ChromeBrowserMainParts::PreShutdown() {
+1
View File
@@ -190,6 +190,7 @@ brave_chrome_browser_deps = [
"//brave/components/greaselion/browser/buildflags",
"//brave/components/https_upgrade_exceptions/browser",
"//brave/components/ipfs",
"//brave/components/ipfs/buildflags",
"//brave/components/l10n/common",
"//brave/components/localhost_permission",
"//brave/components/ntp_background_images/browser",
+11 -8
View File
@@ -3,6 +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/ipfs/buildflags/buildflags.gni")
static_library("ipfs") {
sources = [
"ipfs_prefs.cc",
@@ -11,7 +13,16 @@ static_library("ipfs") {
"ipfs_utils.h",
]
if (deprecate_ipfs) {
sources += [
"ipfs_common.h",
"ipfs_component_cleaner.cc",
"ipfs_component_cleaner.h",
]
}
deps = [
"buildflags",
"//base",
"//brave/components/filecoin/rs:rust_lib",
"//components/base32",
@@ -19,12 +30,4 @@ static_library("ipfs") {
"//net",
"//url",
]
if (!is_android && !is_ios) {
sources += [
"ipfs_common.h",
"ipfs_component_cleaner.cc",
"ipfs_component_cleaner.h",
]
}
}
+12
View File
@@ -0,0 +1,12 @@
# Copyright (c) 2024 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/.
import("//brave/components/ipfs/buildflags/buildflags.gni")
import("//build/buildflag_header.gni")
buildflag_header("buildflags") {
header = "buildflags.h"
flags = [ "DEPRECATE_IPFS=$deprecate_ipfs" ]
}
@@ -0,0 +1,8 @@
# Copyright (c) 2024 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/.
declare_args() {
deprecate_ipfs = !is_android && !is_ios
}
+3 -7
View File
@@ -3,19 +3,15 @@
# 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/. */
#import("//brave/build/config.gni")
#import("//brave/components/ipfs/buildflags/buildflags.gni")
import("//brave/components/ipfs/buildflags/buildflags.gni")
import("//testing/test.gni")
source_set("brave_ipfs_unit_tests") {
testonly = true
sources = [ "//brave/components/ipfs/ipfs_utils_unittest.cc" ]
if (!is_android && !is_ios) {
sources += [
"//brave/components/ipfs/ipfs_component_cleaner.cc",
"//brave/components/ipfs/ipfs_component_cleaner_unittest.cc",
]
if (deprecate_ipfs) {
sources += [ "//brave/components/ipfs/ipfs_component_cleaner_unittest.cc" ]
}
deps = [