diff --git a/app/common/state/extensionState.js b/app/common/state/extensionState.js index 066b74fc19d..a33acdf019e 100644 --- a/app/common/state/extensionState.js +++ b/app/common/state/extensionState.js @@ -74,11 +74,17 @@ const extensionState = { } }, - browserActionBackgroundImage: (browserAction) => { - // TODO(bridiver) - handle icon single - if (browserAction.get('base_path') && browserAction.getIn(['path', '19']) && browserAction.getIn(['path', '38'])) { - return '-webkit-image-set(url(\'' + browserAction.get('base_path') + '/' + browserAction.getIn(['path', '19']) + - '\') 1x, url(\'' + browserAction.get('base_path') + '/' + browserAction.getIn(['path', '38']) + '\') 2x' + browserActionBackgroundImage: (browserAction, tabId) => { + tabId = tabId ? tabId.toString() : '-1' + if (browserAction.get('base_path')) { + if (browserAction.getIn(['tabs', tabId, 'path', '19']) && browserAction.getIn(['tabs', tabId, 'path', '38'])) { + return '-webkit-image-set(url(\'' + browserAction.get('base_path') + '/' + browserAction.getIn(['tabs', tabId, 'path', '19']) + + '\') 1x, url(\'' + browserAction.get('base_path') + '/' + browserAction.getIn(['tabs', tabId, 'path', '38']) + '\') 2x' + } + if (browserAction.getIn(['path', '19']) && browserAction.getIn(['path', '38'])) { + return '-webkit-image-set(url(\'' + browserAction.get('base_path') + '/' + browserAction.getIn(['path', '19']) + + '\') 1x, url(\'' + browserAction.get('base_path') + '/' + browserAction.getIn(['path', '38']) + '\') 2x' + } } return '' }, diff --git a/app/renderer/components/browserActionButton.js b/app/renderer/components/browserActionButton.js index ebc26af4bd4..2472773f2cc 100644 --- a/app/renderer/components/browserActionButton.js +++ b/app/renderer/components/browserActionButton.js @@ -40,7 +40,7 @@ class BrowserActionButton extends ImmutableComponent { extensionButton: true })} inlineStyles={{ - backgroundImage: extensionState.browserActionBackgroundImage(this.props.browserAction), + backgroundImage: extensionState.browserActionBackgroundImage(this.props.browserAction, this.props.tabId), backgroundRepeat: 'no-repeat', backgroundPosition: 'center' }}