diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index ac5891acb7c2..3cf0f6b3c2ea 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -34,6 +34,10 @@ browser/net/ @iefremov # Widevine browser/widevine @simonhong +# Wayback machine +browser/ui/views/infobars/brave_wayback_machine_* @simonhong +components/brave_wayback_machine @simonhong + # Licensing of third-party components common/licenses/ @fmarier components/brave_new_tab_ui/data/backgrounds.ts @fmarier diff --git a/app/brave_generated_resources.grd b/app/brave_generated_resources.grd index 39eaa20de33c..40635c57456a 100644 --- a/app/brave_generated_resources.grd +++ b/app/brave_generated_resources.grd @@ -416,6 +416,13 @@ By installing this extension, you are agreeing to the Google Widevine Terms of U Access Sync via + + + Help Tips + + + Show Wayback Machine prompt on 404 pages + Light @@ -665,6 +672,19 @@ By installing this extension, you are agreeing to the Google Widevine Terms of U SETUP + + + Sorry, that page is missing. + + + Do you want to check if a saved version is available on the Wayback Machine? + + + Sorry, there is no saved version available. + + + Check for saved version + Brave is made available to you under the <a target="_blank" href="$1">Mozilla Public License 2.0</a> (MPL) and includes <a target="_blank" href="$2">open source software</a> under a variety of other licenses. diff --git a/app/theme/brave_theme_resources.grd b/app/theme/brave_theme_resources.grd index 549afeb570aa..8754433d62ef 100644 --- a/app/theme/brave_theme_resources.grd +++ b/app/theme/brave_theme_resources.grd @@ -15,6 +15,7 @@ + diff --git a/app/theme/default_100_percent/brave/brave_wayback_infobar.png b/app/theme/default_100_percent/brave/brave_wayback_infobar.png new file mode 100644 index 000000000000..653a4343d290 Binary files /dev/null and b/app/theme/default_100_percent/brave/brave_wayback_infobar.png differ diff --git a/app/theme/default_200_percent/brave/brave_wayback_infobar.png b/app/theme/default_200_percent/brave/brave_wayback_infobar.png new file mode 100644 index 000000000000..26d35775fa36 Binary files /dev/null and b/app/theme/default_200_percent/brave/brave_wayback_infobar.png differ diff --git a/app/vector_icons/BUILD.gn b/app/vector_icons/BUILD.gn index d41e704de078..a51b6430dd0b 100644 --- a/app/vector_icons/BUILD.gn +++ b/app/vector_icons/BUILD.gn @@ -10,6 +10,7 @@ aggregate_vector_icons("brave_vector_icons") { icons = [ "autoplay_status.icon", "download_unlock.icon", + "sad_folder.icon", "tor_profile.icon", ] } @@ -23,4 +24,4 @@ source_set("vector_icons") { "//skia", "//ui/gfx", ] -} \ No newline at end of file +} diff --git a/app/vector_icons/sad_folder.icon b/app/vector_icons/sad_folder.icon new file mode 100644 index 000000000000..feb23d8803f5 --- /dev/null +++ b/app/vector_icons/sad_folder.icon @@ -0,0 +1,51 @@ +// Copyright (c) 2019 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/. + +CANVAS_DIMENSIONS, 22, +MOVE_TO, 8.77f, 2.75f, +R_CUBIC_TO, 0.15f, 0, 0.29f, 0.04f, 0.41f, 0.13f, +LINE_TO, 11.23f, 4.26f, +R_H_LINE_TO, 7.22f, +R_CUBIC_TO, 0.82f, 0, 1.49f, 0.68f, 1.49f, 1.51f, +R_V_LINE_TO, 10.59f, +R_CUBIC_TO, 0, 0.83f, -0.67f, 1.51f, -1.49f, 1.51f, +H_LINE_TO, 3.55f, +R_CUBIC_TO, -0.82f, 0, -1.49f, -0.68f, -1.49f, -1.51f, +R_V_LINE_TO, -12.1f, +R_CUBIC_TO, 0, -0.83f, 0.67f, -1.51f, 1.49f, -1.51f, +H_LINE_TO, 8.77f, +CLOSE, +R_MOVE_TO, -0.23f, 1.51f, +R_H_LINE_TO, -4.99f, +R_V_LINE_TO, 12.1f, +H_LINE_TO, 18.45f, +V_LINE_TO, 5.78f, +R_H_LINE_TO, -7.44f, +R_CUBIC_TO, -0.07f, 0, -0.15f, -0.01f, -0.22f, -0.03f, +R_CUBIC_TO, -0.08f, -0.02f, -0.15f, -0.06f, -0.21f, -0.1f, +LINE_TO, 8.54f, 4.26f, +CLOSE, +MOVE_TO, 11, 11.07f, +R_CUBIC_TO, 1.18f, 0, 2.34f, 0.49f, 3.46f, 1.43f, +R_CUBIC_TO, 0.32f, 0.27f, 0.36f, 0.74f, 0.1f, 1.07f, +R_CUBIC_TO, -0.26f, 0.32f, -0.73f, 0.36f, -1.05f, 0.1f, +CUBIC_TO, 12.64f, 12.93f, 11.81f, 12.58f, 11, 12.58f, +R_CUBIC_TO, -0.81f, 0, -1.64f, 0.35f, -2.5f, 1.08f, +R_CUBIC_TO, -0.32f, 0.27f, -0.79f, 0.22f, -1.05f, -0.1f, +R_CUBIC_TO, -0.26f, -0.32f, -0.22f, -0.8f, 0.1f, -1.07f, +CUBIC_TO, 8.66f, 11.56f, 9.82f, 11.07f, 11, 11.07f, +CLOSE, +R_MOVE_TO, -2.23f, -3.02f, +R_CUBIC_TO, 0.41f, 0, 0.74f, 0.34f, 0.74f, 0.76f, +R_CUBIC_TO, 0, 0.42f, -0.33f, 0.76f, -0.74f, 0.76f, +R_CUBIC_TO, -0.41f, 0, -0.74f, -0.34f, -0.74f, -0.76f, +R_CUBIC_TO, 0, -0.42f, 0.33f, -0.76f, 0.74f, -0.76f, +CLOSE, +R_MOVE_TO, 4.47f, 0, +R_CUBIC_TO, 0.41f, 0, 0.74f, 0.34f, 0.74f, 0.76f, +R_CUBIC_TO, 0, 0.42f, -0.33f, 0.76f, -0.74f, 0.76f, +R_CUBIC_TO, -0.41f, 0, -0.74f, -0.34f, -0.74f, -0.76f, +R_CUBIC_TO, 0, -0.42f, 0.33f, -0.76f, 0.74f, -0.76f, +CLOSE diff --git a/browser/BUILD.gn b/browser/BUILD.gn index e310365042f3..e8bc52b4f6ec 100644 --- a/browser/BUILD.gn +++ b/browser/BUILD.gn @@ -3,6 +3,7 @@ import("//brave/browser/tor/buildflags/buildflags.gni") import("//brave/components/brave_ads/browser/buildflags/buildflags.gni") import("//brave/components/brave_sync/buildflags/buildflags.gni") import("//brave/components/brave_wallet/browser/buildflags/buildflags.gni") +import("//brave/components/brave_wayback_machine/buildflags/buildflags.gni") import("//brave/components/brave_webtorrent/browser/buildflags/buildflags.gni") import("//brave/components/greaselion/browser/buildflags/buildflags.gni") import("//build/buildflag_header.gni") @@ -118,9 +119,9 @@ source_set("browser_process") { "renderer_host", "ui", "//base", + "//brave/browser/notifications", "//brave/browser/tor:buildflags", "//brave/browser/translate/buildflags", - "//brave/browser/notifications", "//brave/common", "//brave/common:pref_names", "//brave/components/brave_ads/browser", @@ -130,6 +131,7 @@ source_set("browser_process") { "//brave/components/brave_rewards/browser", "//brave/components/brave_shields/browser", "//brave/components/brave_wallet/browser", + "//brave/components/brave_wayback_machine:buildflags", "//brave/components/brave_webtorrent/browser/buildflags", "//brave/components/content_settings/core/browser", "//brave/components/greaselion/browser/buildflags", @@ -263,6 +265,12 @@ source_set("browser_process") { ] } + if (enable_brave_wayback_machine) { + deps += [ + "//brave/components/brave_wayback_machine", + ] + } + if (enable_widevine) { sources += [ "brave_drm_tab_helper.cc", diff --git a/browser/brave_profile_prefs.cc b/browser/brave_profile_prefs.cc index 7835ce2baaa7..02f8f6f23c5f 100644 --- a/browser/brave_profile_prefs.cc +++ b/browser/brave_profile_prefs.cc @@ -8,6 +8,7 @@ #include "brave/common/pref_names.h" #include "brave/components/brave_shields/browser/brave_shields_web_contents_observer.h" #include "brave/components/brave_sync/brave_sync_prefs.h" +#include "brave/components/brave_wayback_machine/buildflags.h" #include "brave/components/brave_webtorrent/browser/buildflags/buildflags.h" #include "chrome/browser/net/prediction_options.h" #include "chrome/browser/prefs/session_startup_pref.h" @@ -38,6 +39,10 @@ #include "brave/browser/widevine/widevine_utils.h" #endif +#if BUILDFLAG(ENABLE_BRAVE_WAYBACK_MACHINE) +#include "brave/components/brave_wayback_machine/pref_names.h" +#endif + using extensions::FeatureSwitch; namespace brave { @@ -96,6 +101,11 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { webtorrent::RegisterProfilePrefs(registry); #endif + // wayback machine +#if BUILDFLAG(ENABLE_BRAVE_WAYBACK_MACHINE) + registry->RegisterBooleanPref(kBraveWaybackMachineEnabled, true); +#endif + #if defined(OS_ANDROID) registry->RegisterBooleanPref(kDesktopModeEnabled, false); registry->RegisterBooleanPref(kPlayYTVideoInBrowserEnabled, true); diff --git a/browser/brave_profile_prefs_browsertest.cc b/browser/brave_profile_prefs_browsertest.cc index 32bb2efa05bb..74d7babe6711 100644 --- a/browser/brave_profile_prefs_browsertest.cc +++ b/browser/brave_profile_prefs_browsertest.cc @@ -4,6 +4,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "brave/common/pref_names.h" +#include "brave/components/brave_wayback_machine/buildflags.h" #include "chrome/browser/net/prediction_options.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" @@ -20,6 +21,10 @@ #include "components/gcm_driver/gcm_channel_status_syncer.h" #endif +#if BUILDFLAG(ENABLE_BRAVE_WAYBACK_MACHINE) +#include "brave/components/brave_wayback_machine/pref_names.h" +#endif + using BraveProfilePrefsBrowserTest = InProcessBrowserTest; // Check download prompt preference is set to true by default. @@ -45,6 +50,10 @@ IN_PROC_BROWSER_TEST_F(BraveProfilePrefsBrowserTest, MiscBravePrefs) { browser()->profile()->GetPrefs()->GetBoolean(kLinkedInEmbedControlType)); EXPECT_TRUE( browser()->profile()->GetPrefs()->GetBoolean(kWebTorrentEnabled)); +#if BUILDFLAG(ENABLE_BRAVE_WAYBACK_MACHINE) + EXPECT_TRUE(browser()->profile()->GetPrefs()-> + GetBoolean(kBraveWaybackMachineEnabled)); +#endif EXPECT_TRUE( browser()->profile()->GetPrefs()->GetBoolean(kHangoutsEnabled)); EXPECT_FALSE( diff --git a/browser/brave_tab_helpers.cc b/browser/brave_tab_helpers.cc index cd7b808e16ad..d26758d091be 100644 --- a/browser/brave_tab_helpers.cc +++ b/browser/brave_tab_helpers.cc @@ -10,6 +10,7 @@ #include "brave/components/brave_rewards/browser/buildflags/buildflags.h" #include "brave/components/brave_shields/browser/brave_shields_web_contents_observer.h" #include "brave/components/brave_shields/browser/buildflags/buildflags.h" // For STP +#include "brave/components/brave_wayback_machine/buildflags.h" #include "brave/components/greaselion/browser/buildflags/buildflags.h" #include "content/public/browser/web_contents.h" #include "third_party/widevine/cdm/buildflags.h" @@ -36,6 +37,10 @@ #include "brave/browser/brave_drm_tab_helper.h" #endif +#if BUILDFLAG(ENABLE_BRAVE_WAYBACK_MACHINE) +#include "brave/browser/infobars/brave_wayback_machine_delegate_impl.h" +#endif + namespace brave { void AttachTabHelpers(content::WebContents* web_contents) { @@ -67,6 +72,10 @@ void AttachTabHelpers(content::WebContents* web_contents) { BraveDrmTabHelper::CreateForWebContents(web_contents); #endif +#if BUILDFLAG(ENABLE_BRAVE_WAYBACK_MACHINE) + BraveWaybackMachineDelegateImpl::AttachTabHelperIfNeeded(web_contents); +#endif + brave_ads::AdsTabHelper::CreateForWebContents(web_contents); } diff --git a/browser/extensions/BUILD.gn b/browser/extensions/BUILD.gn index a82b196fc2fd..0fad533b7e0b 100644 --- a/browser/extensions/BUILD.gn +++ b/browser/extensions/BUILD.gn @@ -2,6 +2,7 @@ import("//brave/browser/tor/buildflags/buildflags.gni") import("//brave/components/brave_rewards/browser/buildflags/buildflags.gni") import("//brave/components/brave_sync/buildflags/buildflags.gni") import("//brave/components/brave_wallet/browser/buildflags/buildflags.gni") +import("//brave/components/brave_wayback_machine/buildflags/buildflags.gni") import("//brave/components/brave_webtorrent/browser/buildflags/buildflags.gni") import("//build/config/features.gni") import("//components/gcm_driver/config.gni") @@ -61,6 +62,7 @@ source_set("extensions") { deps = [ "//base", "//brave/app:brave_generated_resources_grit", + "//brave/browser/tor:buildflags", "//brave/browser/webcompat_reporter", "//brave/common", "//brave/common:pref_names", @@ -68,6 +70,7 @@ source_set("extensions") { "//brave/components/brave_component_updater/browser", "//brave/components/brave_extension:generated_resources", "//brave/components/brave_extension:static_resources", + "//brave/components/brave_wayback_machine:buildflags", "//chrome/browser/extensions", "//components/gcm_driver:gcm_driver", "//components/gcm_driver:gcm_buildflags", @@ -115,9 +118,9 @@ source_set("extensions") { "brave_webtorrent_navigation_throttle.h", ] } - if (enable_tor) { + if (enable_brave_wayback_machine) { deps += [ - "//brave/browser/tor:buildflags", + "//brave/components/brave_wayback_machine", ] } } diff --git a/browser/extensions/api/brave_wallet_api_browsertest.cc b/browser/extensions/api/brave_wallet_api_browsertest.cc index f8df5e3b8830..bb4b2d1bfd9b 100644 --- a/browser/extensions/api/brave_wallet_api_browsertest.cc +++ b/browser/extensions/api/brave_wallet_api_browsertest.cc @@ -101,8 +101,8 @@ class BraveWalletAPIBrowserTest : public InProcessBrowserTest, for (size_t i = 0; i < infobar_service->infobar_count(); i++) { InfoBarDelegate* delegate = infobar_service->infobar_at(i)->delegate(); - if (delegate->GetIdentifier() == (InfoBarDelegate::InfoBarIdentifier) - CRYPTO_WALLETS_INFOBAR_DELEGATE) { + if (delegate->GetIdentifier() == + InfoBarDelegate::CRYPTO_WALLETS_INFOBAR_DELEGATE) { ConfirmInfoBarDelegate* confirm_delegate = delegate->AsConfirmInfoBarDelegate(); // Only the OK button should be present @@ -118,8 +118,8 @@ class BraveWalletAPIBrowserTest : public InProcessBrowserTest, for (size_t i = 0; i < infobar_service->infobar_count(); i++) { InfoBarDelegate* delegate = infobar_service->infobar_at(i)->delegate(); - if (delegate->GetIdentifier() == (InfoBarDelegate::InfoBarIdentifier) - CRYPTO_WALLETS_INFOBAR_DELEGATE) { + if (delegate->GetIdentifier() == + InfoBarDelegate::CRYPTO_WALLETS_INFOBAR_DELEGATE) { ConfirmInfoBarDelegate* confirm_delegate = delegate->AsConfirmInfoBarDelegate(); // Only the OK button should be present @@ -148,8 +148,7 @@ class BraveWalletAPIBrowserTest : public InProcessBrowserTest, void OnInfoBarAdded(InfoBar* infobar) override { if (infobar_added_run_loop_ && infobar->delegate()->GetIdentifier() == - (InfoBarDelegate::InfoBarIdentifier) - CRYPTO_WALLETS_INFOBAR_DELEGATE) { + InfoBarDelegate::CRYPTO_WALLETS_INFOBAR_DELEGATE) { infobar_added_ = true; infobar_added_run_loop_->Quit(); } diff --git a/browser/extensions/api/settings_private/brave_prefs_util.cc b/browser/extensions/api/settings_private/brave_prefs_util.cc index fe1f33027aef..fd28f976cbf7 100644 --- a/browser/extensions/api/settings_private/brave_prefs_util.cc +++ b/browser/extensions/api/settings_private/brave_prefs_util.cc @@ -6,6 +6,7 @@ #include "brave/browser/extensions/api/settings_private/brave_prefs_util.h" #include "brave/common/pref_names.h" +#include "brave/components/brave_wayback_machine/buildflags.h" #include "chrome/browser/extensions/api/settings_private/prefs_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/extensions/api/settings_private.h" @@ -16,6 +17,10 @@ #include "components/gcm_driver/gcm_channel_status_syncer.h" #endif +#if BUILDFLAG(ENABLE_BRAVE_WAYBACK_MACHINE) +#include "brave/components/brave_wayback_machine/pref_names.h" +#endif + namespace extensions { namespace settings_api = api::settings_private; @@ -90,6 +95,10 @@ const PrefsUtil::TypedPrefMap& BravePrefsUtil::GetWhitelistedKeys() { // WebTorrent pref (*s_brave_whitelist)[kWebTorrentEnabled] = settings_api::PrefType::PREF_TYPE_BOOLEAN; +#if BUILDFLAG(ENABLE_BRAVE_WAYBACK_MACHINE) + (*s_brave_whitelist)[kBraveWaybackMachineEnabled] = + settings_api::PrefType::PREF_TYPE_BOOLEAN; +#endif // Hangouts pref (*s_brave_whitelist)[kHangoutsEnabled] = settings_api::PrefType::PREF_TYPE_BOOLEAN; diff --git a/browser/infobars/BUILD.gn b/browser/infobars/BUILD.gn index 7f5225f69af4..3d31e8aa8b88 100644 --- a/browser/infobars/BUILD.gn +++ b/browser/infobars/BUILD.gn @@ -1,10 +1,10 @@ import("//build/config/features.gni") +import("//brave/components/brave_wayback_machine/buildflags/buildflags.gni") source_set("infobars") { sources = [ "brave_confirm_p3a_infobar_delegate.cc", "brave_confirm_p3a_infobar_delegate.h", - "brave_infobar_delegate.h", "crypto_wallets_infobar_delegate.cc", "crypto_wallets_infobar_delegate.h", ] @@ -23,4 +23,15 @@ source_set("infobars") { "//ui/views", "//url", ] + + if (enable_brave_wayback_machine) { + sources += [ + "brave_wayback_machine_delegate_impl.cc", + "brave_wayback_machine_delegate_impl.h", + ] + + deps += [ + "//brave/components/brave_wayback_machine", + ] + } } diff --git a/browser/infobars/brave_confirm_p3a_infobar_delegate.cc b/browser/infobars/brave_confirm_p3a_infobar_delegate.cc index fc283a19796b..9e469a3b5816 100644 --- a/browser/infobars/brave_confirm_p3a_infobar_delegate.cc +++ b/browser/infobars/brave_confirm_p3a_infobar_delegate.cc @@ -47,7 +47,7 @@ BraveConfirmP3AInfoBarDelegate::~BraveConfirmP3AInfoBarDelegate() {} infobars::InfoBarDelegate::InfoBarIdentifier BraveConfirmP3AInfoBarDelegate::GetIdentifier() const { - return (InfoBarIdentifier)BRAVE_CONFIRM_P3A_INFOBAR_DELEGATE; + return BRAVE_CONFIRM_P3A_INFOBAR_DELEGATE; } const gfx::VectorIcon& BraveConfirmP3AInfoBarDelegate::GetVectorIcon() const { diff --git a/browser/infobars/brave_confirm_p3a_infobar_delegate.h b/browser/infobars/brave_confirm_p3a_infobar_delegate.h index bef966ec6166..218a57d3b795 100644 --- a/browser/infobars/brave_confirm_p3a_infobar_delegate.h +++ b/browser/infobars/brave_confirm_p3a_infobar_delegate.h @@ -12,8 +12,6 @@ #include "components/infobars/core/confirm_infobar_delegate.h" #include "url/gurl.h" -#include "brave/browser/infobars/brave_infobar_delegate.h" - class InfoBarService; class PrefService; diff --git a/browser/infobars/brave_infobar_delegate.h b/browser/infobars/brave_infobar_delegate.h deleted file mode 100644 index 2cdebe285b05..000000000000 --- a/browser/infobars/brave_infobar_delegate.h +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright (c) 2019 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/. */ - -#ifndef BRAVE_BROWSER_INFOBARS_BRAVE_INFOBAR_DELEGATE_H_ -#define BRAVE_BROWSER_INFOBARS_BRAVE_INFOBAR_DELEGATE_H_ - -#include "components/infobars/core/infobar_delegate.h" - -enum BraveInfoBarIdentifier { - BRAVE_CONFIRM_P3A_INFOBAR_DELEGATE = 500, - CRYPTO_WALLETS_INFOBAR_DELEGATE = 501, -}; - -#endif // BRAVE_BROWSER_INFOBARS_BRAVE_INFOBAR_DELEGATE_H_ diff --git a/browser/infobars/brave_wayback_machine_delegate_impl.cc b/browser/infobars/brave_wayback_machine_delegate_impl.cc new file mode 100644 index 000000000000..2614a3411ade --- /dev/null +++ b/browser/infobars/brave_wayback_machine_delegate_impl.cc @@ -0,0 +1,39 @@ +/* Copyright (c) 2019 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/infobars/brave_wayback_machine_delegate_impl.h" + +#include "base/command_line.h" +#include "brave/common/brave_switches.h" +#include "brave/components/brave_wayback_machine/brave_wayback_machine_infobar_delegate.h" +#include "brave/components/brave_wayback_machine/brave_wayback_machine_tab_helper.h" +#include "components/infobars/core/infobar.h" +#include "chrome/browser/infobars/infobar_service.h" + +// static +void BraveWaybackMachineDelegateImpl::AttachTabHelperIfNeeded( + content::WebContents* web_contents) { + if (!base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kDisableBraveWaybackMachineExtension)) { + BraveWaybackMachineTabHelper::CreateForWebContents(web_contents); + auto* tab_helper = + BraveWaybackMachineTabHelper::FromWebContents(web_contents); + tab_helper->set_delegate( + std::make_unique()); + } +} + +BraveWaybackMachineDelegateImpl::BraveWaybackMachineDelegateImpl() = default; +BraveWaybackMachineDelegateImpl::~BraveWaybackMachineDelegateImpl() = default; + + +void BraveWaybackMachineDelegateImpl::CreateInfoBar( + content::WebContents* web_contents) { + InfoBarService::FromWebContents(web_contents)->AddInfoBar( + CreateInfoBarView( + std::make_unique(), + web_contents), + true); +} diff --git a/browser/infobars/brave_wayback_machine_delegate_impl.h b/browser/infobars/brave_wayback_machine_delegate_impl.h new file mode 100644 index 000000000000..f05295a43a09 --- /dev/null +++ b/browser/infobars/brave_wayback_machine_delegate_impl.h @@ -0,0 +1,42 @@ +/* Copyright (c) 2019 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/. */ + +#ifndef BRAVE_BROWSER_INFOBARS_BRAVE_WAYBACK_MACHINE_DELEGATE_IMPL_H_ +#define BRAVE_BROWSER_INFOBARS_BRAVE_WAYBACK_MACHINE_DELEGATE_IMPL_H_ + +#include + +#include "brave/components/brave_wayback_machine/brave_wayback_machine_delegate.h" + +namespace content { +class WebContents; +} // namespace content + +namespace infobars { +class InfoBar; +} // namespace infobars + +class BraveWaybackMachineDelegateImpl : public BraveWaybackMachineDelegate { + public: + static void AttachTabHelperIfNeeded(content::WebContents* web_contents); + + BraveWaybackMachineDelegateImpl(); + ~BraveWaybackMachineDelegateImpl() override; + + BraveWaybackMachineDelegateImpl( + const BraveWaybackMachineDelegateImpl&) = delete; + BraveWaybackMachineDelegateImpl& operator=( + const BraveWaybackMachineDelegateImpl&) = delete; + + private: + // BraveWaybackMachineDelegate overrides: + void CreateInfoBar(content::WebContents* web_contents) override; + + std::unique_ptr CreateInfoBarView( + std::unique_ptr delegate, + content::WebContents* contents); +}; + +#endif // BRAVE_BROWSER_INFOBARS_BRAVE_WAYBACK_MACHINE_DELEGATE_IMPL_H_ diff --git a/browser/infobars/crypto_wallets_infobar_delegate.cc b/browser/infobars/crypto_wallets_infobar_delegate.cc index c22af3c821e8..a7f98a211091 100644 --- a/browser/infobars/crypto_wallets_infobar_delegate.cc +++ b/browser/infobars/crypto_wallets_infobar_delegate.cc @@ -40,7 +40,7 @@ CryptoWalletsInfoBarDelegate::~CryptoWalletsInfoBarDelegate() {} infobars::InfoBarDelegate::InfoBarIdentifier CryptoWalletsInfoBarDelegate::GetIdentifier() const { - return (InfoBarIdentifier)CRYPTO_WALLETS_INFOBAR_DELEGATE; + return CRYPTO_WALLETS_INFOBAR_DELEGATE; } const gfx::VectorIcon& CryptoWalletsInfoBarDelegate::GetVectorIcon() const { diff --git a/browser/infobars/crypto_wallets_infobar_delegate.h b/browser/infobars/crypto_wallets_infobar_delegate.h index db1b20e3ae54..db79e053a6c2 100644 --- a/browser/infobars/crypto_wallets_infobar_delegate.h +++ b/browser/infobars/crypto_wallets_infobar_delegate.h @@ -12,8 +12,6 @@ #include "components/infobars/core/confirm_infobar_delegate.h" #include "url/gurl.h" -#include "brave/browser/infobars/brave_infobar_delegate.h" - class InfoBarService; class PrefService; diff --git a/browser/resources/settings/BUILD.gn b/browser/resources/settings/BUILD.gn index e86705b5669f..3cda4e79901b 100644 --- a/browser/resources/settings/BUILD.gn +++ b/browser/resources/settings/BUILD.gn @@ -1,5 +1,6 @@ import("//brave/browser/tor/buildflags/buildflags.gni") import("//brave/build/config.gni") +import("//brave/components/brave_wayback_machine/buildflags/buildflags.gni") import("//chrome/browser/resources/optimize_webui.gni") import("//chrome/common/features.gni") import("//tools/grit/grit_rule.gni") @@ -10,6 +11,7 @@ grit("resources") { defines = [ "is_release_channel=$is_release_channel", "enable_tor=$enable_tor", + "enable_brave_wayback_machine=$enable_brave_wayback_machine", ] source_is_generated = optimize_webui diff --git a/browser/resources/settings/brave_help_tips_page/brave_help_tips_browser_proxy.html b/browser/resources/settings/brave_help_tips_page/brave_help_tips_browser_proxy.html new file mode 100644 index 000000000000..215820238cdf --- /dev/null +++ b/browser/resources/settings/brave_help_tips_page/brave_help_tips_browser_proxy.html @@ -0,0 +1,2 @@ + + diff --git a/browser/resources/settings/brave_help_tips_page/brave_help_tips_browser_proxy.js b/browser/resources/settings/brave_help_tips_page/brave_help_tips_browser_proxy.js new file mode 100644 index 000000000000..bb0b1cfd1018 --- /dev/null +++ b/browser/resources/settings/brave_help_tips_page/brave_help_tips_browser_proxy.js @@ -0,0 +1,21 @@ +/* Copyright (c) 2019 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/. */ + + cr.define('settings', function() { + /** @interface */ + class BraveHelpTipsBrowserProxy {} + + /** + * @implements {settings.BraveHelpTipsBrowserProxy} + */ + class BraveHelpTipsBrowserProxyImpl {} + + cr.addSingletonGetter(BraveHelpTipsBrowserProxyImpl); + + return { + BraveHelpTipsBrowserProxy, + BraveHelpTipsBrowserProxyImpl + }; +}); diff --git a/browser/resources/settings/brave_help_tips_page/brave_help_tips_page.html b/browser/resources/settings/brave_help_tips_page/brave_help_tips_page.html new file mode 100644 index 000000000000..4b6a9fbde246 --- /dev/null +++ b/browser/resources/settings/brave_help_tips_page/brave_help_tips_page.html @@ -0,0 +1,18 @@ + + + + + + + + + + + + diff --git a/browser/resources/settings/brave_help_tips_page/brave_help_tips_page.js b/browser/resources/settings/brave_help_tips_page/brave_help_tips_page.js new file mode 100644 index 000000000000..cf67cb71eef7 --- /dev/null +++ b/browser/resources/settings/brave_help_tips_page/brave_help_tips_page.js @@ -0,0 +1,24 @@ +/* Copyright (c) 2019 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/. */ + +(function() { + 'use strict'; + + /** + * 'settings-brave-help-tips-page' is the settings page containing + * brave's help tips features. + */ + Polymer({ + is: 'settings-brave-help-tips-page', + + /** @private {?settings.BraveHelpTipsBrowserProxy} */ + browserProxy_: null, + + /** @override */ + created: function() { + this.browserProxy_ = settings.BraveHelpTipsBrowserProxyImpl.getInstance(); + }, + }); +})(); diff --git a/browser/resources/settings/brave_icons.html b/browser/resources/settings/brave_icons.html index 0dc185cb72d3..e2fc474264d4 100644 --- a/browser/resources/settings/brave_icons.html +++ b/browser/resources/settings/brave_icons.html @@ -63,6 +63,10 @@ + + + diff --git a/browser/resources/settings/brave_settings_overrides.html b/browser/resources/settings/brave_settings_overrides.html index 807b585071b8..3c3549ad4f18 100644 --- a/browser/resources/settings/brave_settings_overrides.html +++ b/browser/resources/settings/brave_settings_overrides.html @@ -7,6 +7,7 @@ +