diff --git a/app/extensions/brave/locales/en-US/app.properties b/app/extensions/brave/locales/en-US/app.properties index 46ab66a6624..6cb01b9f672 100644 --- a/app/extensions/brave/locales/en-US/app.properties +++ b/app/extensions/brave/locales/en-US/app.properties @@ -149,3 +149,7 @@ flashTitle=Flash Object Blocked flashRightClick=Right-click to run Adobe Flash flashSubtext=from {{source}} on {{site}}. flashExpirationText=Approvals reset 7 days after last visit. +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 17ccf3230da..67998a03967 100644 --- a/app/index.js +++ b/app/index.js @@ -63,6 +63,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. */ @@ -381,6 +383,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) }) @@ -597,7 +619,11 @@ app.on('ready', () => { if (!(message in passwordCallbacks)) { // Notification not shown already appActions.showMessageBox({ - buttons: ['Yes', 'No', 'Never for this site'], + buttons: [ + locale.translation('yes'), + locale.translation('no'), + locale.translation('neverForThisSite') + ], options: { persist: false, advancedText: '[Password settings]', @@ -633,10 +659,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 2217b7a6d3d..24858601ebd 100644 --- a/app/locale.js +++ b/app/locale.js @@ -165,7 +165,11 @@ var rendererIdentifiers = function () { 'historySuggestionTitle', 'aboutPagesSuggestionTitle', 'searchSuggestionTitle', - 'topSiteSuggestionTitle' + 'topSiteSuggestionTitle', + '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