diff --git a/app/common/state/extensionState.js b/app/common/state/extensionState.js index 237df58e6e5..87a1b7a3298 100644 --- a/app/common/state/extensionState.js +++ b/app/common/state/extensionState.js @@ -76,7 +76,7 @@ const extensionState = { browserActionBackgroundImage: (browserAction, tabId) => { tabId = tabId ? tabId.toString() : '-1' - let path = browserAction.get('path') + let path = browserAction.getIn(['tabs', tabId, 'path']) || browserAction.get('path') let basePath = browserAction.get('base_path') if (path && basePath) { // Older extensions may provide a string path diff --git a/app/extensions.js b/app/extensions.js index b6f086b48a6..ca9cb901f3e 100644 --- a/app/extensions.js +++ b/app/extensions.js @@ -519,6 +519,12 @@ module.exports.init = () => { disableExtension(config.vimiumExtensionId) } + if (getSetting(settings.HONEY_ENABLED)) { + registerComponent(config.honeyExtensionId) + } else { + disableExtension(config.honeyExtensionId) + } + if (appStore.getState().getIn(['widevine', 'enabled'])) { registerComponent(config.widevineComponentId) } diff --git a/app/extensions/brave/img/extensions/honey-128.png b/app/extensions/brave/img/extensions/honey-128.png new file mode 100644 index 00000000000..6446c23650a Binary files /dev/null and b/app/extensions/brave/img/extensions/honey-128.png differ diff --git a/app/extensions/brave/locales/en-US/extensions.properties b/app/extensions/brave/locales/en-US/extensions.properties index d75d7961b82..7df05a73390 100644 --- a/app/extensions/brave/locales/en-US/extensions.properties +++ b/app/extensions/brave/locales/en-US/extensions.properties @@ -29,3 +29,5 @@ torrent= Torrent Viewer torrentDesc=Uses WebTorrent to display torrents directly in the browser. Supports torrent files and magnet links. vimium= Vimium vimiumDesc= +honey=Honey +honeyDesc=Automatically find and apply coupon codes when you shop online! diff --git a/app/renderer/components/navigation/browserAction.js b/app/renderer/components/navigation/browserAction.js index 4017e12874c..0362db5a350 100644 --- a/app/renderer/components/navigation/browserAction.js +++ b/app/renderer/components/navigation/browserAction.js @@ -55,7 +55,14 @@ class BrowserAction extends React.Component { const currentWindow = state.get('currentWindow') const activeFrame = frameStateUtil.getActiveFrame(currentWindow) || Immutable.Map() const activeTabId = activeFrame.get('tabId') || tabState.TAB_ID_NONE - const browserActions = extensionState.getBrowserActionByTabId(state, ownProps.extensionId, activeTabId) + let browserActions = extensionState.getBrowserActionByTabId(state, ownProps.extensionId, activeTabId) + let tabAction = browserActions.getIn(['tabs', activeTabId.toString()]) + + if (tabAction) { + tabAction = tabAction.set('title', browserActions.get('title')) + tabAction = tabAction.set('base_path', browserActions.get('base_path')) + browserActions = tabAction + } const props = {} // used in renderer diff --git a/app/renderer/lib/extensionsUtil.js b/app/renderer/lib/extensionsUtil.js index cfbff015b68..31763fbcece 100644 --- a/app/renderer/lib/extensionsUtil.js +++ b/app/renderer/lib/extensionsUtil.js @@ -18,6 +18,7 @@ const pocket = config.PocketExtensionId const sync = config.syncExtensionId const webtorrent = config.torrentExtensionId const vimium = config.vimiumExtensionId +const honey = config.honeyExtensionId /** * Stores dummy data for all known extensions based on vault-updater extension manifest. @@ -49,6 +50,12 @@ const dummyData = [ name: 'saveToPocket', description: 'saveToPocketDesc', icon: 'img/extensions/pocket-128.png' + }, + { + id: honey, + name: 'honey', + description: 'honeyDesc', + icon: 'img/extensions/honey-128.png' } // { id: 'vimium' // TBD } ] @@ -132,6 +139,9 @@ module.exports.getExtensionKey = (extensionId) => { case vimium: extensionSetting = settings.VIMIUM_ENABLED break + case honey: + extensionSetting = settings.HONEY_ENABLED + break default: break } diff --git a/docs/state.md b/docs/state.md index 9a69bacb0cb..dfcb7d77900 100644 --- a/docs/state.md +++ b/docs/state.md @@ -172,6 +172,7 @@ AppStore 'bookmarks.toolbar.showOnlyFavicon': boolean, // true if only favicons should be shown on the bookmarks toolbar 'extensions.pocket.enabled': boolean, // true if pocket is enabled 'extensions.vimium.enabled': boolean, // true if vimium is enabled + 'extensions.honey.enabled': boolean, // true if Honey is enabled 'general.autohide-menu': boolean, // true if the Windows menu should be autohidden 'general.bookmarks-toolbar-mode': boolean, // true to show bookmakrs toolbar 'general.check-default-on-startup': boolean, // true to check whether brave is default browser on startup diff --git a/js/constants/appConfig.js b/js/constants/appConfig.js index 7dd3c1f07a5..44816bab544 100644 --- a/js/constants/appConfig.js +++ b/js/constants/appConfig.js @@ -203,6 +203,7 @@ module.exports = { 'shutdown.clear-site-settings': false, 'extensions.pocket.enabled': false, 'extensions.vimium.enabled': false, + 'extensions.honey.enabled': false, 'general.bookmarks-toolbar-mode': null, 'general.is-default-browser': null, 'notification-add-funds-timestamp': null, diff --git a/js/constants/config.js b/js/constants/config.js index 3894edf56fb..7c6c7515652 100644 --- a/js/constants/config.js +++ b/js/constants/config.js @@ -50,6 +50,7 @@ module.exports = { PDFJSExtensionId: 'jdbefljfgobbmcidnmpjamcbhnbphjnb', PocketExtensionId: 'niloccemoadcdkdjlinkgdfekeahmflj', vimiumExtensionId: 'dbepggeogbaibhgnhhndojpepiihcmeb', + honeyExtensionId: 'bmnlcjabgnpnenekpadlanbbkooimhnj', widevineComponentId: 'oimompecagnajdejgnnjijobebaeigek', coinbaseOrigin: 'https://buy.coinbase.com', newtab: { diff --git a/js/constants/settings.js b/js/constants/settings.js index 9b49afda850..ac64034e8af 100644 --- a/js/constants/settings.js +++ b/js/constants/settings.js @@ -96,7 +96,8 @@ const settings = { SHOW_BOOKMARKS_TOOLBAR_FAVICON: 'bookmarks.toolbar.showFavicon', SHOW_BOOKMARKS_TOOLBAR_ONLY_FAVICON: 'bookmarks.toolbar.showOnlyFavicon', POCKET_ENABLED: 'extensions.pocket.enabled', - VIMIUM_ENABLED: 'extensions.vimium.enabled' + VIMIUM_ENABLED: 'extensions.vimium.enabled', + HONEY_ENABLED: 'extensions.honey.enabled' } module.exports = settings diff --git a/test/about/extensionsTest.js b/test/about/extensionsTest.js index 4a9e59f3717..8d5655bf5cf 100644 --- a/test/about/extensionsTest.js +++ b/test/about/extensionsTest.js @@ -49,6 +49,19 @@ describe('about:extensions', function () { .url(pocketURL) }) }) + describe('Honey', function () { + Brave.beforeAll(this) + before(function * () { + yield setup(this.app.client) + }) + it('installs when preference is enabled', function * () { + yield this.app.client + .windowByUrl(Brave.browserWindowUrl) + .changeSetting(settingsConst.HONEY_ENABLED, true) + .tabByIndex(0) + .waitForVisible('[data-extension-id="bmnlcjabgnpnenekpadlanbbkooimhnj"]', extensionDownloadWaitTime) + }) + }) describe('Vimium', function () { Brave.beforeAll(this) before(function * () {