From 17fb69bcd5b65bbeb12d8d279b9924386e26e4fd Mon Sep 17 00:00:00 2001 From: Max Karolinskiy Date: Mon, 1 Apr 2019 15:44:08 -0400 Subject: [PATCH] Fixes Reset Profile dialog. Fixes brave/brave-browser#2708 Instead of patching the html/js of the reset_profile_dialog, introduced Brave behavior that hides/unchecks/disables the checkbox we don't want seen along with the entire footer of the dialog since it contains nothing else. --- .../brave_reset_profile_dialog_behavior.html | 1 + .../brave_reset_profile_dialog_behavior.js | 23 +++++++++++++++++++ .../settings/brave_settings_overrides.html | 1 + .../settings/brave_settings_overrides.js | 3 +++ .../resources/settings/settings_resources.grd | 2 ++ ...reset_page-reset_profile_dialog.html.patch | 17 -------------- ...s-reset_page-reset_profile_dialog.js.patch | 22 ------------------ 7 files changed, 30 insertions(+), 39 deletions(-) create mode 100644 browser/resources/settings/brave_reset_page/brave_reset_profile_dialog_behavior.html create mode 100644 browser/resources/settings/brave_reset_page/brave_reset_profile_dialog_behavior.js delete mode 100644 patches/chrome-browser-resources-settings-reset_page-reset_profile_dialog.html.patch delete mode 100644 patches/chrome-browser-resources-settings-reset_page-reset_profile_dialog.js.patch diff --git a/browser/resources/settings/brave_reset_page/brave_reset_profile_dialog_behavior.html b/browser/resources/settings/brave_reset_page/brave_reset_profile_dialog_behavior.html new file mode 100644 index 000000000000..4903fd6ca95d --- /dev/null +++ b/browser/resources/settings/brave_reset_page/brave_reset_profile_dialog_behavior.html @@ -0,0 +1 @@ + diff --git a/browser/resources/settings/brave_reset_page/brave_reset_profile_dialog_behavior.js b/browser/resources/settings/brave_reset_page/brave_reset_profile_dialog_behavior.js new file mode 100644 index 000000000000..a6f0e3f72ea6 --- /dev/null +++ b/browser/resources/settings/brave_reset_page/brave_reset_profile_dialog_behavior.js @@ -0,0 +1,23 @@ +/* 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/. */ + +BraveResetProfileDialogBehavior = { + + ready: function() { + this.fixSendSettingsCheckbox(); + }, + + /** + * Unchecks, disables, and hides sendSettings checkbox. + * Also, hide the entire footer. + * @private + */ + fixSendSettingsCheckbox: function() { + this.$.sendSettings.checked = false; + this.$.sendSettings.hidden = true; + this.$.sendSettings.disabled = true; + this.$.sendSettings.parentNode.hidden = true; + }, +}; diff --git a/browser/resources/settings/brave_settings_overrides.html b/browser/resources/settings/brave_settings_overrides.html index f17598031652..419e3b60ff31 100644 --- a/browser/resources/settings/brave_settings_overrides.html +++ b/browser/resources/settings/brave_settings_overrides.html @@ -1,5 +1,6 @@ + diff --git a/browser/resources/settings/brave_settings_overrides.js b/browser/resources/settings/brave_settings_overrides.js index e571ed4dab91..cf757316e677 100644 --- a/browser/resources/settings/brave_settings_overrides.js +++ b/browser/resources/settings/brave_settings_overrides.js @@ -107,6 +107,9 @@ BravePatching.RegisterPolymerComponentBehaviors({ 'settings-clear-browsing-data-dialog': [ BraveClearBrowsingDataOnExitBehavior ], + 'settings-reset-profile-dialog': [ + BraveResetProfileDialogBehavior + ], 'settings-ui': [ BraveClearSettingsMenuHighlightBehavior ] diff --git a/browser/resources/settings/settings_resources.grd b/browser/resources/settings/settings_resources.grd index be3026ae4ab4..7d59c9d72bca 100644 --- a/browser/resources/settings/settings_resources.grd +++ b/browser/resources/settings/settings_resources.grd @@ -34,6 +34,8 @@ + + diff --git a/patches/chrome-browser-resources-settings-reset_page-reset_profile_dialog.html.patch b/patches/chrome-browser-resources-settings-reset_page-reset_profile_dialog.html.patch deleted file mode 100644 index 9c10c37a9e09..000000000000 --- a/patches/chrome-browser-resources-settings-reset_page-reset_profile_dialog.html.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/chrome/browser/resources/settings/reset_page/reset_profile_dialog.html b/chrome/browser/resources/settings/reset_page/reset_profile_dialog.html -index fc3b7521d2a00a2c2a29e856b418ed7f0a7d3c8a..5ad61ba475b6a08a93754967d2f905471cef1420 100644 ---- a/chrome/browser/resources/settings/reset_page/reset_profile_dialog.html -+++ b/chrome/browser/resources/settings/reset_page/reset_profile_dialog.html -@@ -51,10 +51,12 @@ - $i18n{resetDialogCommit} - - -+ - - - diff --git a/patches/chrome-browser-resources-settings-reset_page-reset_profile_dialog.js.patch b/patches/chrome-browser-resources-settings-reset_page-reset_profile_dialog.js.patch deleted file mode 100644 index dc475036a5d4..000000000000 --- a/patches/chrome-browser-resources-settings-reset_page-reset_profile_dialog.js.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/chrome/browser/resources/settings/reset_page/reset_profile_dialog.js b/chrome/browser/resources/settings/reset_page/reset_profile_dialog.js -index 73acaf410335c02b47ce0375ef12be92568c2f45..f96cc3d3faa4992d8a6f05471743a6cf58e15a4c 100644 ---- a/chrome/browser/resources/settings/reset_page/reset_profile_dialog.js -+++ b/chrome/browser/resources/settings/reset_page/reset_profile_dialog.js -@@ -75,9 +75,6 @@ Polymer({ - this.addEventListener('cancel', () => { - this.browserProxy_.onHideResetProfileDialog(); - }); -- -- this.$$('cr-checkbox a') -- .addEventListener('click', this.onShowReportedSettingsTap_.bind(this)); - }, - - /** @private */ -@@ -123,6 +120,7 @@ Polymer({ - /** @private */ - onResetTap_: function() { - this.clearingInProgress_ = true; -+ this.$.sendSettings.checked = { checked: false }; - this.browserProxy_ - .performResetProfileSettings( - this.$.sendSettings.checked, this.resetRequestOrigin_)