diff --git a/app/brave_generated_resources.grd b/app/brave_generated_resources.grd index 3c5da89b38e9..d9e453c5b1b4 100644 --- a/app/brave_generated_resources.grd +++ b/app/brave_generated_resources.grd @@ -261,6 +261,34 @@ By installing this extension, you are agreeing to the Google Widevine Terms of U Show autocomplete in address bar + + + New Tab Page + + + Customize your Brave Dashboard + + + Background images + + + Sponsored images + + + Brave Stats + + + Brave Rewards + + + Binance + + + Top Sites + + + Clock + New Tor Identity diff --git a/browser/extensions/api/settings_private/brave_prefs_util.cc b/browser/extensions/api/settings_private/brave_prefs_util.cc index 75f2eb7571b6..869ce93a035f 100644 --- a/browser/extensions/api/settings_private/brave_prefs_util.cc +++ b/browser/extensions/api/settings_private/brave_prefs_util.cc @@ -7,6 +7,7 @@ #include "brave/common/pref_names.h" #include "brave/components/brave_wayback_machine/buildflags.h" +#include "brave/components/ntp_background_images/common/pref_names.h" #include "chrome/browser/extensions/api/settings_private/prefs_util.h" #include "chrome/common/extensions/api/settings_private.h" #include "components/browsing_data/core/pref_names.h" @@ -62,6 +63,21 @@ const PrefsUtil::TypedPrefMap& BravePrefsUtil::GetWhitelistedKeys() { settings_api::PrefType::PREF_TYPE_BOOLEAN; (*s_brave_whitelist)[kAskWidevineInstall] = settings_api::PrefType::PREF_TYPE_BOOLEAN; + // new tab prefs + (*s_brave_whitelist)[ntp_background_images::prefs::kNewTabPageShowBrandedBackgroundImage] = + settings_api::PrefType::PREF_TYPE_BOOLEAN; + (*s_brave_whitelist)[ntp_background_images::prefs::kNewTabPageShowBackgroundImage] = + settings_api::PrefType::PREF_TYPE_BOOLEAN; + (*s_brave_whitelist)[kNewTabPageShowClock] = + settings_api::PrefType::PREF_TYPE_BOOLEAN; + (*s_brave_whitelist)[kNewTabPageShowTopSites] = + settings_api::PrefType::PREF_TYPE_BOOLEAN; + (*s_brave_whitelist)[kNewTabPageShowStats] = + settings_api::PrefType::PREF_TYPE_BOOLEAN; + (*s_brave_whitelist)[kNewTabPageShowRewards] = + settings_api::PrefType::PREF_TYPE_BOOLEAN; + (*s_brave_whitelist)[kNewTabPageShowBinance] = + settings_api::PrefType::PREF_TYPE_BOOLEAN; // Clear browsing data on exit prefs. (*s_brave_whitelist)[browsing_data::prefs::kDeleteBrowsingHistoryOnExit] = settings_api::PrefType::PREF_TYPE_BOOLEAN; diff --git a/browser/resources/settings/brave_icons.html b/browser/resources/settings/brave_icons.html index e2fc474264d4..b41d43db89bf 100644 --- a/browser/resources/settings/brave_icons.html +++ b/browser/resources/settings/brave_icons.html @@ -67,6 +67,10 @@ + + + diff --git a/browser/resources/settings/brave_new_tab_page/brave_new_tab_browser_proxy.html b/browser/resources/settings/brave_new_tab_page/brave_new_tab_browser_proxy.html new file mode 100644 index 000000000000..6ea9ea253f3a --- /dev/null +++ b/browser/resources/settings/brave_new_tab_page/brave_new_tab_browser_proxy.html @@ -0,0 +1,2 @@ + + diff --git a/browser/resources/settings/brave_new_tab_page/brave_new_tab_browser_proxy.js b/browser/resources/settings/brave_new_tab_page/brave_new_tab_browser_proxy.js new file mode 100644 index 000000000000..4fb581e596d5 --- /dev/null +++ b/browser/resources/settings/brave_new_tab_page/brave_new_tab_browser_proxy.js @@ -0,0 +1,20 @@ +/* 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 BraveNewTabBrowserProxy {} + + /** + * @implements {settings.BraveNewTabBrowserProxy} + */ + class BraveNewTabBrowserProxyImpl {} + + cr.addSingletonGetter(BraveNewTabBrowserProxyImpl); + + return { + BraveNewTabBrowserProxy, + BraveNewTabBrowserProxyImpl + }; +}); diff --git a/browser/resources/settings/brave_new_tab_page/brave_new_tab_page.html b/browser/resources/settings/brave_new_tab_page/brave_new_tab_page.html new file mode 100644 index 000000000000..485650ed9d31 --- /dev/null +++ b/browser/resources/settings/brave_new_tab_page/brave_new_tab_page.html @@ -0,0 +1,70 @@ + + + + + + + + + + + + diff --git a/browser/resources/settings/brave_new_tab_page/brave_new_tab_page.js b/browser/resources/settings/brave_new_tab_page/brave_new_tab_page.js new file mode 100644 index 000000000000..74f201f1a53e --- /dev/null +++ b/browser/resources/settings/brave_new_tab_page/brave_new_tab_page.js @@ -0,0 +1,37 @@ +/* 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-new-tab-page' is the settings page containing + * brave's new tab features. + */ + Polymer({ + is: 'settings-brave-new-tab-page', + + /** @private {?settings.BraveNewTabBrowserProxy} */ + browserProxy_: null, + + /** @override */ + created: function() { + this.browserProxy_ = settings.BraveNewTabBrowserProxyImpl.getInstance(); + }, + + toggleBrandedBackgroundOption_: function(isBackgroundEnabled, isBrandedBackgroundEnabled) { + // If background image setting is not turned ON, + // inform the back-end to also disable the branded wallpaper setting. + // We will later disable interacting with the button as well. + if (isBackgroundEnabled === false) { + return { + key: 'brave.new_tab_page.show_branded_background_image', + type: 'BOOLEAN', + value: false + }; + } + return isBrandedBackgroundEnabled; + }, + }); +})(); diff --git a/browser/resources/settings/brave_settings_overrides.html b/browser/resources/settings/brave_settings_overrides.html index 3c3549ad4f18..e76a847361e1 100644 --- a/browser/resources/settings/brave_settings_overrides.html +++ b/browser/resources/settings/brave_settings_overrides.html @@ -8,6 +8,7 @@ +