diff --git a/.storybook/BUILD.gn b/.storybook/BUILD.gn index 6ea66caa378c..b701185b9a04 100644 --- a/.storybook/BUILD.gn +++ b/.storybook/BUILD.gn @@ -4,7 +4,6 @@ # you can obtain one at http://mozilla.org/MPL/2.0/. import("//brave/components/brave_vpn/common/buildflags/buildflags.gni") -import("//brave/components/speedreader/common/buildflags/buildflags.gni") group("storybook") { # Depend on any generated JS output that will @@ -21,11 +20,8 @@ group("storybook") { "//brave/components/brave_shields/core/common:mojom_js", "//brave/components/brave_vpn/common/mojom:mojom_js", "//brave/components/brave_wallet/common:mojom_js", + "//brave/components/speedreader/common:mojom_js", "//mojo/public/js:bindings", "//mojo/public/js:resources", ] - - if (enable_speedreader) { - deps += [ "//brave/components/speedreader/common:mojom_js" ] - } } diff --git a/app/BUILD.gn b/app/BUILD.gn index c16c6d2b40ba..515bdd89cc55 100644 --- a/app/BUILD.gn +++ b/app/BUILD.gn @@ -7,7 +7,6 @@ import("//brave/browser/shell_integrations/buildflags/buildflags.gni") import("//brave/components/brave_vpn/common/buildflags/buildflags.gni") import("//brave/components/playlist/common/buildflags/buildflags.gni") import("//brave/components/request_otr/common/buildflags/buildflags.gni") -import("//brave/components/speedreader/common/buildflags/buildflags.gni") import("//brave/components/text_recognition/common/buildflags/buildflags.gni") import("//brave/resources/brave_grit.gni") import("//build/config/features.gni") @@ -59,7 +58,6 @@ brave_grit("brave_generated_resources_grit") { "enable_pin_shortcut=$enable_pin_shortcut", "enable_playlist_webui=$enable_playlist_webui", "enable_request_otr=$enable_request_otr", - "enable_speedreader=$enable_speedreader", "enable_text_recognition=$enable_text_recognition", ] source = "brave_generated_resources.grd" diff --git a/app/brave_main_delegate.cc b/app/brave_main_delegate.cc index 1fac51e101b0..59cc1fb0dd9f 100644 --- a/app/brave_main_delegate.cc +++ b/app/brave_main_delegate.cc @@ -16,7 +16,6 @@ #include "brave/components/brave_component_updater/browser/features.h" #include "brave/components/brave_component_updater/browser/switches.h" #include "brave/components/brave_sync/buildflags.h" -#include "brave/components/speedreader/common/buildflags/buildflags.h" #include "brave/components/update_client/buildflags.h" #include "brave/components/variations/command_line_utils.h" #include "brave/renderer/brave_content_renderer_client.h" diff --git a/app/vector_icons/BUILD.gn b/app/vector_icons/BUILD.gn index 2f5b5dd15f03..a92a909a7493 100644 --- a/app/vector_icons/BUILD.gn +++ b/app/vector_icons/BUILD.gn @@ -5,7 +5,6 @@ import("//brave/components/brave_vpn/common/buildflags/buildflags.gni") import("//brave/components/playlist/common/buildflags/buildflags.gni") -import("//brave/components/speedreader/common/buildflags/buildflags.gni") import("//build/config/ui.gni") import("//components/vector_icons/vector_icons.gni") @@ -20,6 +19,10 @@ aggregate_vector_icons("brave_vector_icons") { "brave_ads_dark_mode_info_button.icon", "brave_ads_light_mode_info_button.icon", "brave_sad.icon", + "brave_speedreader_graphic_book1.icon", + "brave_speedreader_graphic_book2.icon", + "brave_speedreader_graphic_book3.icon", + "brave_speedreader_graphic_lines.icon", "brave_tooltips_stopwatch.icon", "brave_translate.icon", "download_unlock.icon", @@ -47,15 +50,6 @@ aggregate_vector_icons("brave_vector_icons") { "vpn_indicator_on.icon", ] } - - if (enable_speedreader) { - sources += [ - "brave_speedreader_graphic_book1.icon", - "brave_speedreader_graphic_book2.icon", - "brave_speedreader_graphic_book3.icon", - "brave_speedreader_graphic_lines.icon", - ] - } } source_set("vector_icons") { diff --git a/browser/BUILD.gn b/browser/BUILD.gn index 077834fa823b..8bc8c2e083f4 100644 --- a/browser/BUILD.gn +++ b/browser/BUILD.gn @@ -32,7 +32,6 @@ source_set("browser_process") { "//brave/browser/ethereum_remote_client/buildflags", "//brave/components/brave_vpn/common/buildflags", "//brave/components/request_otr/common/buildflags", - "//brave/components/speedreader/common/buildflags", "//brave/components/tor/buildflags", "//chrome/browser:browser_process", "//extensions/buildflags", diff --git a/browser/about_flags.cc b/browser/about_flags.cc index 5d4f0f94d60c..ff41ead74d4b 100644 --- a/browser/about_flags.cc +++ b/browser/about_flags.cc @@ -34,7 +34,7 @@ #include "brave/components/psst/common/features.h" #include "brave/components/request_otr/common/buildflags/buildflags.h" #include "brave/components/skus/common/features.h" -#include "brave/components/speedreader/common/buildflags/buildflags.h" +#include "brave/components/speedreader/common/features.h" #include "brave/components/webcompat/core/common/features.h" #include "build/build_config.h" #include "chrome/browser/ui/ui_features.h" @@ -56,10 +56,6 @@ #include "brave/components/brave_vpn/common/features.h" #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) -#include "brave/components/speedreader/common/features.h" -#endif - #if BUILDFLAG(ENABLE_PLAYLIST) #include "brave/components/playlist/common/features.h" #endif @@ -86,16 +82,14 @@ #define EXPAND_FEATURE_ENTRIES(...) __VA_ARGS__, -#define SPEEDREADER_FEATURE_ENTRIES \ - IF_BUILDFLAG( \ - ENABLE_SPEEDREADER, \ - EXPAND_FEATURE_ENTRIES({ \ - "brave-speedreader", \ - "Enable SpeedReader", \ - "Enables faster loading of simplified article-style web pages.", \ - kOsDesktop | kOsAndroid, \ - FEATURE_VALUE_TYPE(speedreader::kSpeedreaderFeature), \ - })) +#define SPEEDREADER_FEATURE_ENTRIES \ + EXPAND_FEATURE_ENTRIES({ \ + "brave-speedreader", \ + "Enable SpeedReader", \ + "Enables faster loading of simplified article-style web pages.", \ + kOsDesktop | kOsAndroid, \ + FEATURE_VALUE_TYPE(speedreader::kSpeedreaderFeature), \ + }) #define REQUEST_OTR_FEATURE_ENTRIES \ IF_BUILDFLAG( \ diff --git a/browser/brave_browser_main_parts.cc b/browser/brave_browser_main_parts.cc index 069500aac7d2..554f8c8955ae 100644 --- a/browser/brave_browser_main_parts.cc +++ b/browser/brave_browser_main_parts.cc @@ -19,7 +19,7 @@ #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/speedreader/speedreader_extended_info_handler.h" #include "brave/components/tor/buildflags/buildflags.h" #include "build/build_config.h" #include "chrome/browser/browser_process.h" @@ -28,6 +28,7 @@ #include "chrome/common/chrome_paths.h" #include "components/component_updater/component_updater_service.h" #include "components/prefs/pref_service.h" +#include "components/sessions/content/content_serialized_navigation_driver.h" #include "components/sync/base/command_line_switches.h" #include "components/sync/service/sync_service.h" #include "components/sync/service/sync_user_settings.h" @@ -36,11 +37,6 @@ #include "extensions/buildflags/buildflags.h" #include "media/base/media_switches.h" -#if BUILDFLAG(ENABLE_SPEEDREADER) -#include "brave/components/speedreader/speedreader_extended_info_handler.h" -#include "components/sessions/content/content_serialized_navigation_driver.h" -#endif - #if BUILDFLAG(ENABLE_TOR) #include #include "base/files/file_util.h" @@ -89,7 +85,6 @@ int ChromeBrowserMainParts::PreMainMessageLoopRun() { } void ChromeBrowserMainParts::PreBrowserStart() { -#if BUILDFLAG(ENABLE_SPEEDREADER) // Register() must be called after the SerializedNavigationDriver is // initialized, but before any calls to // ContentSerializedNavigationBuilder::ToNavigationEntries() @@ -97,7 +92,6 @@ void ChromeBrowserMainParts::PreBrowserStart() { // TODO(keur): Can we DCHECK the latter condition? DCHECK(sessions::ContentSerializedNavigationDriver::GetInstance()); speedreader::SpeedreaderExtendedInfoHandler::Register(); -#endif ChromeBrowserMainParts_ChromiumImpl::PreBrowserStart(); } diff --git a/browser/brave_browser_process.h b/browser/brave_browser_process.h index cb7985188f10..7fa2ce7730bc 100644 --- a/browser/brave_browser_process.h +++ b/browser/brave_browser_process.h @@ -13,7 +13,6 @@ #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" @@ -116,10 +115,8 @@ class BraveBrowserProcess { virtual brave_ads::BraveStatsHelper* ads_brave_stats_helper() = 0; 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) virtual brave_vpn::BraveVPNConnectionManager* brave_vpn_connection_manager() = 0; diff --git a/browser/brave_browser_process_impl.cc b/browser/brave_browser_process_impl.cc index 31173497a95a..462d986a4300 100644 --- a/browser/brave_browser_process_impl.cc +++ b/browser/brave_browser_process_impl.cc @@ -42,6 +42,7 @@ #include "brave/components/p3a/histograms_braveizer.h" #include "brave/components/p3a/p3a_config.h" #include "brave/components/p3a/p3a_service.h" +#include "brave/components/speedreader/speedreader_rewriter_service.h" #include "brave/components/webcompat/content/browser/webcompat_exceptions_service.h" #include "brave/components/webcompat/core/common/features.h" #include "brave/services/network/public/cpp/system_request_handler.h" @@ -67,10 +68,6 @@ #include "brave/components/tor/pref_names.h" #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) -#include "brave/components/speedreader/speedreader_rewriter_service.h" -#endif - #if BUILDFLAG(IS_ANDROID) #include "chrome/browser/flags/android/chrome_feature_list.h" #else @@ -237,9 +234,7 @@ void BraveBrowserProcessImpl::StartBraveServices() { #if BUILDFLAG(ENABLE_REQUEST_OTR) request_otr_component_installer(); #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) speedreader_rewriter_service(); -#endif URLSanitizerComponentInstaller(); // Now start the local data files service, which calls all observers. local_data_files_service()->Start(); @@ -466,7 +461,6 @@ BraveBrowserProcessImpl::notification_platform_bridge() { return BrowserProcessImpl::notification_platform_bridge(); } -#if BUILDFLAG(ENABLE_SPEEDREADER) speedreader::SpeedreaderRewriterService* BraveBrowserProcessImpl::speedreader_rewriter_service() { if (!speedreader_rewriter_service_) { @@ -475,7 +469,6 @@ BraveBrowserProcessImpl::speedreader_rewriter_service() { } return speedreader_rewriter_service_.get(); } -#endif // BUILDFLAG(ENABLE_SPEEDREADER) #if BUILDFLAG(ENABLE_BRAVE_VPN) brave_vpn::BraveVPNConnectionManager* diff --git a/browser/brave_browser_process_impl.h b/browser/brave_browser_process_impl.h index 9285ece6fdb1..f64fa381e8ef 100644 --- a/browser/brave_browser_process_impl.h +++ b/browser/brave_browser_process_impl.h @@ -12,7 +12,6 @@ #include "brave/browser/brave_browser_process.h" #include "brave/components/brave_component_updater/browser/brave_component.h" #include "brave/components/brave_vpn/common/buildflags/buildflags.h" -#include "brave/components/speedreader/common/buildflags/buildflags.h" #include "brave/components/tor/brave_tor_pluggable_transport_updater.h" #include "brave/components/tor/buildflags/buildflags.h" #include "brave/components/url_sanitizer/browser/url_sanitizer_component_installer.h" @@ -127,10 +126,8 @@ class BraveBrowserProcessImpl : public BraveBrowserProcess, ntp_background_images::NTPBackgroundImagesService* ntp_background_images_service() override; brave_ads::ResourceComponent* resource_component() override; -#if BUILDFLAG(ENABLE_SPEEDREADER) speedreader::SpeedreaderRewriterService* speedreader_rewriter_service() override; -#endif #if BUILDFLAG(ENABLE_BRAVE_VPN) brave_vpn::BraveVPNConnectionManager* brave_vpn_connection_manager() override; #endif @@ -194,10 +191,8 @@ class BraveBrowserProcessImpl : public BraveBrowserProcess, ntp_background_images_service_; std::unique_ptr resource_component_; -#if BUILDFLAG(ENABLE_SPEEDREADER) std::unique_ptr speedreader_rewriter_service_; -#endif #if BUILDFLAG(ENABLE_BRAVE_VPN) std::unique_ptr diff --git a/browser/brave_content_browser_client.cc b/browser/brave_content_browser_client.cc index 1201e8621f35..3e414b859999 100644 --- a/browser/brave_content_browser_client.cc +++ b/browser/brave_content_browser_client.cc @@ -36,6 +36,8 @@ #include "brave/browser/profiles/brave_renderer_updater.h" #include "brave/browser/profiles/brave_renderer_updater_factory.h" #include "brave/browser/skus/skus_service_factory.h" +#include "brave/browser/speedreader/speedreader_service_factory.h" +#include "brave/browser/speedreader/speedreader_tab_helper.h" #include "brave/browser/ui/brave_ui_features.h" #include "brave/browser/ui/webui/ads_internals/ads_internals_ui.h" #include "brave/browser/ui/webui/ai_chat/ai_chat_ui.h" @@ -91,7 +93,9 @@ #include "brave/components/skus/common/features.h" #include "brave/components/skus/common/skus_internals.mojom.h" #include "brave/components/skus/common/skus_sdk.mojom.h" -#include "brave/components/speedreader/common/buildflags/buildflags.h" +#include "brave/components/speedreader/speedreader_body_distiller.h" +#include "brave/components/speedreader/speedreader_distilled_page_producer.h" +#include "brave/components/speedreader/speedreader_util.h" #include "brave/components/tor/buildflags/buildflags.h" #include "brave/components/translate/core/common/brave_translate_switches.h" #include "brave/components/url_sanitizer/browser/url_sanitizer_service.h" @@ -142,6 +146,40 @@ #include "third_party/widevine/cdm/buildflags.h" #include "ui/base/l10n/l10n_util.h" +#if BUILDFLAG(IS_ANDROID) +#include "brave/browser/ui/webui/brave_wallet/android/android_wallet_page_ui.h" +#include "brave/components/ai_chat/core/browser/android/ai_chat_iap_subscription_android.h" +#else +#include "brave/browser/new_tab/new_tab_shows_navigation_throttle.h" +#include "brave/browser/ui/ai_chat/utils.h" +#include "brave/browser/ui/geolocation/brave_geolocation_permission_tab_helper.h" +#include "brave/browser/ui/webui/brave_news_internals/brave_news_internals_ui.h" +#include "brave/browser/ui/webui/brave_rewards/rewards_page_top_ui.h" +#include "brave/browser/ui/webui/brave_rewards/rewards_panel_ui.h" +#include "brave/browser/ui/webui/brave_rewards/tip_panel_ui.h" +#include "brave/browser/ui/webui/brave_settings_ui.h" +#include "brave/browser/ui/webui/brave_shields/cookie_list_opt_in_ui.h" +#include "brave/browser/ui/webui/brave_shields/shields_panel_ui.h" +#include "brave/browser/ui/webui/brave_wallet/wallet_page_ui.h" +#include "brave/browser/ui/webui/brave_wallet/wallet_panel_ui.h" +#include "brave/browser/ui/webui/new_tab_page/brave_new_tab_ui.h" +#include "brave/browser/ui/webui/private_new_tab_page/brave_private_new_tab_ui.h" +#include "brave/browser/ui/webui/speedreader/speedreader_toolbar_ui.h" +#include "brave/components/brave_new_tab_ui/brave_new_tab_page.mojom.h" +#include "brave/components/brave_news/common/brave_news.mojom.h" +#include "brave/components/brave_news/common/features.h" +#include "brave/components/brave_private_new_tab_ui/common/brave_private_new_tab.mojom.h" +#include "brave/components/brave_rewards/common/features.h" +#include "brave/components/brave_rewards/common/mojom/rewards_panel.mojom.h" +#include "brave/components/brave_rewards/common/mojom/rewards_tip_panel.mojom.h" +#include "brave/components/brave_shields/core/common/brave_shields_panel.mojom.h" +#include "brave/components/brave_shields/core/common/cookie_list_opt_in.mojom.h" +#include "brave/components/commands/common/commands.mojom.h" +#include "brave/components/commands/common/features.h" +#include "brave/components/speedreader/common/speedreader_toolbar.mojom.h" +#include "ui/webui/resources/cr_components/searchbox/searchbox.mojom.h" +#endif + #if BUILDFLAG(ENABLE_REQUEST_OTR) #include "brave/browser/request_otr/request_otr_service_factory.h" #include "brave/components/request_otr/browser/request_otr_navigation_throttle.h" @@ -166,13 +204,6 @@ using content::WebContents; using extensions::ChromeContentBrowserClientExtensionsPart; #endif -#if !BUILDFLAG(IS_ANDROID) -#include "brave/browser/ui/ai_chat/utils.h" -#endif -#if BUILDFLAG(IS_ANDROID) -#include "brave/components/ai_chat/core/browser/android/ai_chat_iap_subscription_android.h" -#endif - #if BUILDFLAG(ENABLE_AI_REWRITER) #include "brave/browser/ui/webui/ai_rewriter/ai_rewriter_ui.h" #include "brave/components/ai_rewriter/common/features.h" @@ -190,18 +221,6 @@ using extensions::ChromeContentBrowserClientExtensionsPart; #include "brave/components/tor/tor_navigation_throttle.h" #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) -#include "brave/browser/speedreader/speedreader_service_factory.h" -#include "brave/browser/speedreader/speedreader_tab_helper.h" -#include "brave/components/speedreader/speedreader_body_distiller.h" -#include "brave/components/speedreader/speedreader_distilled_page_producer.h" -#include "brave/components/speedreader/speedreader_util.h" -#if !BUILDFLAG(IS_ANDROID) -#include "brave/browser/ui/webui/speedreader/speedreader_toolbar_ui.h" -#include "brave/components/speedreader/common/speedreader_toolbar.mojom.h" -#endif -#endif - #if BUILDFLAG(ENABLE_WIDEVINE) #include "brave/browser/brave_drm_tab_helper.h" #endif @@ -219,36 +238,7 @@ using extensions::ChromeContentBrowserClientExtensionsPart; #include "brave/browser/ethereum_remote_client/ethereum_remote_client_service_factory.h" #endif -#if BUILDFLAG(IS_ANDROID) -#include "brave/browser/ui/webui/brave_wallet/android/android_wallet_page_ui.h" -#endif // BUILDFLAG(IS_ANDROID) - #if !BUILDFLAG(IS_ANDROID) -#include "brave/browser/new_tab/new_tab_shows_navigation_throttle.h" -#include "brave/browser/ui/geolocation/brave_geolocation_permission_tab_helper.h" -#include "brave/browser/ui/webui/brave_news_internals/brave_news_internals_ui.h" -#include "brave/browser/ui/webui/brave_rewards/rewards_page_top_ui.h" -#include "brave/browser/ui/webui/brave_rewards/rewards_panel_ui.h" -#include "brave/browser/ui/webui/brave_rewards/tip_panel_ui.h" -#include "brave/browser/ui/webui/brave_settings_ui.h" -#include "brave/browser/ui/webui/brave_shields/cookie_list_opt_in_ui.h" -#include "brave/browser/ui/webui/brave_shields/shields_panel_ui.h" -#include "brave/browser/ui/webui/brave_wallet/wallet_page_ui.h" -#include "brave/browser/ui/webui/brave_wallet/wallet_panel_ui.h" -#include "brave/browser/ui/webui/new_tab_page/brave_new_tab_ui.h" -#include "brave/browser/ui/webui/private_new_tab_page/brave_private_new_tab_ui.h" -#include "brave/components/brave_new_tab_ui/brave_new_tab_page.mojom.h" -#include "brave/components/brave_news/common/brave_news.mojom.h" -#include "brave/components/brave_news/common/features.h" -#include "brave/components/brave_private_new_tab_ui/common/brave_private_new_tab.mojom.h" -#include "brave/components/brave_rewards/common/features.h" -#include "brave/components/brave_rewards/common/mojom/rewards_panel.mojom.h" -#include "brave/components/brave_rewards/common/mojom/rewards_tip_panel.mojom.h" -#include "brave/components/brave_shields/core/common/brave_shields_panel.mojom.h" -#include "brave/components/brave_shields/core/common/cookie_list_opt_in.mojom.h" -#include "brave/components/commands/common/commands.mojom.h" -#include "brave/components/commands/common/features.h" -#include "ui/webui/resources/cr_components/searchbox/searchbox.mojom.h" #endif #if BUILDFLAG(ENABLE_PLAYLIST) @@ -561,7 +551,6 @@ void BraveContentBrowserClient:: }, &render_frame_host)); -#if BUILDFLAG(ENABLE_SPEEDREADER) associated_registry.AddInterface( base::BindRepeating( [](content::RenderFrameHost* render_frame_host, @@ -571,7 +560,6 @@ void BraveContentBrowserClient:: std::move(receiver), render_frame_host); }, &render_frame_host)); -#endif // AI Chat page content extraction renderer -> browser interface associated_registry.AddInterface( @@ -862,7 +850,7 @@ void BraveContentBrowserClient::RegisterBrowserInterfaceBindersForFrame( } #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) && !BUILDFLAG(IS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) content::RegisterWebUIControllerInterfaceBinder< speedreader::mojom::ToolbarFactory, SpeedreaderToolbarUI>(map); #endif @@ -941,7 +929,6 @@ BraveContentBrowserClient::CreateURLLoaderThrottles( base::SingleThreadTaskRunner::GetCurrentDefault()); // Speedreader -#if BUILDFLAG(ENABLE_SPEEDREADER) auto* tab_helper = speedreader::SpeedreaderTabHelper::FromWebContents(contents); if (tab_helper && isMainFrame) { @@ -963,7 +950,6 @@ BraveContentBrowserClient::CreateURLLoaderThrottles( body_sniffer_throttle->AddHandler(std::move(handler)); } } -#endif // ENABLE_SPEEDREADER if (isMainFrame) { // De-AMP diff --git a/browser/brave_profile_prefs.cc b/browser/brave_profile_prefs.cc index 23bf54eaf2d7..600070491b8b 100644 --- a/browser/brave_profile_prefs.cc +++ b/browser/brave_profile_prefs.cc @@ -50,7 +50,7 @@ #include "brave/components/omnibox/browser/brave_omnibox_prefs.h" #include "brave/components/request_otr/common/buildflags/buildflags.h" #include "brave/components/search_engines/brave_prepopulated_engines.h" -#include "brave/components/speedreader/common/buildflags/buildflags.h" +#include "brave/components/speedreader/speedreader_service.h" #include "brave/components/tor/buildflags/buildflags.h" #include "brave/components/webcompat_reporter/common/pref_names.h" #include "build/build_config.h" @@ -92,10 +92,6 @@ #include "brave/browser/gcm_driver/brave_gcm_utils.h" #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) -#include "brave/components/speedreader/speedreader_service.h" -#endif - #if BUILDFLAG(ENABLE_TOR) #include "brave/components/tor/tor_profile_service.h" #endif @@ -429,9 +425,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { registry->RegisterDictionaryPref(kWebDiscoveryCTAState); #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) speedreader::SpeedreaderService::RegisterProfilePrefs(registry); -#endif de_amp::RegisterProfilePrefs(registry); debounce::DebounceService::RegisterProfilePrefs(registry); diff --git a/browser/brave_shields/ad_block_service_browsertest.cc b/browser/brave_shields/ad_block_service_browsertest.cc index 672513999b4e..bc59ee4031ad 100644 --- a/browser/brave_shields/ad_block_service_browsertest.cc +++ b/browser/brave_shields/ad_block_service_browsertest.cc @@ -43,7 +43,6 @@ #include "brave/components/constants/pref_names.h" #include "brave/components/de_amp/common/pref_names.h" #include "brave/components/playlist/common/buildflags/buildflags.h" -#include "brave/components/speedreader/common/buildflags/buildflags.h" #include "build/build_config.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" @@ -60,9 +59,12 @@ #include "services/network/host_resolver.h" #if !BUILDFLAG(IS_ANDROID) +#include "brave/browser/speedreader/speedreader_service_factory.h" +#include "brave/components/speedreader/speedreader_service.h" #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h" #include "chrome/browser/ui/browser.h" #include "chrome/test/base/ui_test_utils.h" +#include "third_party/blink/public/common/web_preferences/web_preferences.h" #endif #if BUILDFLAG(ENABLE_PLAYLIST) @@ -72,12 +74,6 @@ #include "brave/components/playlist/common/features.h" #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) && !BUILDFLAG(IS_ANDROID) -#include "brave/browser/speedreader/speedreader_service_factory.h" -#include "brave/components/speedreader/speedreader_service.h" -#include "third_party/blink/public/common/web_preferences/web_preferences.h" -#endif - constexpr char kAdBlockTestPage[] = "/blocking.html"; constexpr char kAdBlockEasyListFranceUUID[] = @@ -3181,7 +3177,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTestJsPerformance, .ExtractBool()); } -#if BUILDFLAG(ENABLE_SPEEDREADER) && !BUILDFLAG(IS_ANDROID) +#if !BUILDFLAG(IS_ANDROID) IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, NoCosmeticFiltersOnSpeedreaderPage) { UpdateAdBlockInstanceWithRules( "##body,html:style(overflow: auto !important;"); diff --git a/browser/brave_tab_helpers.cc b/browser/brave_tab_helpers.cc index cd9584ea0fa8..ba9063c2b6e9 100644 --- a/browser/brave_tab_helpers.cc +++ b/browser/brave_tab_helpers.cc @@ -23,6 +23,7 @@ #include "brave/browser/misc_metrics/page_metrics_tab_helper.h" #include "brave/browser/misc_metrics/process_misc_metrics.h" #include "brave/browser/ntp_background/ntp_tab_helper.h" +#include "brave/browser/speedreader/speedreader_tab_helper.h" #include "brave/browser/ui/bookmark/brave_bookmark_tab_helper.h" #include "brave/browser/ui/brave_ui_features.h" #include "brave/components/ai_chat/content/browser/ai_chat_tab_helper.h" @@ -31,7 +32,6 @@ #include "brave/components/playlist/common/buildflags/buildflags.h" #include "brave/components/psst/browser/content/psst_tab_helper.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 "chrome/browser/browser_process.h" @@ -71,10 +71,6 @@ #include "brave/components/brave_wayback_machine/brave_wayback_machine_tab_helper.h" #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) -#include "brave/browser/speedreader/speedreader_tab_helper.h" -#endif - #if BUILDFLAG(ENABLE_TOR) #include "brave/components/tor/onion_location_tab_helper.h" #include "brave/components/tor/tor_tab_helper.h" @@ -155,9 +151,7 @@ void AttachTabHelpers(content::WebContents* web_contents) { WebDiscoveryTabHelper::MaybeCreateForWebContents(web_contents); #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) speedreader::SpeedreaderTabHelper::MaybeCreateForWebContents(web_contents); -#endif #if BUILDFLAG(ENABLE_TOR) tor::TorTabHelper::MaybeCreateForWebContents( diff --git a/browser/browser_context_keyed_service_factories.cc b/browser/browser_context_keyed_service_factories.cc index 51e3c0914561..95c1f51124b2 100644 --- a/browser/browser_context_keyed_service_factories.cc +++ b/browser/browser_context_keyed_service_factories.cc @@ -31,6 +31,7 @@ #include "brave/browser/search_engines/search_engine_provider_service_factory.h" #include "brave/browser/search_engines/search_engine_tracker.h" #include "brave/browser/skus/skus_service_factory.h" +#include "brave/browser/speedreader/speedreader_service_factory.h" #include "brave/browser/sync/brave_sync_alerts_service_factory.h" #include "brave/browser/url_sanitizer/url_sanitizer_service_factory.h" #include "brave/browser/webcompat_reporter/webcompat_reporter_service_factory.h" @@ -41,7 +42,6 @@ #include "brave/components/commander/common/buildflags/buildflags.h" #include "brave/components/playlist/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" #if BUILDFLAG(ENABLE_BRAVE_VPN) @@ -82,10 +82,6 @@ #include "brave/browser/ui/sidebar/sidebar_service_factory.h" #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) -#include "brave/browser/speedreader/speedreader_service_factory.h" -#endif - #if BUILDFLAG(ENABLE_REQUEST_OTR) #include "brave/browser/request_otr/request_otr_service_factory.h" #endif @@ -176,9 +172,7 @@ void EnsureBrowserContextKeyedServiceFactoriesBuilt() { sidebar::SidebarServiceFactory::GetInstance(); #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) speedreader::SpeedreaderServiceFactory::GetInstance(); -#endif ai_chat::AIChatServiceFactory::GetInstance(); ai_chat::ModelServiceFactory::GetInstance(); diff --git a/browser/extensions/BUILD.gn b/browser/extensions/BUILD.gn index 240757b27579..9a878dd015b7 100644 --- a/browser/extensions/BUILD.gn +++ b/browser/extensions/BUILD.gn @@ -8,7 +8,6 @@ import("//brave/components/brave_vpn/common/buildflags/buildflags.gni") import("//brave/components/brave_wayback_machine/buildflags/buildflags.gni") import("//brave/components/brave_webtorrent/browser/buildflags/buildflags.gni") import("//brave/components/playlist/common/buildflags/buildflags.gni") -import("//brave/components/speedreader/common/buildflags/buildflags.gni") import("//brave/components/tor/buildflags/buildflags.gni") import("//build/config/features.gni") import("//build/config/ui.gni") @@ -160,6 +159,7 @@ source_set("extensions") { "//brave/components/ntp_background_images/common", "//brave/components/request_otr/common", "//brave/components/sidebar/browser", + "//brave/components/speedreader", "//brave/components/tor/buildflags", "//brave/components/webcompat_reporter/common", "//chrome/browser:browser_process", @@ -191,10 +191,6 @@ source_set("extensions") { deps += [ "//brave/components/brave_wayback_machine" ] } - if (enable_speedreader) { - deps += [ "//brave/components/speedreader" ] - } - if (enable_brave_vpn) { deps += [ "//brave/components/brave_vpn/common" ] } diff --git a/browser/extensions/api/settings_private/brave_prefs_util.cc b/browser/extensions/api/settings_private/brave_prefs_util.cc index c3fc2d0ca927..5a5c3f778f29 100644 --- a/browser/extensions/api/settings_private/brave_prefs_util.cc +++ b/browser/extensions/api/settings_private/brave_prefs_util.cc @@ -22,7 +22,7 @@ #include "brave/components/omnibox/browser/brave_omnibox_prefs.h" #include "brave/components/playlist/common/buildflags/buildflags.h" #include "brave/components/request_otr/common/pref_names.h" -#include "brave/components/speedreader/common/buildflags/buildflags.h" +#include "brave/components/speedreader/speedreader_pref_names.h" #include "brave/components/tor/buildflags/buildflags.h" #include "brave/components/webcompat_reporter/common/pref_names.h" #include "chrome/browser/extensions/api/settings_private/prefs_util.h" @@ -42,10 +42,6 @@ #include "brave/components/sidebar/browser/pref_names.h" #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) -#include "brave/components/speedreader/speedreader_pref_names.h" -#endif - #if BUILDFLAG(ENABLE_TOR) #include "brave/components/tor/pref_names.h" #endif @@ -159,10 +155,8 @@ const PrefsUtil::TypedPrefMap& BravePrefsUtil::GetAllowlistedKeys() { (*s_brave_allowlist)[sidebar::kSidebarShowOption] = settings_api::PrefType::kNumber; #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) (*s_brave_allowlist)[speedreader::kSpeedreaderPrefEnabled] = settings_api::PrefType::kBoolean; -#endif // De-AMP feature (*s_brave_allowlist)[de_amp::kDeAmpPrefEnabled] = settings_api::PrefType::kBoolean; diff --git a/browser/perf/brave_perf_features_processor.cc b/browser/perf/brave_perf_features_processor.cc index f66cd6c41216..8ee02eaaad42 100644 --- a/browser/perf/brave_perf_features_processor.cc +++ b/browser/perf/brave_perf_features_processor.cc @@ -17,14 +17,11 @@ #include "brave/components/brave_shields/content/browser/ad_block_service.h" #include "brave/components/brave_shields/core/browser/ad_block_component_service_manager.h" #include "brave/components/brave_shields/core/common/brave_shield_constants.h" +#include "brave/components/speedreader/speedreader_pref_names.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_switches.h" #include "components/prefs/pref_service.h" -#if BUILDFLAG(ENABLE_SPEEDREADER) -#include "brave/components/speedreader/speedreader_pref_names.h" -#endif - namespace { void FakeCallback(brave_rewards::mojom::CreateRewardsWalletResult) {} @@ -74,10 +71,8 @@ void MaybeEnableBraveFeatureForPerfTesting(Profile* profile) { true); profile->GetPrefs()->SetBoolean(brave_news::prefs::kBraveNewsOptedIn, true); -#if BUILDFLAG(ENABLE_SPEEDREADER) // Speedreader profile->GetPrefs()->SetBoolean(speedreader::kSpeedreaderPrefEnabled, true); -#endif profile->GetPrefs()->SetTime(ai_chat::prefs::kLastAcceptedDisclaimer, base::Time::Now()); diff --git a/browser/perf/brave_perf_features_processor_browsertest.cc b/browser/perf/brave_perf_features_processor_browsertest.cc index 0dcbdf986b2a..76baa5bbd9ad 100644 --- a/browser/perf/brave_perf_features_processor_browsertest.cc +++ b/browser/perf/brave_perf_features_processor_browsertest.cc @@ -6,12 +6,13 @@ #include "base/scoped_observation.h" #include "brave/browser/brave_rewards/rewards_service_factory.h" #include "brave/browser/perf/brave_perf_switches.h" +#include "brave/browser/speedreader/speedreader_service_factory.h" #include "brave/components/ai_chat/core/browser/utils.h" #include "brave/components/brave_ads/core/public/prefs/pref_names.h" #include "brave/components/brave_news/common/pref_names.h" #include "brave/components/brave_rewards/browser/rewards_service.h" #include "brave/components/brave_rewards/browser/rewards_service_observer.h" -#include "brave/components/speedreader/common/buildflags/buildflags.h" +#include "brave/components/speedreader/speedreader_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" @@ -19,11 +20,6 @@ #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" -#if BUILDFLAG(ENABLE_SPEEDREADER) -#include "brave/browser/speedreader/speedreader_service_factory.h" -#include "brave/components/speedreader/speedreader_service.h" -#endif - namespace { class TestRewardsServiceObserver : public brave_rewards::RewardsServiceObserver { @@ -57,14 +53,12 @@ class BraveSpeedFeatureProcessorBrowserTest : public InProcessBrowserTest { perf::switches::kEnableBraveFeaturesForPerfTesting); } -#if BUILDFLAG(ENABLE_SPEEDREADER) bool SpeedreaderIsEnabled() { auto* speedreader_service = speedreader::SpeedreaderServiceFactory::GetForBrowserContext( browser()->profile()); return speedreader_service->IsEnabledForAllSites(); } -#endif // BUILDFLAG(ENABLE_SPEEDREADER) bool BraveNewsAreEnabled() { return brave_news::IsEnabled(browser()->profile()->GetPrefs()); @@ -88,9 +82,7 @@ IN_PROC_BROWSER_TEST_F(BraveSpeedFeatureProcessorBrowserTest, PRE_Default) { } IN_PROC_BROWSER_TEST_F(BraveSpeedFeatureProcessorBrowserTest, Default) { -#if BUILDFLAG(ENABLE_SPEEDREADER) EXPECT_TRUE(SpeedreaderIsEnabled()); -#endif EXPECT_TRUE(HasOptedInToNotificationAds()); EXPECT_TRUE(BraveNewsAreEnabled()); WaitForRewardsServiceInitialized(); diff --git a/browser/perf/sources.gni b/browser/perf/sources.gni index cc5ed6dda16e..9080565c5f03 100644 --- a/browser/perf/sources.gni +++ b/browser/perf/sources.gni @@ -3,8 +3,6 @@ # 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/speedreader/common/buildflags/buildflags.gni") - brave_browser_perf_sources = [ "//brave/browser/perf/brave_perf_features_processor.cc", "//brave/browser/perf/brave_perf_features_processor.h", @@ -18,9 +16,6 @@ brave_browser_perf_deps = [ "//brave/components/brave_shields/content/browser", "//brave/components/brave_shields/core/browser", "//brave/components/brave_shields/core/common/", + "//brave/components/speedreader", "//components/prefs", ] - -if (enable_speedreader) { - brave_browser_perf_deps += [ "//brave/components/speedreader" ] -} diff --git a/browser/sources.gni b/browser/sources.gni index b6f6c3e9c4d5..70290548ac64 100644 --- a/browser/sources.gni +++ b/browser/sources.gni @@ -214,7 +214,8 @@ brave_chrome_browser_deps = [ "//brave/components/skus/common:mojom", "//brave/components/speech_to_text", "//brave/components/speech_to_text:buildflags", - "//brave/components/speedreader/common/buildflags", + "//brave/components/speedreader/common", + "//brave/components/speedreader/common:mojom", "//brave/components/tor/buildflags", "//brave/components/version_info", "//brave/components/webcompat/content/browser", @@ -338,13 +339,6 @@ if (enable_sparkle) { ] } -if (enable_speedreader) { - brave_chrome_browser_deps += [ - "//brave/components/speedreader/common", - "//brave/components/speedreader/common:mojom", - ] -} - if (enable_request_otr) { brave_chrome_browser_deps += [ "//brave/components/request_otr/common" ] } diff --git a/browser/speedreader/sources.gni b/browser/speedreader/sources.gni index d6d702660fc4..92a06a97e103 100644 --- a/browser/speedreader/sources.gni +++ b/browser/speedreader/sources.gni @@ -3,34 +3,27 @@ # 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/components/speedreader/common/buildflags/buildflags.gni") +brave_browser_speedreader_sources = [ + "//brave/browser/speedreader/page_distiller.cc", + "//brave/browser/speedreader/page_distiller.h", + "//brave/browser/speedreader/speedreader_service_factory.cc", + "//brave/browser/speedreader/speedreader_service_factory.h", + "//brave/browser/speedreader/speedreader_tab_helper.cc", + "//brave/browser/speedreader/speedreader_tab_helper.h", +] -brave_browser_speedreader_sources = [] -brave_browser_speedreader_deps = [] +brave_browser_speedreader_deps = [ + "//base", + "//brave/components/speedreader", + "//chrome/browser/profiles:profile", + "//components/keyed_service/content", + "//components/keyed_service/core", + "//content/public/browser", +] -if (enable_speedreader) { - brave_browser_speedreader_sources += [ - "//brave/browser/speedreader/page_distiller.cc", - "//brave/browser/speedreader/page_distiller.h", - "//brave/browser/speedreader/speedreader_service_factory.cc", - "//brave/browser/speedreader/speedreader_service_factory.h", - "//brave/browser/speedreader/speedreader_tab_helper.cc", - "//brave/browser/speedreader/speedreader_tab_helper.h", - ] +if (is_android) { + brave_browser_speedreader_sources += + [ "//brave/browser/android/speedreader/speedreader_utils.cc" ] - brave_browser_speedreader_deps += [ - "//base", - "//brave/components/speedreader", - "//chrome/browser/profiles:profile", - "//components/keyed_service/content", - "//components/keyed_service/core", - "//content/public/browser", - ] - - if (is_android) { - brave_browser_speedreader_sources += - [ "//brave/browser/android/speedreader/speedreader_utils.cc" ] - - brave_browser_speedreader_deps += [ "//brave/build/android:jni_headers" ] - } + brave_browser_speedreader_deps += [ "//brave/build/android:jni_headers" ] } diff --git a/browser/ui/BUILD.gn b/browser/ui/BUILD.gn index cd400c78f3d8..8d0423520a0d 100644 --- a/browser/ui/BUILD.gn +++ b/browser/ui/BUILD.gn @@ -14,7 +14,6 @@ import("//brave/components/commander/common/buildflags/buildflags.gni") import("//brave/components/ntp_background_images/buildflags/buildflags.gni") import("//brave/components/playlist/common/buildflags/buildflags.gni") import("//brave/components/request_otr/common/buildflags/buildflags.gni") -import("//brave/components/speedreader/common/buildflags/buildflags.gni") import("//brave/components/text_recognition/common/buildflags/buildflags.gni") import("//brave/components/tor/buildflags/buildflags.gni") import("//build/config/features.gni") @@ -36,7 +35,6 @@ group("ui_public_dependencies") { ":brave_tab_prefs", "//brave/components/brave_wayback_machine/buildflags", "//brave/components/playlist/common/buildflags", - "//brave/components/speedreader/common/buildflags", ] } @@ -337,7 +335,6 @@ source_set("ui") { "//brave/components/misc_metrics", "//brave/components/sidebar/browser", "//brave/components/sidebar/common", - "//brave/components/speedreader/common/buildflags", "//chrome/app:generated_resources", "//chrome/browser/content_settings:content_settings_factory", "//chrome/browser/favicon", @@ -990,7 +987,7 @@ source_set("ui") { } } - if (enable_speedreader && !is_android) { + if (!is_android) { deps += [ "//brave/components/speedreader" ] sources += [ diff --git a/browser/ui/brave_browser_command_controller.cc b/browser/ui/brave_browser_command_controller.cc index 6684ac369a8d..046dc636ea63 100644 --- a/browser/ui/brave_browser_command_controller.cc +++ b/browser/ui/brave_browser_command_controller.cc @@ -29,7 +29,7 @@ #include "brave/components/commander/common/buildflags/buildflags.h" #include "brave/components/commands/common/features.h" #include "brave/components/playlist/common/buildflags/buildflags.h" -#include "brave/components/speedreader/common/buildflags/buildflags.h" +#include "brave/components/speedreader/common/features.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/profile.h" @@ -52,10 +52,6 @@ #include "brave/components/brave_vpn/common/pref_names.h" #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) -#include "brave/components/speedreader/common/features.h" -#endif - #if BUILDFLAG(ENABLE_PLAYLIST_WEBUI) #include "brave/browser/playlist/playlist_service_factory.h" #include "brave/components/playlist/common/features.h" @@ -265,11 +261,9 @@ void BraveBrowserCommandController::InitBraveCommandState() { UpdateCommandEnabled(IDC_COPY_CLEAN_LINK, true); UpdateCommandEnabled(IDC_TOGGLE_TAB_MUTE, true); -#if BUILDFLAG(ENABLE_SPEEDREADER) if (base::FeatureList::IsEnabled(speedreader::kSpeedreaderFeature)) { UpdateCommandEnabled(IDC_SPEEDREADER_ICON_ONCLICK, true); } -#endif #if BUILDFLAG(ENABLE_COMMANDER) UpdateCommandEnabled(IDC_COMMANDER, commander::IsEnabled()); diff --git a/browser/ui/brave_browser_window.h b/browser/ui/brave_browser_window.h index 21dbbe518b7c..6d93a9b75c2a 100644 --- a/browser/ui/brave_browser_window.h +++ b/browser/ui/brave_browser_window.h @@ -10,7 +10,6 @@ #include "brave/components/brave_wayback_machine/buildflags/buildflags.h" #include "brave/components/playlist/common/buildflags/buildflags.h" -#include "brave/components/speedreader/common/buildflags/buildflags.h" #include "chrome/browser/ui/browser_window.h" namespace content { @@ -23,13 +22,11 @@ class Sidebar; } // namespace sidebar #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) namespace speedreader { class SpeedreaderBubbleView; class SpeedreaderTabHelper; enum class SpeedreaderBubbleLocation : int; } // namespace speedreader -#endif class BraveBrowserWindow : public BrowserWindow { public: @@ -44,13 +41,11 @@ class BraveBrowserWindow : public BrowserWindow { // the overall screen's height virtual gfx::Rect GetShieldsBubbleRect(); -#if BUILDFLAG(ENABLE_SPEEDREADER) virtual speedreader::SpeedreaderBubbleView* ShowSpeedreaderBubble( speedreader::SpeedreaderTabHelper* tab_helper, speedreader::SpeedreaderBubbleLocation location); virtual void ShowReaderModeToolbar() {} virtual void HideReaderModeToolbar() {} -#endif #if defined(TOOLKIT_VIEWS) virtual sidebar::Sidebar* InitSidebar(); diff --git a/browser/ui/browser_commands.cc b/browser/ui/browser_commands.cc index 7c19b8366885..57ac7331af37 100644 --- a/browser/ui/browser_commands.cc +++ b/browser/ui/browser_commands.cc @@ -22,6 +22,8 @@ #include "brave/app/brave_command_ids.h" #include "brave/browser/brave_shields/brave_shields_tab_helper.h" #include "brave/browser/debounce/debounce_service_factory.h" +#include "brave/browser/speedreader/speedreader_service_factory.h" +#include "brave/browser/speedreader/speedreader_tab_helper.h" #include "brave/browser/ui/bookmark/brave_bookmark_prefs.h" #include "brave/browser/ui/brave_browser.h" #include "brave/browser/ui/sidebar/sidebar_service_factory.h" @@ -35,7 +37,7 @@ #include "brave/components/debounce/core/browser/debounce_service.h" #include "brave/components/query_filter/utils.h" #include "brave/components/sidebar/browser/sidebar_service.h" -#include "brave/components/speedreader/common/buildflags/buildflags.h" +#include "brave/components/speedreader/speedreader_service.h" #include "brave/components/tor/buildflags/buildflags.h" #include "brave/components/url_sanitizer/browser/url_sanitizer_service.h" #include "chrome/browser/bookmarks/bookmark_html_writer.h" @@ -78,12 +80,6 @@ #include "chrome/browser/ui/views/side_panel/side_panel_ui.h" #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) -#include "brave/browser/speedreader/speedreader_service_factory.h" -#include "brave/browser/speedreader/speedreader_tab_helper.h" -#include "brave/components/speedreader/speedreader_service.h" -#endif - #if BUILDFLAG(ENABLE_TOR) #include "brave/browser/tor/tor_profile_manager.h" #include "brave/browser/tor/tor_profile_service_factory.h" @@ -238,7 +234,6 @@ void NewTorConnectionForSite(Browser* browser) { } void MaybeDistillAndShowSpeedreaderBubble(Browser* browser) { -#if BUILDFLAG(ENABLE_SPEEDREADER) WebContents* contents = browser->tab_strip_model()->GetActiveWebContents(); if (!contents) { return; @@ -247,7 +242,6 @@ void MaybeDistillAndShowSpeedreaderBubble(Browser* browser) { speedreader::SpeedreaderTabHelper::FromWebContents(contents)) { tab_helper->ProcessIconClick(); } -#endif // BUILDFLAG(ENABLE_SPEEDREADER) } void ShowBraveVPNBubble(Browser* browser) { diff --git a/browser/ui/color/brave_color_id.h b/browser/ui/color/brave_color_id.h index 019a49ab415a..b5d5aa4805ab 100644 --- a/browser/ui/color/brave_color_id.h +++ b/browser/ui/color/brave_color_id.h @@ -8,7 +8,6 @@ #include "brave/components/brave_vpn/common/buildflags/buildflags.h" #include "brave/components/brave_wayback_machine/buildflags/buildflags.h" -#include "brave/components/speedreader/common/buildflags/buildflags.h" #include "chrome/browser/ui/color/chrome_color_id.h" // clang-format off @@ -70,7 +69,6 @@ E_CPONLY(kColorSidebarPanelHeaderButton) \ E_CPONLY(kColorSidebarPanelHeaderButtonHovered) -#if BUILDFLAG(ENABLE_SPEEDREADER) #define BRAVE_SPEEDREADER_COLOR_IDS \ E_CPONLY(kColorSpeedreaderIcon) \ E_CPONLY(kColorSpeedreaderToggleThumb) \ @@ -82,9 +80,6 @@ E_CPONLY(kColorSpeedreaderToolbarButtonActive) \ E_CPONLY(kColorSpeedreaderToolbarButtonActiveText)\ E_CPONLY(kColorSpeedreaderToolbarButtonBorder) -#else -#define BRAVE_SPEEDREADER_COLOR_IDS -#endif #if BUILDFLAG(ENABLE_BRAVE_VPN) #define BRAVE_VPN_COLOR_IDS \ diff --git a/browser/ui/color/brave_color_mixer.cc b/browser/ui/color/brave_color_mixer.cc index 5a293a4956ca..239893d216af 100644 --- a/browser/ui/color/brave_color_mixer.cc +++ b/browser/ui/color/brave_color_mixer.cc @@ -13,7 +13,6 @@ #include "brave/components/brave_vpn/common/buildflags/buildflags.h" #include "brave/components/brave_wayback_machine/buildflags/buildflags.h" #include "brave/components/playlist/common/buildflags/buildflags.h" -#include "brave/components/speedreader/common/buildflags/buildflags.h" #include "brave/ui/color/nala/nala_color_id.h" #include "chrome/browser/themes/theme_properties.h" #include "chrome/browser/ui/color/chrome_color_id.h" @@ -67,7 +66,7 @@ bool HasCustomToolbarColor(const ui::ColorProviderKey& key) { &custom_toolbar_color); } -#if BUILDFLAG(ENABLE_BRAVE_VPN) || BUILDFLAG(ENABLE_SPEEDREADER) +#if BUILDFLAG(ENABLE_BRAVE_VPN) SkColor PickSimilarColorToToolbar(const ui::ColorProviderKey& key, const ui::ColorMixer& mixer, SkColor light_theme_color, @@ -144,7 +143,6 @@ void AddBraveVpnColorMixer(ui::ColorProvider* provider, } #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) void AddBraveSpeedreaderColorMixer(ui::ColorProvider* provider, const ui::ColorProviderKey& key) { ui::ColorMixer& mixer = provider->AddMixer(); @@ -174,7 +172,6 @@ void AddBraveSpeedreaderColorMixer(ui::ColorProvider* provider, nala::kColorIconInteractive}; mixer[kColorSpeedreaderToolbarButtonBorder] = {nala::kColorDividerSubtle}; } -#endif void AddChromeLightThemeColorMixer(ui::ColorProvider* provider, const ui::ColorProviderKey& key) { @@ -516,9 +513,7 @@ void AddBraveThemeColorMixer(ui::ColorProvider* provider, #if BUILDFLAG(ENABLE_BRAVE_VPN) AddBraveVpnColorMixer(provider, key); #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) AddBraveSpeedreaderColorMixer(provider, key); -#endif auto& mixer = provider->AddMixer(); mixer[kColorIconBase] = {nala::kColorIconDefault}; diff --git a/browser/ui/color/sources.gni b/browser/ui/color/sources.gni index 4a67c3f5f9bd..5b078ecb81fd 100644 --- a/browser/ui/color/sources.gni +++ b/browser/ui/color/sources.gni @@ -25,7 +25,6 @@ if (!is_android) { "//brave/components/brave_vpn/common/buildflags", "//brave/components/brave_wayback_machine/buildflags", "//brave/components/playlist/common", - "//brave/components/speedreader/common/buildflags", "//skia", "//ui/color", "//ui/gfx", diff --git a/browser/ui/views/brave_actions/brave_shields_action_view.cc b/browser/ui/views/brave_actions/brave_shields_action_view.cc index 32f26c333286..b69fc8336e63 100644 --- a/browser/ui/views/brave_actions/brave_shields_action_view.cc +++ b/browser/ui/views/brave_actions/brave_shields_action_view.cc @@ -11,13 +11,13 @@ #include "base/check_deref.h" #include "base/memory/weak_ptr.h" +#include "brave/browser/speedreader/speedreader_tab_helper.h" #include "brave/browser/ui/brave_icon_with_badge_image_source.h" #include "brave/browser/ui/webui/brave_shields/shields_panel_ui.h" #include "brave/components/constants/pref_names.h" #include "brave/components/constants/url_constants.h" #include "brave/components/constants/webui_url_constants.h" #include "brave/components/l10n/common/localization_util.h" -#include "brave/components/speedreader/common/buildflags/buildflags.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/layout_constants.h" #include "chrome/browser/ui/omnibox/omnibox_theme.h" @@ -46,10 +46,6 @@ #include "ui/views/view_class_properties.h" #include "url/gurl.h" -#if BUILDFLAG(ENABLE_SPEEDREADER) -#include "brave/browser/speedreader/speedreader_tab_helper.h" -#endif - namespace { constexpr SkColor kBadgeBg = SkColorSetRGB(0x63, 0x64, 0x72); class BraveShieldsActionViewHighlightPathGenerator @@ -233,13 +229,11 @@ bool BraveShieldsActionView::IsPageInReaderMode( if (!web_contents) { return false; } -#if BUILDFLAG(ENABLE_SPEEDREADER) if (auto* speedreader_tab_helper = speedreader::SpeedreaderTabHelper::FromWebContents(web_contents)) { return speedreader::DistillStates::IsDistilled( speedreader_tab_helper->PageDistillState()); } -#endif return false; } diff --git a/browser/ui/views/frame/brave_browser_view.cc b/browser/ui/views/frame/brave_browser_view.cc index f999c22b6e4c..f57a892b5c79 100644 --- a/browser/ui/views/frame/brave_browser_view.cc +++ b/browser/ui/views/frame/brave_browser_view.cc @@ -19,6 +19,7 @@ #include "base/task/sequenced_task_runner.h" #include "brave/browser/brave_rewards/rewards_service_factory.h" #include "brave/browser/sparkle_buildflags.h" +#include "brave/browser/speedreader/speedreader_tab_helper.h" #include "brave/browser/translate/brave_translate_utils.h" #include "brave/browser/ui/brave_browser.h" #include "brave/browser/ui/brave_rewards/rewards_panel_coordinator.h" @@ -43,6 +44,7 @@ #include "brave/browser/ui/views/location_bar/brave_location_bar_view.h" #include "brave/browser/ui/views/omnibox/brave_omnibox_view_views.h" #include "brave/browser/ui/views/sidebar/sidebar_container_view.h" +#include "brave/browser/ui/views/speedreader/reader_mode_bubble.h" #include "brave/browser/ui/views/speedreader/reader_mode_toolbar_view.h" #include "brave/browser/ui/views/split_view/split_view_location_bar.h" #include "brave/browser/ui/views/split_view/split_view_separator.h" @@ -53,7 +55,6 @@ #include "brave/browser/ui/views/window_closing_confirm_dialog_view.h" #include "brave/components/commands/common/features.h" #include "brave/components/constants/pref_names.h" -#include "brave/components/speedreader/common/buildflags/buildflags.h" #include "brave/ui/color/nala/nala_color_id.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/app_mode/app_mode_utils.h" @@ -100,11 +101,6 @@ #include "brave/browser/ui/views/update_recommended_message_box_mac.h" #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) -#include "brave/browser/speedreader/speedreader_tab_helper.h" -#include "brave/browser/ui/views/speedreader/reader_mode_bubble.h" -#endif - #if BUILDFLAG(ENABLE_BRAVE_WAYBACK_MACHINE) #include "brave/browser/ui/views/wayback_machine_bubble_view.h" #endif @@ -687,8 +683,6 @@ void BraveBrowserView::SetStarredState(bool is_starred) { } } -#if BUILDFLAG(ENABLE_SPEEDREADER) - speedreader::SpeedreaderBubbleView* BraveBrowserView::ShowSpeedreaderBubble( speedreader::SpeedreaderTabHelper* tab_helper, speedreader::SpeedreaderBubbleLocation location) { @@ -742,7 +736,6 @@ void BraveBrowserView::HideReaderModeToolbar() { DeprecatedLayoutImmediately(); } } -#endif // BUILDFLAG(ENABLE_SPEEDREADER) void BraveBrowserView::ShowUpdateChromeDialog() { #if BUILDFLAG(ENABLE_SPARKLE) diff --git a/browser/ui/views/frame/brave_browser_view.h b/browser/ui/views/frame/brave_browser_view.h index 40fbd122f9a2..aca4e9857c09 100644 --- a/browser/ui/views/frame/brave_browser_view.h +++ b/browser/ui/views/frame/brave_browser_view.h @@ -19,6 +19,7 @@ #include "brave/browser/ui/tabs/brave_tab_strip_model.h" #include "brave/browser/ui/tabs/split_view_browser_data.h" #include "brave/browser/ui/tabs/split_view_browser_data_observer.h" +#include "brave/browser/ui/views/speedreader/reader_mode_toolbar_view.h" #include "brave/components/brave_vpn/common/buildflags/buildflags.h" #include "brave/components/brave_wayback_machine/buildflags/buildflags.h" #include "brave/components/commands/browser/accelerator_pref_manager.h" @@ -33,17 +34,11 @@ #include "brave/browser/ui/views/toolbar/brave_vpn_panel_controller.h" #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) -#include "brave/browser/ui/views/speedreader/reader_mode_toolbar_view.h" -#endif - -#if BUILDFLAG(ENABLE_SPEEDREADER) namespace speedreader { class SpeedreaderBubbleView; class SpeedreaderTabHelper; enum class SpeedreaderBubbleLocation : int; } // namespace speedreader -#endif namespace content { class WebContents; @@ -92,13 +87,11 @@ class BraveBrowserView : public BrowserView, void StartTabCycling() override; views::View* GetAnchorViewForBraveVPNPanel(); gfx::Rect GetShieldsBubbleRect() override; -#if BUILDFLAG(ENABLE_SPEEDREADER) speedreader::SpeedreaderBubbleView* ShowSpeedreaderBubble( speedreader::SpeedreaderTabHelper* tab_helper, speedreader::SpeedreaderBubbleLocation location) override; void ShowReaderModeToolbar() override; void HideReaderModeToolbar() override; -#endif bool GetTabStripVisible() const override; #if BUILDFLAG(IS_WIN) bool GetSupportsTitle() const override; @@ -228,9 +221,7 @@ class BraveBrowserView : public BrowserView, BraveVPNPanelController vpn_panel_controller_{this}; #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) std::unique_ptr reader_mode_toolbar_view_; -#endif std::unique_ptr tab_cycling_event_handler_; std::unique_ptr contents_shadow_; diff --git a/browser/ui/views/page_action/brave_page_action_icon_container_view.cc b/browser/ui/views/page_action/brave_page_action_icon_container_view.cc index a9f262f959eb..09bbf4872219 100644 --- a/browser/ui/views/page_action/brave_page_action_icon_container_view.cc +++ b/browser/ui/views/page_action/brave_page_action_icon_container_view.cc @@ -8,17 +8,13 @@ #include "base/check_is_test.h" #include "brave/browser/ui/page_action/brave_page_action_icon_type.h" #include "brave/components/playlist/common/features.h" -#include "brave/components/speedreader/common/buildflags/buildflags.h" +#include "brave/components/speedreader/common/features.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sharing_hub/sharing_hub_features.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/views/page_action/page_action_icon_params.h" #include "ui/base/metadata/metadata_impl_macros.h" -#if BUILDFLAG(ENABLE_SPEEDREADER) -#include "brave/components/speedreader/common/features.h" -#endif - namespace { PageActionIconParams& ModifyIconParamsForBrave(PageActionIconParams& params) { @@ -50,7 +46,6 @@ PageActionIconParams& ModifyIconParamsForBrave(PageActionIconParams& params) { } } -#if BUILDFLAG(ENABLE_SPEEDREADER) if (base::FeatureList::IsEnabled(speedreader::kSpeedreaderFeature)) { if (params.browser) { params.types_enabled.insert( @@ -61,7 +56,6 @@ PageActionIconParams& ModifyIconParamsForBrave(PageActionIconParams& params) { brave::kSpeedreaderPageActionIconType); } } -#endif return params; } diff --git a/browser/ui/webui/brave_settings_ui.cc b/browser/ui/webui/brave_settings_ui.cc index 46e260683808..9a8f98b818c5 100644 --- a/browser/ui/webui/brave_settings_ui.cc +++ b/browser/ui/webui/brave_settings_ui.cc @@ -44,7 +44,7 @@ #include "brave/components/commands/common/features.h" #include "brave/components/ntp_background_images/browser/view_counter_service.h" #include "brave/components/playlist/common/buildflags/buildflags.h" -#include "brave/components/speedreader/common/buildflags/buildflags.h" +#include "brave/components/speedreader/common/features.h" #include "brave/components/tor/buildflags/buildflags.h" #include "brave/components/version_info/version_info.h" #include "build/build_config.h" @@ -62,10 +62,6 @@ #include "brave/browser/ui/webui/settings/pin_shortcut_handler.h" #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) -#include "brave/components/speedreader/common/features.h" -#endif - #if BUILDFLAG(ENABLE_BRAVE_VPN) #include "brave/browser/brave_vpn/brave_vpn_service_factory.h" #include "brave/browser/brave_vpn/vpn_utils.h" @@ -165,11 +161,9 @@ void BraveSettingsUI::AddResources(content::WebUIDataSource* html_source, brave_vpn::features::kBraveVPNEnableWireguardForOSX)); #endif // BUILDFLAG(IS_MAC) && BUILDFLAG(ENABLE_BRAVE_VPN_WIREGUARD) #endif // BUILDFLAG(ENABLE_BRAVE_VPN) -#if BUILDFLAG(ENABLE_SPEEDREADER) html_source->AddBoolean( "isSpeedreaderFeatureEnabled", base::FeatureList::IsEnabled(speedreader::kSpeedreaderFeature)); -#endif html_source->AddBoolean( "isNativeBraveWalletFeatureEnabled", base::FeatureList::IsEnabled( diff --git a/chromium_src/chrome/browser/ui/views/page_action/page_action_icon_controller.cc b/chromium_src/chrome/browser/ui/views/page_action/page_action_icon_controller.cc index fc901bc1f262..a44daec39dd8 100644 --- a/chromium_src/chrome/browser/ui/views/page_action/page_action_icon_controller.cc +++ b/chromium_src/chrome/browser/ui/views/page_action/page_action_icon_controller.cc @@ -6,8 +6,8 @@ #include "brave/browser/ui/page_action/brave_page_action_icon_type.h" #include "brave/browser/ui/views/location_bar/brave_star_view.h" #include "brave/browser/ui/views/page_action/wayback_machine_action_icon_view.h" +#include "brave/browser/ui/views/speedreader/speedreader_icon_view.h" #include "brave/components/playlist/common/buildflags/buildflags.h" -#include "brave/components/speedreader/common/buildflags/buildflags.h" #include "chrome/browser/ui/page_action/page_action_icon_type.h" #include "chrome/browser/ui/views/page_action/page_action_icon_view.h" @@ -18,13 +18,6 @@ constexpr bool kSupportsPlaylistActionIconView = true; constexpr bool kSupportsPlaylistActionIconView = false; #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) -#include "brave/browser/ui/views/speedreader/speedreader_icon_view.h" -constexpr bool kSupportsSpeedreaderActionIconView = true; -#else -constexpr bool kSupportsSpeedreaderActionIconView = false; -#endif - // Circumvent creation of CookieControlsIconView in // PageActionIconController::Init's switch statement by injecting a case // with a non-existent value created above. @@ -47,12 +40,10 @@ constexpr bool kSupportsSpeedreaderActionIconView = false; params.page_action_icon_delegate)); \ break; \ case brave::kSpeedreaderPageActionIconType: \ - if constexpr (kSupportsSpeedreaderActionIconView) { \ - add_page_action_icon( \ - type, std::make_unique( \ - params.command_updater, params.icon_label_bubble_delegate, \ - params.page_action_icon_delegate)); \ - } \ + add_page_action_icon( \ + type, std::make_unique( \ + params.command_updater, params.icon_label_bubble_delegate, \ + params.page_action_icon_delegate)); \ break; \ case brave::kUndefinedPageActionIconType @@ -64,9 +55,11 @@ constexpr bool kSupportsSpeedreaderActionIconView = false; // trigger: // DCHECK_LE(static_cast(sample), // static_cast(T::kMaxValue)); -#define kShown kShown); \ - if (static_cast(type) < 0) \ - return; (false +#define kShown kShown); \ + if (static_cast(type) < 0) { \ + return; \ + } \ + (false #define StarView BraveStarView #include "src/chrome/browser/ui/views/page_action/page_action_icon_controller.cc" diff --git a/components/resources/BUILD.gn b/components/resources/BUILD.gn index f54488abe62a..4df71e1b93ba 100644 --- a/components/resources/BUILD.gn +++ b/components/resources/BUILD.gn @@ -8,7 +8,6 @@ import("//brave/components/ai_rewriter/common/buildflags/buildflags.gni") import("//brave/components/brave_vpn/common/buildflags/buildflags.gni") import("//brave/components/playlist/common/buildflags/buildflags.gni") import("//brave/components/playlist/common/buildflags/buildflags.gni") -import("//brave/components/speedreader/common/buildflags/buildflags.gni") import("//brave/components/tor/buildflags/buildflags.gni") import("//brave/resources/brave_grit.gni") import("//build/config/locales.gni") @@ -44,7 +43,6 @@ brave_grit("static_resources") { "enable_brave_vpn=$enable_brave_vpn", "enable_playlist_webui=$enable_playlist_webui", "enable_playlist=$enable_playlist", - "enable_speedreader=$enable_speedreader", ] output_dir = "$root_gen_dir/components" @@ -156,7 +154,6 @@ brave_grit("strings") { outputs = [ "grit/brave_components_strings.h" ] defines = [ - "enable_speedreader=$enable_speedreader", "ethereum_remote_client_enabled=$ethereum_remote_client_enabled", "enable_tor=$enable_tor", "enable_brave_vpn=$enable_brave_vpn", diff --git a/components/resources/speedreader_resources.grdp b/components/resources/speedreader_resources.grdp index 7c887053a1cd..53c535df9750 100644 --- a/components/resources/speedreader_resources.grdp +++ b/components/resources/speedreader_resources.grdp @@ -1,12 +1,10 @@ - - - - - - - - + + + + + + diff --git a/components/resources/speedreader_strings.grdp b/components/resources/speedreader_strings.grdp index f0347947be66..dfa233f2eaee 100644 --- a/components/resources/speedreader_strings.grdp +++ b/components/resources/speedreader_strings.grdp @@ -1,46 +1,44 @@ - - View original - min. read + View original + min. read - - Turn off Speedreader - Turn on Speedreader - Always use Speedreader for this site - - Toggle to turn on/off Speedreader for this website. - - Always use Speedreader for all sites - - Toggle to turn on/off Speedreader for all websites. - - Not all sites provide Speedreader capabilities. - Speedreader - Close - Exit Speedreader - Voice - Tune Speedreader - Appearance settings - Light theme - Sepia theme - Dark theme - System theme - Sans - Serif - Monospace - Dyslexic - Decrease the font size - Increase the font size - Narrow content column - Wide content column - Text to speech - Rewind - Play/Pause - Forward - Decrease the playback speed - Increase the playback speed - Leo - - + + Turn off Speedreader + Turn on Speedreader + Always use Speedreader for this site + + Toggle to turn on/off Speedreader for this website. + + Always use Speedreader for all sites + + Toggle to turn on/off Speedreader for all websites. + + Not all sites provide Speedreader capabilities. + Speedreader + Close + Exit Speedreader + Voice + Tune Speedreader + Appearance settings + Light theme + Sepia theme + Dark theme + System theme + Sans + Serif + Monospace + Dyslexic + Decrease the font size + Increase the font size + Narrow content column + Wide content column + Text to speech + Rewind + Play/Pause + Forward + Decrease the playback speed + Increase the playback speed + Leo + diff --git a/components/speedreader/BUILD.gn b/components/speedreader/BUILD.gn index 4479d5bc09f4..4245476f914d 100644 --- a/components/speedreader/BUILD.gn +++ b/components/speedreader/BUILD.gn @@ -1,17 +1,12 @@ # 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/. - -import("//brave/components/speedreader/common/buildflags/buildflags.gni") - -assert(enable_speedreader) +# You can obtain one at https://mozilla.org/MPL/2.0/. static_library("speedreader") { public_deps = [ "rust/ffi", "//brave/components/speedreader/common", - "//brave/components/speedreader/common/buildflags", ] sources = [ diff --git a/components/speedreader/common/BUILD.gn b/components/speedreader/common/BUILD.gn index ff68c42845d1..5eca98c7536c 100644 --- a/components/speedreader/common/BUILD.gn +++ b/components/speedreader/common/BUILD.gn @@ -3,11 +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/speedreader/common/buildflags/buildflags.gni") import("//mojo/public/tools/bindings/mojom.gni") -assert(enable_speedreader) - static_library("common") { sources = [ "constants.h", diff --git a/components/speedreader/common/buildflags/BUILD.gn b/components/speedreader/common/buildflags/BUILD.gn deleted file mode 100644 index e52c3455459c..000000000000 --- a/components/speedreader/common/buildflags/BUILD.gn +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2022 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/speedreader/common/buildflags/buildflags.gni") -import("//build/buildflag_header.gni") - -buildflag_header("buildflags") { - header = "buildflags.h" - flags = [ "ENABLE_SPEEDREADER=$enable_speedreader" ] -} diff --git a/components/speedreader/common/buildflags/buildflags.gni b/components/speedreader/common/buildflags/buildflags.gni deleted file mode 100644 index 54ec8731d25f..000000000000 --- a/components/speedreader/common/buildflags/buildflags.gni +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2022 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() { - enable_speedreader = true -} diff --git a/components/speedreader/renderer/BUILD.gn b/components/speedreader/renderer/BUILD.gn index 81e985f01abe..5169f2fcdeed 100644 --- a/components/speedreader/renderer/BUILD.gn +++ b/components/speedreader/renderer/BUILD.gn @@ -1,6 +1,7 @@ -import("//brave/components/speedreader/common/buildflags/buildflags.gni") - -assert(enable_speedreader) +# Copyright (c) 2022 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/. source_set("renderer") { sources = [ diff --git a/renderer/BUILD.gn b/renderer/BUILD.gn index e3687c91e256..1ed94895837a 100644 --- a/renderer/BUILD.gn +++ b/renderer/BUILD.gn @@ -5,7 +5,6 @@ import("//brave/components/ai_rewriter/common/buildflags/buildflags.gni") import("//brave/components/brave_vpn/common/buildflags/buildflags.gni") -import("//brave/components/speedreader/common/buildflags/buildflags.gni") import("//build/config/features.gni") source_set("renderer") { @@ -24,6 +23,7 @@ source_set("renderer") { "//brave/components/brave_shields/core/common", "//brave/components/brave_wallet/renderer", "//brave/components/cosmetic_filters/renderer", + "//brave/components/speedreader/renderer", "//brave/renderer/brave_wallet/", "//v8", ] @@ -32,10 +32,6 @@ source_set("renderer") { deps += [ "//brave/components/ai_rewriter/renderer" ] } - if (enable_speedreader) { - deps += [ "//brave/components/speedreader/renderer" ] - } - if (is_android) { deps += [ "//brave/components/brave_mobile_subscription/renderer/android" ] } diff --git a/renderer/brave_content_renderer_client.cc b/renderer/brave_content_renderer_client.cc index ba2e1a390aed..c99e78a0edef 100644 --- a/renderer/brave_content_renderer_client.cc +++ b/renderer/brave_content_renderer_client.cc @@ -23,7 +23,8 @@ #include "brave/components/script_injector/renderer/script_injector_render_frame_observer.h" #include "brave/components/skus/common/features.h" #include "brave/components/skus/renderer/skus_render_frame_observer.h" -#include "brave/components/speedreader/common/buildflags/buildflags.h" +#include "brave/components/speedreader/common/features.h" +#include "brave/components/speedreader/renderer/speedreader_render_frame_observer.h" #include "brave/renderer/brave_render_frame_observer.h" #include "brave/renderer/brave_render_thread_observer.h" #include "brave/renderer/brave_wallet/brave_wallet_render_frame_observer.h" @@ -46,11 +47,6 @@ #include "brave/components/ai_rewriter/renderer/ai_rewriter_agent.h" #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) -#include "brave/components/speedreader/common/features.h" -#include "brave/components/speedreader/renderer/speedreader_render_frame_observer.h" -#endif - #if BUILDFLAG(ENABLE_BRAVE_VPN) #include "brave/components/brave_vpn/common/brave_vpn_utils.h" #if BUILDFLAG(IS_ANDROID) @@ -182,12 +178,10 @@ void BraveContentRendererClient::RenderFrameCreated( } #endif -#if BUILDFLAG(ENABLE_SPEEDREADER) if (base::FeatureList::IsEnabled(speedreader::kSpeedreaderFeature)) { new speedreader::SpeedreaderRenderFrameObserver( render_frame, ISOLATED_WORLD_ID_BRAVE_INTERNAL); } -#endif #if BUILDFLAG(ENABLE_PLAYLIST) if (base::FeatureList::IsEnabled(playlist::features::kPlaylist) && diff --git a/renderer/sources.gni b/renderer/sources.gni index acf76f158060..2398cd655479 100644 --- a/renderer/sources.gni +++ b/renderer/sources.gni @@ -6,7 +6,6 @@ import("//brave/components/ai_rewriter/common/buildflags/buildflags.gni") import("//brave/components/brave_vpn/common/buildflags/buildflags.gni") import("//brave/components/playlist/common/buildflags/buildflags.gni") -import("//brave/components/speedreader/common/buildflags/buildflags.gni") import("//brave/components/tor/buildflags/buildflags.gni") import("//third_party/widevine/cdm/widevine.gni") @@ -36,7 +35,8 @@ brave_chrome_renderer_deps = [ "//brave/components/script_injector/renderer", "//brave/components/skus/common", "//brave/components/skus/renderer", - "//brave/components/speedreader/common/buildflags", + "//brave/components/speedreader/common", + "//brave/components/speedreader/renderer", "//brave/components/tor/buildflags", "//brave/renderer/brave_wallet", "//mojo/public/cpp/bindings", @@ -48,13 +48,6 @@ if (enable_tor) { brave_chrome_renderer_deps += [ "//brave/components/tor/renderer" ] } -if (enable_speedreader) { - brave_chrome_renderer_deps += [ - "//brave/components/speedreader/common", - "//brave/components/speedreader/renderer", - ] -} - if (enable_playlist) { brave_chrome_renderer_deps += [ "//brave/components/playlist/renderer" ] } diff --git a/test/BUILD.gn b/test/BUILD.gn index 67a718b37572..045e79fed1a7 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -13,7 +13,6 @@ import("//brave/components/brave_webtorrent/browser/buildflags/buildflags.gni") import("//brave/components/ntp_background_images/buildflags/buildflags.gni") import("//brave/components/playlist/common/buildflags/buildflags.gni") import("//brave/components/request_otr/common/buildflags/buildflags.gni") -import("//brave/components/speedreader/common/buildflags/buildflags.gni") import("//brave/components/tor/buildflags/buildflags.gni") import("//brave/test/testing.gni") import("//brave/updater/config.gni") @@ -127,6 +126,8 @@ test("brave_unit_tests") { "//brave/components/ntp_background_images/browser/view_counter_service_unittest.cc", "//brave/components/ntp_widget_utils/browser/ntp_widget_utils_oauth_unittest.cc", "//brave/components/ntp_widget_utils/browser/ntp_widget_utils_region_unittest.cc", + "//brave/components/speedreader/speedreader_rewriter_unittest.cc", + "//brave/components/speedreader/speedreader_util_unittest.cc", "//brave/components/time_period_storage/daily_storage_unittest.cc", "//brave/components/time_period_storage/time_period_storage_unittest.cc", "//brave/components/time_period_storage/weekly_event_storage_unittest.cc", @@ -258,6 +259,7 @@ test("brave_unit_tests") { "//brave/components/signin/public/identity_manager:unit_tests", "//brave/components/skus/browser:unit_tests", "//brave/components/skus/renderer:unit_tests", + "//brave/components/speedreader", "//brave/components/sync/engine:unit_tests", "//brave/components/sync/service:unit_tests", "//brave/components/time_period_storage", @@ -555,15 +557,6 @@ test("brave_unit_tests") { deps += [ "//brave/components/brave_wayback_machine" ] } - - if (enable_speedreader) { - sources += [ - "//brave/components/speedreader/speedreader_rewriter_unittest.cc", - "//brave/components/speedreader/speedreader_util_unittest.cc", - ] - - deps += [ "//brave/components/speedreader" ] - } } source_set("crypto_unittests") { @@ -769,6 +762,7 @@ test("brave_browser_tests") { "//brave/browser/renderer_context_menu/brave_spelling_menu_observer_browsertest.cc", "//brave/browser/search_engines/search_engine_provider_service_browsertest.cc", "//brave/browser/search_engines/search_engine_tracker_browsertest.cc", + "//brave/browser/speedreader/speedreader_browsertest.cc", "//brave/browser/themes/brave_theme_service_browsertest.cc", "//brave/browser/translate/brave_translate_browsertest.cc", "//brave/browser/ui/bookmark/bookmark_tab_helper_browsertest.cc", @@ -867,6 +861,7 @@ test("brave_browser_tests") { "//brave/browser/web_discovery:browser_tests", "//brave/common", "//brave/components/ai_chat/core/browser", + "//brave/components/ai_chat/core/common", "//brave/components/brave_ads/browser", "//brave/components/brave_ads/core", "//brave/components/brave_component_updater/browser", @@ -913,7 +908,8 @@ test("brave_browser_tests") { "//brave/components/ntp_background_images/common", "//brave/components/resources:strings_grit", "//brave/components/skus/common", - "//brave/components/speedreader/common/buildflags", + "//brave/components/speedreader", + "//brave/components/speedreader/common:mojom", "//brave/components/tor/buildflags", "//brave/components/url_sanitizer/browser", "//brave/components/webcompat/content/browser", @@ -935,6 +931,7 @@ test("brave_browser_tests") { "//chrome/browser/sync:sync", "//chrome/browser/ui", "//chrome/browser/ui:browser_navigator_params_headers", + "//chrome/browser/ui/browser_window", "//chrome/browser/ui/color:color_headers", "//chrome/browser/ui/color:mixers", "//chrome/browser/ui/hats", @@ -954,6 +951,7 @@ test("brave_browser_tests") { "//components/gcm_driver:gcm_buildflags", "//components/history_clusters/core", "//components/javascript_dialogs", + "//components/language/core/browser:browser", "//components/language/core/common", "//components/lens", "//components/metrics_services_manager", @@ -1053,17 +1051,6 @@ test("brave_browser_tests") { deps += [ "//brave/components/brave_wayback_machine" ] } - if (enable_speedreader) { - sources += [ "//brave/browser/speedreader/speedreader_browsertest.cc" ] - deps += [ - "//brave/components/ai_chat/core/common", - "//brave/components/speedreader", - "//brave/components/speedreader/common:mojom", - "//chrome/browser/ui/browser_window", - "//components/language/core/browser:browser", - ] - } - if (enable_playlist) { deps += [ "//brave/browser/playlist/test:browser_tests", diff --git a/test/base/testing_brave_browser_process.cc b/test/base/testing_brave_browser_process.cc index 7b3b79748b1c..6fdd2750a597 100644 --- a/test/base/testing_brave_browser_process.cc +++ b/test/base/testing_brave_browser_process.cc @@ -140,12 +140,10 @@ TestingBraveBrowserProcess::ntp_background_images_service() { return nullptr; } -#if BUILDFLAG(ENABLE_SPEEDREADER) speedreader::SpeedreaderRewriterService* TestingBraveBrowserProcess::speedreader_rewriter_service() { return nullptr; } -#endif brave_ads::ResourceComponent* TestingBraveBrowserProcess::resource_component() { return nullptr; diff --git a/test/base/testing_brave_browser_process.h b/test/base/testing_brave_browser_process.h index 099fff971320..5041a143b6cc 100644 --- a/test/base/testing_brave_browser_process.h +++ b/test/base/testing_brave_browser_process.h @@ -74,10 +74,8 @@ class TestingBraveBrowserProcess : public BraveBrowserProcess { brave_ads::BraveStatsHelper* ads_brave_stats_helper() override; ntp_background_images::NTPBackgroundImagesService* ntp_background_images_service() override; -#if BUILDFLAG(ENABLE_SPEEDREADER) speedreader::SpeedreaderRewriterService* speedreader_rewriter_service() override; -#endif brave_ads::ResourceComponent* resource_component() override; #if BUILDFLAG(ENABLE_BRAVE_VPN) brave_vpn::BraveVPNConnectionManager* brave_vpn_connection_manager() override; diff --git a/ui/webui/resources/BUILD.gn b/ui/webui/resources/BUILD.gn index 3caa87bbaaf8..772bda12cfa0 100644 --- a/ui/webui/resources/BUILD.gn +++ b/ui/webui/resources/BUILD.gn @@ -5,7 +5,6 @@ import("//brave/components/brave_vpn/common/buildflags/buildflags.gni") import("//brave/components/common/typescript.gni") -import("//brave/components/speedreader/common/buildflags/buildflags.gni") import("//tools/grit/preprocess_if_expr.gni") import("//tools/polymer/css_to_wrapper.gni") import("//tools/polymer/html_to_wrapper.gni") @@ -149,6 +148,7 @@ leo_icons = [ "arrow-small-right.svg", "arrow-small-up.svg", "arrow-undo.svg", + "aurora-color.svg", "autoplay-off.svg", "autoplay-on.svg", "backward.svg", @@ -156,7 +156,6 @@ leo_icons = [ "bar-chart.svg", "bat-color.svg", "bing-color.svg", - "social-leo-favicon-fullheight-color.svg", "bluetooth-off.svg", "bluetooth.svg", "brave-icon-outline.svg", @@ -174,22 +173,25 @@ leo_icons = [ "carat-left.svg", "carat-right.svg", "carat-up.svg", + "characters.svg", "check-circle-filled.svg", "check-circle-outline.svg", "check-normal.svg", "checkbox-checked.svg", "checkbox-unchecked.svg", "clock.svg", + "close-circle.svg", "close.svg", "cloud-download.svg", "cloud-off.svg", "code-off.svg", "code.svg", + "coinbase-color.svg", "coins-alt1.svg", "coins.svg", + "content-big.svg", "cookie-off.svg", "cookie.svg", - "content-big.svg", "copy-off.svg", "copy-plain-text.svg", "copy.svg", @@ -208,6 +210,7 @@ leo_icons = [ "edit-box.svg", "edit-pencil.svg", "erase.svg", + "eth-color.svg", "ethereum-off.svg", "ethereum-on.svg", "expand.svg", @@ -217,9 +220,10 @@ leo_icons = [ "file-edit.svg", "file-text.svg", "file.svg", + "filecoin-color.svg", "files-many.svg", - "filter.svg", "filter-settings.svg", + "filter.svg", "finger-double-tap.svg", "flash.svg", "flashdrive.svg", @@ -228,18 +232,21 @@ leo_icons = [ "font-size-off.svg", "font-size.svg", "forward-15.svg", + "forward-outline.svg", "fullscreen-on.svg", "google-color.svg", "graph.svg", "grid04.svg", "hamburger-menu.svg", "hand-coins.svg", + "headphones.svg", "hearts.svg", "help-outline.svg", "history.svg", "idea.svg", "image-off.svg", "image.svg", + "import-arrow.svg", "info-filled.svg", "info-outline.svg", "junk-false.svg", @@ -262,12 +269,15 @@ leo_icons = [ "loop-1-toggle-on.svg", "loop-all-toggle-on.svg", "loop-all.svg", + "matic-color.svg", "media-visualizer-off.svg", "media-visualizer.svg", "message-bubble-comments.svg", "message-bubble-text.svg", + "metamask-color.svg", "microphone-off.svg", "microphone.svg", + "minus.svg", "money-bag-coins.svg", "more-horizontal.svg", "more-vertical.svg", @@ -300,10 +310,14 @@ leo_icons = [ "nft.svg", "notification-off.svg", "notification.svg", + "op-color.svg", "pause-filled.svg", + "pause-outline.svg", "percent.svg", + "phantom-color.svg", "picture-in-picture.svg", "play-filled.svg", + "play-outline.svg", "plus-add-circle.svg", "plus-add.svg", "previous-outline.svg", @@ -318,6 +332,7 @@ leo_icons = [ "product-playlist-bold-add-color.svg", "product-playlist.svg", "product-private-window.svg", + "product-speedreader.svg", "product-sync.svg", "product-translate.svg", "product-vpn.svg", @@ -327,53 +342,66 @@ leo_icons = [ "qwant-color.svg", "radio-checked.svg", "radio-unchecked.svg", + "readermode-column-default.svg", + "readermode-column-wide.svg", + "readermode-dislexyc.svg", + "readermode-mono.svg", + "readermode-sans.svg", + "readermode-serif.svg", "refresh.svg", "remove-circle-filled.svg", "remove-circle-outline.svg", "rewind-15.svg", + "rewind-outline.svg", "rocket.svg", "safe.svg", "search-fuel-tank.svg", "search-zoom-in.svg", "search.svg", - "send.svg", "send-filled.svg", + "send.svg", "settings.svg", "share-macos.svg", - "shield-done.svg", "shield-done-filled.svg", + "shield-done.svg", "shield-star.svg", "shuffle-off.svg", "shuffle-on.svg", "shuffle-toggle-on.svg", - "sidepanel-open.svg", "sidenav-collapse.svg", "sidenav-expand.svg", + "sidepanel-open.svg", + "slash.svg", "smartphone-desktop-off.svg", "smartphone-desktop.svg", "smartphone-hand.svg", "social-brave-release-favicon-fullheight-color.svg", "social-dribbble.svg", "social-github.svg", + "social-leo-favicon-fullheight-color.svg", "social-reddit.svg", "social-twitch.svg", "social-vimeo.svg", "social-x.svg", "social-youtube.svg", + "sol-color.svg", "solana-off.svg", "solana-on.svg", "sort-asc.svg", "sort-desc.svg", "sparkles-off.svg", "sparkles.svg", + "speed.svg", "stack.svg", "star-outline.svg", "startpage-color.svg", "swap-horizontal.svg", "swap-vertical.svg", + "theme-system.svg", "thumb-down.svg", "thumb-up.svg", "trash.svg", + "trezor-color.svg", "tune.svg", "uphold-color.svg", "usb-off.svg", @@ -391,37 +419,24 @@ leo_icons = [ "virtual-reality.svg", "volume-off.svg", "volume-on.svg", + "wallet-ledger.svg", "warning-circle-filled.svg", "warning-circle-outline.svg", "warning-triangle-filled.svg", "warning-triangle-outline.svg", - "web3.svg", "web3-blockexplorer.svg", "web3-bridge.svg", + "web3.svg", "widget-generic.svg", "window-content.svg", "window-tab-close.svg", "window-tab-new.svg", + "window-tabs-vertical-expanded.svg", "window.svg", "windows-open.svg", - "import-arrow.svg", - "metamask-color.svg", - "phantom-color.svg", - "coinbase-color.svg", - "trezor-color.svg", - "wallet-ledger.svg", - "close-circle.svg", - "eth-color.svg", - "matic-color.svg", - "op-color.svg", - "aurora-color.svg", - "sol-color.svg", - "filecoin-color.svg", - "slash.svg", "xmark-color.svg", "yahoo-color.svg", "yandex-color.svg", - "window-tabs-vertical-expanded.svg", ] if (enable_brave_vpn_panel) { @@ -481,27 +496,6 @@ if (enable_brave_vpn_panel) { ] } -if (enable_speedreader) { - leo_icons += [ - "characters.svg", - "forward-outline.svg", - "headphones.svg", - "minus.svg", - "pause-outline.svg", - "play-outline.svg", - "product-speedreader.svg", - "readermode-column-default.svg", - "readermode-column-wide.svg", - "readermode-dislexyc.svg", - "readermode-mono.svg", - "readermode-sans.svg", - "readermode-serif.svg", - "rewind-outline.svg", - "speed.svg", - "theme-system.svg", - ] -} - generate_grd("icons_grdp") { grd_prefix = "brave_icons" resource_path_prefix = "brave-icons"