diff --git a/app/extensions/brave/locales/en-US/app.properties b/app/extensions/brave/locales/en-US/app.properties index da0b46061f7..8290e70b308 100644 --- a/app/extensions/brave/locales/en-US/app.properties +++ b/app/extensions/brave/locales/en-US/app.properties @@ -153,7 +153,8 @@ flashSubtext=from {{source}} on {{site}}. flashExpirationText=Approvals reset 7 days after last visit. notificationPasswordWithUserName=Would you like Brave to remember the password for {{username}} on {{origin}}? notificationPassword=Would you like Brave to remember your password on {{origin}}? -notificationPasswordYes=Yes -notificationPasswordNo=No -notificationPasswordNeverRemember=Never for this site notificationPasswordSettings=[Password settings] +prefsRestart=Do you want to restart now? +yes=Yes +no=No +neverForThisSite=Never for this site diff --git a/app/index.js b/app/index.js index 794f7297312..ecac80f89b3 100644 --- a/app/index.js +++ b/app/index.js @@ -64,6 +64,8 @@ let throttleKeytar = false // Map of password notification bar messages to their callbacks const passwordCallbacks = {} +const prefsRestartCallbacks = {} + /** * Gets the master key for encrypting login credentials from the OS keyring. */ @@ -391,6 +393,26 @@ app.on('ready', () => { app.quit() }) + ipcMain.on(messages.PREFS_RESTART, () => { + var message = locale.translation('prefsRestart') + + appActions.showMessageBox({ + buttons: [locale.translation('yes'), locale.translation('no')], + options: { + persist: false + }, + message + }) + prefsRestartCallbacks[message] = (buttonIndex, persist) => { + if (buttonIndex === 0) { + app.relaunch({args: process.argv.slice(1) + ['--relaunch']}) + app.exit(0) + } else { + appActions.hideMessageBox(message) + } + } + }) + ipcMain.on(messages.UPDATE_APP_MENU, (e, args) => { Menu.init(AppStore.getState().get('settings'), args) }) @@ -616,7 +638,11 @@ app.on('ready', () => { if (!(message in passwordCallbacks)) { // Notification not shown already appActions.showMessageBox({ - buttons: [locale.translation('notificationPasswordYes'), locale.translation('notificationPasswordNo'), locale.translation('notificationPasswordNeverRemember')], + buttons: [ + locale.translation('yes'), + locale.translation('no'), + locale.translation('neverForThisSite') + ], options: { persist: false, advancedText: locale.translation('notificationPasswordSettings'), @@ -652,10 +678,13 @@ app.on('ready', () => { } }) - ipcMain.on(messages.NOTIFICATION_RESPONSE, (e, message, buttonIndex) => { + ipcMain.on(messages.NOTIFICATION_RESPONSE, (e, message, buttonIndex, persist) => { if (passwordCallbacks[message]) { passwordCallbacks[message](buttonIndex) } + if (prefsRestartCallbacks[message]) { + prefsRestartCallbacks[message](buttonIndex, persist) + } }) // Setup the crash handling diff --git a/app/locale.js b/app/locale.js index 46462d32890..8b6226944a6 100644 --- a/app/locale.js +++ b/app/locale.js @@ -170,10 +170,11 @@ var rendererIdentifiers = function () { 'topSiteSuggestionTitle', 'notificationPasswordWithUserName', 'notificationPassword', - 'notificationPasswordYes', - 'notificationPasswordNo', - 'notificationPasswordNeverRemember', - 'notificationPasswordSettings' + 'notificationPasswordSettings', + 'prefsRestart', + 'yes', + 'no', + 'neverForThisSite' ] } diff --git a/js/about/preferences.js b/js/about/preferences.js index 35ebabb0050..5610eba0278 100644 --- a/js/about/preferences.js +++ b/js/about/preferences.js @@ -357,6 +357,7 @@ class ShieldsTab extends ImmutableComponent { class SecurityTab extends ImmutableComponent { onToggleFlash (e) { aboutActions.setResourceEnabled(flash, e.target.value) + ipc.send(messages.PREFS_RESTART) } render () { return