diff --git a/app/extensions/brave/locales/en-US/app.properties b/app/extensions/brave/locales/en-US/app.properties index 46ab66a6624..e47b5b1d5b1 100644 --- a/app/extensions/brave/locales/en-US/app.properties +++ b/app/extensions/brave/locales/en-US/app.properties @@ -149,3 +149,4 @@ 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 ? diff --git a/app/index.js b/app/index.js index 17ccf3230da..c86683c7f36 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: ['Yes', '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) }) @@ -633,10 +655,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..e1bf2170c49 100644 --- a/app/locale.js +++ b/app/locale.js @@ -165,7 +165,8 @@ var rendererIdentifiers = function () { 'historySuggestionTitle', 'aboutPagesSuggestionTitle', 'searchSuggestionTitle', - 'topSiteSuggestionTitle' + 'topSiteSuggestionTitle', + 'prefsRestart' ] } 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