diff --git a/android/java/org/chromium/chrome/browser/preferences/BravePrefServiceBridge.java b/android/java/org/chromium/chrome/browser/preferences/BravePrefServiceBridge.java index 251ef9c879c8..75d7d5c497d6 100644 --- a/android/java/org/chromium/chrome/browser/preferences/BravePrefServiceBridge.java +++ b/android/java/org/chromium/chrome/browser/preferences/BravePrefServiceBridge.java @@ -34,13 +34,6 @@ public void setHTTPSEEnabled(boolean enabled) { BravePrefServiceBridgeJni.get().setHTTPSEEnabled(enabled); } - /** - * @param whether the IPFS gateway should be enabled. - */ - public void setIpfsGatewayEnabled(boolean enabled) { - BravePrefServiceBridgeJni.get().setIpfsGatewayEnabled(enabled); - } - /** * @param whether google login is enabled on third party sites. */ @@ -205,7 +198,6 @@ public boolean getP3ANoticeAcknowledged() { @NativeMethods interface Natives { void setHTTPSEEnabled(boolean enabled); - void setIpfsGatewayEnabled(boolean enabled); void setAdBlockEnabled(boolean enabled); void setFingerprintingProtectionEnabled(boolean enabled); diff --git a/android/java/org/chromium/chrome/browser/privacy/settings/BravePrivacySettings.java b/android/java/org/chromium/chrome/browser/privacy/settings/BravePrivacySettings.java index 0059be715b39..0c7d18098a8c 100644 --- a/android/java/org/chromium/chrome/browser/privacy/settings/BravePrivacySettings.java +++ b/android/java/org/chromium/chrome/browser/privacy/settings/BravePrivacySettings.java @@ -28,7 +28,6 @@ public class BravePrivacySettings extends PrivacySettings { private static final String PREF_HTTPSE = "httpse"; - private static final String PREF_IPFS_GATEWAY = "ipfs_gateway"; private static final String PREF_AD_BLOCK = "ad_block"; private static final String PREF_FINGERPRINTING_PROTECTION = "fingerprinting_protection"; private static final String PREF_CLOSE_TABS_ON_EXIT = "close_tabs_on_exit"; @@ -51,7 +50,6 @@ public class BravePrivacySettings extends PrivacySettings { private ChromeSwitchPreference mAutocompleteTopSites; private ChromeSwitchPreference mAutocompleteBraveSuggestedSites; private ChromeBaseCheckBoxPreference mHttpsePref; - private ChromeBaseCheckBoxPreference mIpfsGatewayPref; private ChromeBaseCheckBoxPreference mAdBlockPref; private ChromeBaseCheckBoxPreference mFingerprintingProtectionPref; private ChromeBaseCheckBoxPreference mCloseTabsOnExitPref; @@ -71,9 +69,6 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { mHttpsePref = (ChromeBaseCheckBoxPreference) findPreference(PREF_HTTPSE); mHttpsePref.setOnPreferenceChangeListener(this); - mIpfsGatewayPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_IPFS_GATEWAY); - mIpfsGatewayPref.setOnPreferenceChangeListener(this); - mAdBlockPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_AD_BLOCK); mAdBlockPref.setOnPreferenceChangeListener(this); @@ -124,8 +119,6 @@ public boolean onPreferenceChange(Preference preference, Object newValue) { String key = preference.getKey(); if (PREF_HTTPSE.equals(key)) { BravePrefServiceBridge.getInstance().setHTTPSEEnabled((boolean) newValue); - } else if (PREF_IPFS_GATEWAY.equals(key)) { - BravePrefServiceBridge.getInstance().setIpfsGatewayEnabled((boolean) newValue); } else if (PREF_AD_BLOCK.equals(key)) { BravePrefServiceBridge.getInstance().setAdBlockEnabled((boolean) newValue); } else if (PREF_FINGERPRINTING_PROTECTION.equals(key)) { @@ -180,7 +173,6 @@ private void updatePreferences() { getPreferenceScreen().removePreference(mSendP3A); } mHttpsePref.setOrder(++order); - mIpfsGatewayPref.setOrder(++order); mAdBlockPref.setOrder(++order); mFingerprintingProtectionPref.setOrder(++order); mSearchSuggestions.setOrder(++order); diff --git a/android/java/res/xml/brave_privacy_preferences.xml b/android/java/res/xml/brave_privacy_preferences.xml index 34ee03552f70..42a40c09540f 100644 --- a/android/java/res/xml/brave_privacy_preferences.xml +++ b/android/java/res/xml/brave_privacy_preferences.xml @@ -21,11 +21,6 @@ android:title="@string/httpse_title" android:summary="@string/httpse_summary" android:defaultValue="true" /> - local_state()); } -void JNI_BravePrefServiceBridge_SetIpfsGatewayEnabled(JNIEnv* env, - jboolean enabled) { -#if BUILDFLAG(IPFS_ENABLED) - ipfs::IPFSResolveMethodTypes type = - enabled ? ipfs::IPFSResolveMethodTypes::IPFS_ASK - : ipfs::IPFSResolveMethodTypes::IPFS_DISABLED; - GetOriginalProfile()->GetPrefs()->SetInteger(kIPFSResolveMethod, - static_cast(type)); -#endif -} - void JNI_BravePrefServiceBridge_SetThirdPartyGoogleLoginEnabled( JNIEnv* env, jboolean enabled) { diff --git a/browser/ipfs/ipfs_service_factory.cc b/browser/ipfs/ipfs_service_factory.cc index 1274c78d1ec6..861985d70350 100644 --- a/browser/ipfs/ipfs_service_factory.cc +++ b/browser/ipfs/ipfs_service_factory.cc @@ -13,14 +13,10 @@ #include "chrome/common/channel_info.h" #include "chrome/common/chrome_paths.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" -#include "extensions/buildflags/buildflags.h" - -#if BUILDFLAG(ENABLE_EXTENSIONS) #include "extensions/browser/extension_registry_factory.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/extension_system_provider.h" #include "extensions/browser/extensions_browser_client.h" -#endif namespace ipfs { @@ -43,11 +39,9 @@ IpfsServiceFactory::IpfsServiceFactory() : BrowserContextKeyedServiceFactory( "IpfsService", BrowserContextDependencyManager::GetInstance()) { -#if BUILDFLAG(ENABLE_EXTENSIONS) DependsOn(extensions::ExtensionRegistryFactory::GetInstance()); DependsOn( extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); -#endif } IpfsServiceFactory::~IpfsServiceFactory() {} diff --git a/browser/ui/android/strings/android_brave_strings.grd b/browser/ui/android/strings/android_brave_strings.grd index e3ebfa3c4876..d04b9fc75b71 100644 --- a/browser/ui/android/strings/android_brave_strings.grd +++ b/browser/ui/android/strings/android_brave_strings.grd @@ -190,12 +190,6 @@ This file contains all "about" strings. It is set to NOT be translated, in tran Opens supported sites using HTTPS instead of HTTP when possible - - IPFS Gateway - - - Allows for navigation to IPFS resources through an IPFS Gateway - Ad Block diff --git a/browser/ui/webui/brave_webui_source.cc b/browser/ui/webui/brave_webui_source.cc index a231c6707cca..4c8e9d4fa3de 100644 --- a/browser/ui/webui/brave_webui_source.cc +++ b/browser/ui/webui/brave_webui_source.cc @@ -1070,7 +1070,7 @@ void CustomizeWebUIHTMLSource(const std::string &name, { "walletStatusPending", IDS_BRAVE_REWARDS_INTERNALS_WALLET_STATUS_PENDING }, // NOLINT } }, { -#if BUILDFLAG(ENABLE_TOR) +#if BUILDFLAG(IPFS_ENABLED) std::string("tor-internals"), { { "tabGeneralInfo", IDS_TOR_INTERNALS_TAB_GENERAL_INFO }, { "tabLogs", IDS_TOR_INTERNALS_TAB_LOGS }, diff --git a/chromium_src/chrome/browser/DEPS b/chromium_src/chrome/browser/DEPS index 459d92a07de3..e6b176e7aa55 100644 --- a/chromium_src/chrome/browser/DEPS +++ b/chromium_src/chrome/browser/DEPS @@ -2,7 +2,6 @@ include_rules = [ "+../../../../chrome/browser", "+../../../../../chrome/browser/android", "+../../../../../../chrome/browser/android/browsing_data", - "+../../../../../../chrome/browser/android/omnibox", "+../../../../../../chrome/browser/android/preferences", "+../../../../../../chrome/browser/android/signin", "+../../../../../chrome/browser/autocomplete", diff --git a/chromium_src/chrome/browser/about_flags.cc b/chromium_src/chrome/browser/about_flags.cc index fb0454691302..a07409eb4049 100644 --- a/chromium_src/chrome/browser/about_flags.cc +++ b/chromium_src/chrome/browser/about_flags.cc @@ -78,8 +78,7 @@ using ntp_background_images::features::kBraveNTPSuperReferralWallpaper; #define BRAVE_IPFS_FEATURE_ENTRIES \ {"brave-ipfs", \ flag_descriptions::kBraveIpfsName, \ - flag_descriptions::kBraveIpfsDescription, \ - kOsDesktop | kOsAndroid, \ + flag_descriptions::kBraveIpfsDescription, kOsDesktop, \ FEATURE_VALUE_TYPE(ipfs::features::kIpfsFeature)}, #else #define BRAVE_IPFS_FEATURE_ENTRIES diff --git a/chromium_src/chrome/browser/android/omnibox/autocomplete_controller_android.cc b/chromium_src/chrome/browser/android/omnibox/autocomplete_controller_android.cc deleted file mode 100644 index 065ba3eecf10..000000000000 --- a/chromium_src/chrome/browser/android/omnibox/autocomplete_controller_android.cc +++ /dev/null @@ -1,12 +0,0 @@ -/* 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/. */ - -#include "brave/browser/autocomplete/brave_autocomplete_scheme_classifier.h" -#include "components/omnibox/browser/autocomplete_classifier.h" -#include "components/omnibox/browser/autocomplete_controller.h" - -#define ChromeAutocompleteSchemeClassifier BraveAutocompleteSchemeClassifier -#include "../../../../../../chrome/browser/android/omnibox/autocomplete_controller_android.cc" -#undef ChromeAutocompleteSchemeClassifier diff --git a/chromium_src/chrome/browser/profiles/profile_io_data.cc b/chromium_src/chrome/browser/profiles/profile_io_data.cc index 591fe0cd5195..6c7ada50feac 100644 --- a/chromium_src/chrome/browser/profiles/profile_io_data.cc +++ b/chromium_src/chrome/browser/profiles/profile_io_data.cc @@ -15,8 +15,6 @@ bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { if (scheme == kBraveUIScheme) return true; - if (scheme == "ipfs" || scheme == "ipns") - return true; return IsHandledProtocol_ChromiumImpl(scheme); } diff --git a/common/BUILD.gn b/common/BUILD.gn index a3ef851d824b..1a3848323cce 100644 --- a/common/BUILD.gn +++ b/common/BUILD.gn @@ -93,10 +93,8 @@ source_set("common") { "//brave/components/external_intents/android", "//brave/components/webcompat_reporter/browser", "//brave/chromium_src/third_party/blink/renderer/modules:browser_tests", + "//brave/components/ipfs/test:brave_ipfs_browser_tests", ] - if (!is_android && !is_ios) { - visibility += [ "//brave/components/ipfs/test:brave_ipfs_browser_tests" ] - } # Remove when https://github.com/brave/brave-browser/issues/10653 is resolved check_includes = false diff --git a/components/ipfs/BUILD.gn b/components/ipfs/BUILD.gn index 82a8c04dd419..ae0c7c3858c3 100644 --- a/components/ipfs/BUILD.gn +++ b/components/ipfs/BUILD.gn @@ -44,7 +44,6 @@ source_set("ipfs") { "//brave/components/resources:static_resources", "//brave/components/resources:strings", "//brave/components/services/ipfs/public/mojom", - "//brave/extensions:common", "//components/component_updater:component_updater", "//components/infobars/core", "//components/keyed_service/core", @@ -55,7 +54,6 @@ source_set("ipfs") { "//components/version_info", "//content/public/browser", "//content/public/common", - "//extensions/buildflags", "//net", "//services/network/public/cpp", "//third_party/re2", @@ -65,6 +63,9 @@ source_set("ipfs") { ] if (enable_extensions) { - deps += [ "//extensions/browser" ] + deps += [ + "//extensions/browser", + "//extensions/common", + ] } } diff --git a/components/ipfs/DEPS b/components/ipfs/DEPS index 4bdbc5e8c7b0..b6565637930c 100644 --- a/components/ipfs/DEPS +++ b/components/ipfs/DEPS @@ -2,7 +2,6 @@ include_rules = [ "+content/public/browser", "+content/public/common", "+extensions/browser", - "+extensions/buildflags", "+extensions/common", "+third_party/re2", "+services/network/public", diff --git a/components/ipfs/brave_ipfs_client_updater.h b/components/ipfs/brave_ipfs_client_updater.h index 5e43ae6f82b8..0655538106ff 100644 --- a/components/ipfs/brave_ipfs_client_updater.h +++ b/components/ipfs/brave_ipfs_client_updater.h @@ -59,11 +59,6 @@ static const char kIpfsClientComponentBase64PublicKey[] = "J9HIuxTzVft5v5Ys0S0Kqorn2xo+lFpVzZT7sV2orDHaLiVB5uqCMWhXehVixfRp" "BuPGdwSuzJsNkV5aGOObKfoLr1zUgstJYMLB0uWNXTfuKM4EibWUMLMqlCYVzs2R" "ewIDAQAB"; -#elif defined(OS_ANDROID) -// Not used yet -static const char kIpfsClientComponentName[] = ""; -static const char kIpfsClientComponentId[] = ""; -static const char kIpfsClientComponentBase64PublicKey[] = ""; #endif class BraveIpfsClientUpdater : public BraveComponent, diff --git a/components/ipfs/buildflags/buildflags.gni b/components/ipfs/buildflags/buildflags.gni index b7dd5e7997ff..014a045c3015 100644 --- a/components/ipfs/buildflags/buildflags.gni +++ b/components/ipfs/buildflags/buildflags.gni @@ -1,5 +1,5 @@ import("//build/config/features.gni") declare_args() { - ipfs_enabled = !is_ios + ipfs_enabled = is_mac || is_linux || is_win } diff --git a/components/ipfs/ipfs_navigation_throttle.cc b/components/ipfs/ipfs_navigation_throttle.cc index bbfdbf5bcf1c..5697f2d955bb 100644 --- a/components/ipfs/ipfs_navigation_throttle.cc +++ b/components/ipfs/ipfs_navigation_throttle.cc @@ -79,6 +79,7 @@ IpfsNavigationThrottle::MaybeCreateThrottleFor( const std::string& locale) { if (!ipfs_service) return nullptr; + return std::make_unique(navigation_handle, ipfs_service, locale); } @@ -106,9 +107,8 @@ IpfsNavigationThrottle::WillStartRequest() { pref_service_->GetInteger(kIPFSResolveMethod) == static_cast(ipfs::IPFSResolveMethodTypes::IPFS_ASK); - if (IsIPFSScheme(url) && should_ask) { + if (IsIPFSScheme(url) && should_ask) return ShowIPFSOnboardingInterstitial(); - } if (!IsLocalGatewayURL(url)) { return content::NavigationThrottle::PROCEED; diff --git a/components/ipfs/ipfs_onboarding_page.cc b/components/ipfs/ipfs_onboarding_page.cc index 5991e2ca49d3..6633cd0dd98e 100644 --- a/components/ipfs/ipfs_onboarding_page.cc +++ b/components/ipfs/ipfs_onboarding_page.cc @@ -64,9 +64,7 @@ IPFSOnboardingPage::IPFSOnboardingPage( std::move(controller)), ipfs_service_(ipfs_service) { service_observer_.Observe(ipfs_service_); -#if !defined(OS_ANDROID) theme_observer_.Observe(ui::NativeTheme::GetInstanceForNativeUi()); -#endif } IPFSOnboardingPage::~IPFSOnboardingPage() = default; @@ -252,12 +250,8 @@ void IPFSOnboardingPage::PopulateInterstitialStrings( load_time_data->SetString( "tryAgainText", l10n_util::GetStringUTF16(IDS_IPFS_ONBOARDING_TRY_AGAIN)); -#if !defined(OS_ANDROID) load_time_data->SetString( "braveTheme", GetThemeType(ui::NativeTheme::GetInstanceForNativeUi())); -#else - load_time_data->SetString("braveTheme", "light"); -#endif } int IPFSOnboardingPage::GetHTMLTemplateId() { diff --git a/components/ipfs/ipfs_p3a.cc b/components/ipfs/ipfs_p3a.cc index d2ec8a492673..b9cb57742cdb 100644 --- a/components/ipfs/ipfs_p3a.cc +++ b/components/ipfs/ipfs_p3a.cc @@ -11,11 +11,7 @@ #include "components/prefs/pref_service.h" #include "components/user_prefs/user_prefs.h" #include "content/public/browser/browser_context.h" -#include "extensions/buildflags/buildflags.h" - -#if BUILDFLAG(ENABLE_EXTENSIONS) #include "extensions/browser/extension_registry.h" -#endif namespace ipfs { @@ -24,13 +20,11 @@ constexpr size_t kP3ATimerInterval = 1; // IPFS companion installed? // i) No, ii) Yes void RecordIPFSCompanionInstalled(content::BrowserContext* context) { -#if BUILDFLAG(ENABLE_EXTENSIONS) const char ipfs_companion_extension_id[] = "nibjojkomfdiaoajekhjakgkdhaomnch"; auto* registry = extensions::ExtensionRegistry::Get(context); bool installed = registry->enabled_extensions().Contains(ipfs_companion_extension_id); UMA_HISTOGRAM_BOOLEAN("Brave.IPFS.IPFSCompanionInstalled", installed); -#endif } int GetIPFSDetectionPromptBucket(PrefService* prefs) { diff --git a/components/ipfs/resources/onboarding/ipfs_onboarding.html b/components/ipfs/resources/onboarding/ipfs_onboarding.html index 52a241afe8bd..4b8ea36d7835 100644 --- a/components/ipfs/resources/onboarding/ipfs_onboarding.html +++ b/components/ipfs/resources/onboarding/ipfs_onboarding.html @@ -30,7 +30,7 @@ - + $i18n{localNodeButton} @@ -53,7 +53,7 @@ -