From 160d01fa1a77545ecadd568af89e615d6a91a856 Mon Sep 17 00:00:00 2001 From: Cezar Augusto Date: Mon, 10 Apr 2017 15:52:16 -0300 Subject: [PATCH] Add Extensions / rm Manager string from windowMenu - Auditors: @bsclifton, @NejcZdovc - Close #8203 Test plan: npm run test -- --grep="extensionsMenuItem" --- app/browser/menu.js | 1 + app/common/commonMenu.js | 18 ++++++++++++++++++ .../brave/locales/en-US/menu.properties | 7 ++++--- app/locale.js | 1 + test/unit/app/common/commonMenuTest.js | 6 ++++++ 5 files changed, 30 insertions(+), 3 deletions(-) diff --git a/app/browser/menu.js b/app/browser/menu.js index b3aac37591d..3fa9fc1b164 100644 --- a/app/browser/menu.js +++ b/app/browser/menu.js @@ -421,6 +421,7 @@ const createWindowSubmenu = () => { CommonMenu.separatorMenuItem, CommonMenu.bookmarksManagerMenuItem(), CommonMenu.downloadsMenuItem(), + CommonMenu.extensionsMenuItem(), CommonMenu.passwordsMenuItem() ] diff --git a/app/common/commonMenu.js b/app/common/commonMenu.js index 0769f7025d5..4db20f953f6 100644 --- a/app/common/commonMenu.js +++ b/app/common/commonMenu.js @@ -250,6 +250,24 @@ module.exports.downloadsMenuItem = () => { } } +module.exports.extensionsMenuItem = () => { + return { + label: locale.translation('extensionsManager'), + click: (item, focusedWindow) => { + if (BrowserWindow.getAllWindows().length === 0) { + appActions.newWindow(Immutable.fromJS({ + location: 'about:preferences#extensions' + })) + } else { + appActions.maybeCreateTabRequested({ + url: 'about:preferences#extensions', + windowId: getCurrentWindowId() + }) + } + } + } +} + module.exports.passwordsMenuItem = () => { return { label: locale.translation('passwordsManager'), diff --git a/app/extensions/brave/locales/en-US/menu.properties b/app/extensions/brave/locales/en-US/menu.properties index 4da925437b4..ff8d2879356 100644 --- a/app/extensions/brave/locales/en-US/menu.properties +++ b/app/extensions/brave/locales/en-US/menu.properties @@ -85,7 +85,7 @@ find=Find… checkForUpdates=Check for Updates… preferences=Preferences… settings=Settings… -bookmarksManager=Bookmarks Manager… +bookmarksManager=Bookmarks… importBrowserData=Import Browser Data… exportBookmarks=Export Bookmarks… submitFeedback=Submit Feedback… @@ -141,8 +141,9 @@ aboutApp=About Brave quit=Quit quitApp=Quit Brave inspectElement=Inspect Element -downloadsManager=Downloads Manager… -passwordsManager=Passwords Manager… +downloadsManager=Downloads… +passwordsManager=Passwords… +extensionsManager=Extensions… zoom=Zoom new=New learnSpelling=Learn Spelling diff --git a/app/locale.js b/app/locale.js index 33eb3bd3693..4d32683445c 100644 --- a/app/locale.js +++ b/app/locale.js @@ -220,6 +220,7 @@ var rendererIdentifiers = function () { 'noThanks', 'neverForThisSite', 'passwordsManager', + 'extensionsManager', 'downloadItemPause', 'downloadItemResume', 'downloadItemCancel', diff --git a/test/unit/app/common/commonMenuTest.js b/test/unit/app/common/commonMenuTest.js index b48b9cf5400..1fa3a6fbcd4 100644 --- a/test/unit/app/common/commonMenuTest.js +++ b/test/unit/app/common/commonMenuTest.js @@ -144,6 +144,12 @@ describe('Common menu module unit tests', function () { }) }) + describe('extensionsMenuItem', function () { + it('has the expected defaults set', function () { + checkExpectedDefaults(commonMenu.extensionsMenuItem, false) + }) + }) + describe('importBrowserDataMenuItem', function () { it('has the expected defaults set', function () { checkExpectedDefaults(commonMenu.importBrowserDataMenuItem, false)