-
Notifications
You must be signed in to change notification settings - Fork 892
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NTP: Add settings section for Dashboard options
Close brave/brave-browser#8760
- Loading branch information
1 parent
55ee211
commit 7e3d58a
Showing
11 changed files
with
212 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
browser/resources/settings/brave_new_tab_page/brave_new_tab_browser_proxy.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<link rel="href" src="chrome://resources/html/cr.html"> | ||
<script src="brave_new_tab_browser_proxy.js"></script> |
20 changes: 20 additions & 0 deletions
20
browser/resources/settings/brave_new_tab_page/brave_new_tab_browser_proxy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
}; | ||
}); |
70 changes: 70 additions & 0 deletions
70
browser/resources/settings/brave_new_tab_page/brave_new_tab_page.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<link rel="import" href="chrome://resources/html/polymer.html"> | ||
|
||
<link rel="import" href="chrome://resources/html/i18n_behavior.html"> | ||
<link rel="import" href="chrome://resources/cr_elements/md_select_css.html"> | ||
<link rel="import" href="brave_new_tab_browser_proxy.html"> | ||
<link rel="import" href="../settings_shared_css.html"> | ||
<link rel="import" href="../settings_vars_css.html"> | ||
|
||
<dom-module id="settings-brave-new-tab-page"> | ||
<template> | ||
<style include="settings-shared md-select iron-flex"> | ||
.primary-title { | ||
font-weight: 700; | ||
padding-top: 1em; | ||
font-size: 1.05em; | ||
} | ||
.nested-section { | ||
margin-inline-start: 1.5em; | ||
margin-top: -0.5em; | ||
} | ||
.borderless { | ||
border: none; | ||
} | ||
.normalize-margin { | ||
margin: 0 -1.5em 1em; | ||
} | ||
</style> | ||
<div class="settings-box first"> | ||
<div class="flex"> | ||
<div class="label primary-title">$i18n{braveNewTabCustomizeDashboard}</div> | ||
<div class="normalize-margin"> | ||
<settings-toggle-button id="showBackgroundImageControlType" | ||
class="secondary borderless" | ||
pref="{{prefs.brave.new_tab_page.show_background_image}}" | ||
label="$i18n{braveNewTabBackgroundImages}"> | ||
</settings-toggle-button> | ||
<settings-toggle-button | ||
class="nested-section borderless" | ||
pref="[[toggleBrandedBackgroundOption_(prefs.brave.new_tab_page.show_background_image.value, prefs.brave.new_tab_page.show_branded_background_image)]]" | ||
disabled="{{!prefs.brave.new_tab_page.show_background_image.value}}" | ||
label="$i18n{braveNewTabSponsoredImages}"> | ||
</settings-toggle-button> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="flex"> | ||
<settings-toggle-button | ||
pref="{{prefs.brave.new_tab_page.show_stats}}" | ||
label="$i18n{braveNewTabStats}"> | ||
</settings-toggle-button> | ||
<settings-toggle-button | ||
pref="{{prefs.brave.new_tab_page.show_rewards}}" | ||
label="$i18n{braveNewTabBraveRewards}"> | ||
</settings-toggle-button> | ||
<settings-toggle-button | ||
pref="{{prefs.brave.new_tab_page.show_binance}}" | ||
label="$i18n{braveNewTabBinance}"> | ||
</settings-toggle-button> | ||
<settings-toggle-button | ||
pref="{{prefs.brave.new_tab_page.show_top_sites}}" | ||
label="$i18n{braveNewTabTopSites}"> | ||
</settings-toggle-button> | ||
<settings-toggle-button | ||
pref="{{prefs.brave.new_tab_page.show_clock}}" | ||
label="$i18n{braveNewTabClock}"> | ||
</settings-toggle-button> | ||
</div> | ||
</template> | ||
<script src="brave_new_tab_page.js"></script> | ||
</dom-module> |
37 changes: 37 additions & 0 deletions
37
browser/resources/settings/brave_new_tab_page/brave_new_tab_page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}, | ||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters