Skip to content

Commit

Permalink
Adds UI to clear browsing data flow
Browse files Browse the repository at this point in the history
  • Loading branch information
NejcZdovc committed Jul 13, 2020
1 parent 6840a1c commit e9cc038
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/brave_generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,9 @@ By installing this extension, you are agreeing to the Google Widevine Terms of U
<message name="IDS_BOOKMARKS_NO_ITEMS" desc="Text shown when the user has no bookmarks">
For quick access, place your bookmarks here on the bookmarks bar.
</message>
<message name="IDS_SETTINGS_RESET_REWARDS_DATA" desc="The label for opening rewards manage wallet dialog">
Reset Brave Rewards data...
</message>
</messages>
</release>
</grit>
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,40 @@
// 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 {html} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'
import {BraveClearBrowsingDataOnExitBehavior} from '../brave_clear_browsing_data_dialog/brave_clear_browsing_data_dialog_behavior.js'
import {RegisterPolymerComponentBehaviors} from 'chrome://brave-resources/polymer_overriding.js'
import {RegisterPolymerComponentBehaviors, RegisterPolymerTemplateModifications, RegisterStyleOverride} from 'chrome://brave-resources/polymer_overriding.js'
import {loadTimeData} from '../i18n_setup.js'

RegisterStyleOverride(
'settings-clear-browsing-data-dialog',
html`
<style>
#rewards-reset-data {
display: block;
margin-top: 10px;
}
</style>
`
)

RegisterPolymerComponentBehaviors({
'settings-clear-browsing-data-dialog': [
BraveClearBrowsingDataOnExitBehavior
]
})

RegisterPolymerTemplateModifications({
'settings-clear-browsing-data-dialog': (templateContent) => {
const body = templateContent.querySelector('[slot="body"]')

if (!body) {
console.error(`[Brave Settings Overrides] cannot find 'slot="body"' in clear-browsing-data-dialog`)
return
}

body.insertAdjacentHTML(
'beforeend',
`<a id="rewards-reset-data" href="chrome://rewards/#manage-wallet">${loadTimeData.getString('resetRewardsData')}</a>`)
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ void BraveAddCommonStrings(content::WebUIDataSource* html_source,
IDS_BRAVE_P3A_ENABLE_SETTING_SUBITEM},
{"siteSettings",
IDS_SETTINGS_SITE_AND_SHIELDS_SETTINGS},
{"resetRewardsData",
IDS_SETTINGS_RESET_REWARDS_DATA},
};
AddLocalizedStringsBulk(html_source, localized_strings);
html_source->AddString("webRTCLearnMoreURL",
Expand Down

0 comments on commit e9cc038

Please sign in to comment.