aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
authorFrankie <frankie.diamond@gmail.com>2017-04-03 14:04:21 +0800
committerGitHub <noreply@github.com>2017-04-03 14:04:21 +0800
commit235a70b9392d8b87eae4fc141e7f0be1d7788ee2 (patch)
treee7db8e909888506a21fa6c2fbfa04a3fa2cbcfc1 /app/scripts/metamask-controller.js
parent0a5c634081656c9450d4341b96bab6b4134a0b7a (diff)
parent86e882c51afca3a44bf20bcd1025161e214e6998 (diff)
downloadtangerine-wallet-browser-235a70b9392d8b87eae4fc141e7f0be1d7788ee2.tar
tangerine-wallet-browser-235a70b9392d8b87eae4fc141e7f0be1d7788ee2.tar.gz
tangerine-wallet-browser-235a70b9392d8b87eae4fc141e7f0be1d7788ee2.tar.bz2
tangerine-wallet-browser-235a70b9392d8b87eae4fc141e7f0be1d7788ee2.tar.lz
tangerine-wallet-browser-235a70b9392d8b87eae4fc141e7f0be1d7788ee2.tar.xz
tangerine-wallet-browser-235a70b9392d8b87eae4fc141e7f0be1d7788ee2.tar.zst
tangerine-wallet-browser-235a70b9392d8b87eae4fc141e7f0be1d7788ee2.zip
Merge pull request #1300 from MetaMask/platform
Introduce Platform API
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r--app/scripts/metamask-controller.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 03ea104e0..af8b4688d 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -20,7 +20,6 @@ const MessageManager = require('./lib/message-manager')
const PersonalMessageManager = require('./lib/personal-message-manager')
const TxManager = require('./transaction-manager')
const ConfigManager = require('./lib/config-manager')
-const extension = require('./lib/extension')
const autoFaucet = require('./lib/auto-faucet')
const nodeify = require('./lib/nodeify')
const accountImporter = require('./account-import-strategies')
@@ -34,6 +33,9 @@ module.exports = class MetamaskController extends EventEmitter {
this.opts = opts
let initState = opts.initState || {}
+ // platform-specific api
+ this.platform = opts.platform
+
// observable state store
this.store = new ObservableStore(initState)
@@ -629,7 +631,7 @@ module.exports = class MetamaskController extends EventEmitter {
break
}
- if (url) extension.tabs.create({ url })
+ if (url) this.platform.openWindow({ url })
}
createShapeShiftTx (depositAddress, depositType) {
@@ -647,7 +649,7 @@ module.exports = class MetamaskController extends EventEmitter {
setDefaultRpc () {
this.configManager.setRpcTarget('http://localhost:8545')
- extension.runtime.reload()
+ this.platform.reload()
this.lookupNetwork()
return Promise.resolve('http://localhost:8545')
}
@@ -656,7 +658,7 @@ module.exports = class MetamaskController extends EventEmitter {
this.configManager.setRpcTarget(rpcTarget)
return this.preferencesController.updateFrequentRpcList(rpcTarget)
.then(() => {
- extension.runtime.reload()
+ this.platform.reload()
this.lookupNetwork()
return Promise.resolve(rpcTarget)
})
@@ -664,13 +666,13 @@ module.exports = class MetamaskController extends EventEmitter {
setProviderType (type) {
this.configManager.setProviderType(type)
- extension.runtime.reload()
+ this.platform.reload()
this.lookupNetwork()
}
useEtherscanProvider () {
this.configManager.useEtherscanProvider()
- extension.runtime.reload()
+ this.platform.reload()
}
getNetworkState () {