parent
f2194e8482
commit
aaed44f1ec
@ -0,0 +1,33 @@ |
||||
<!DOCTYPE html> |
||||
<html lang="en"> |
||||
<head> |
||||
<meta charset="UTF-8" /> |
||||
<meta http-equiv="X-UA-Compatible" content="IE=Edge" /> |
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" /> |
||||
<title>TrezorConnect | Trezor</title> |
||||
<meta name="description" content="" /> |
||||
<meta name="keywords" content="" /> |
||||
<meta name="author" content="Trezor info@trezor.io" /> |
||||
<meta name="robots" content="noindex, nofollow" /> |
||||
<meta name="title" content="Trezor Connect" /> |
||||
<meta name="theme-color" content="#ffffff" /> |
||||
<meta http-equiv="Pragma" content="no-cache" /> |
||||
<meta http-equiv="Expires" content="-1" /> |
||||
<style> |
||||
* { |
||||
margin: 0; |
||||
padding: 0; |
||||
} |
||||
html, body { |
||||
position: relative; |
||||
width: 100%; |
||||
height: 100%; |
||||
min-height: 500px; |
||||
min-width: 328px; |
||||
} |
||||
</style> |
||||
</head> |
||||
<body> |
||||
<iframe id="trezor-usb-permissions" src="https://connect.trezor.io/5/extension-permissions.html" allow="usb" frameborder="0" width="100%" height="100%"></iframe> |
||||
<script type="text/javascript" src="./vendor/trezor/usb-permissions.js"></script> |
||||
</body> |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,21 @@ |
||||
/* |
||||
Passing messages from background script to popup |
||||
*/ |
||||
|
||||
let port = chrome.runtime.connect({ name: 'trezor-connect' }); |
||||
port.onMessage.addListener(message => { |
||||
window.postMessage(message, window.location.origin); |
||||
}); |
||||
port.onDisconnect.addListener(d => { |
||||
port = null; |
||||
}); |
||||
|
||||
/* |
||||
Passing messages from popup to background script |
||||
*/ |
||||
|
||||
window.addEventListener('message', event => { |
||||
if (port && event.source === window && event.data) { |
||||
port.postMessage(event.data); |
||||
} |
||||
}); |
@ -0,0 +1,20 @@ |
||||
/* |
||||
Handling messages from usb permissions iframe |
||||
*/ |
||||
|
||||
window.addEventListener('message', event => { |
||||
if (event.data === 'usb-permissions-init') { |
||||
const iframe = document.getElementById('trezor-usb-permissions'); |
||||
iframe.contentWindow.postMessage({ |
||||
type: 'usb-permissions-init', |
||||
extension: chrome.runtime.id, |
||||
}, '*'); |
||||
} else if (event.data === 'usb-permissions-close') { |
||||
chrome.tabs.query({ |
||||
currentWindow: true, |
||||
active: true, |
||||
}, (tabs) => { |
||||
chrome.tabs.remove(tabs[0].id); |
||||
}); |
||||
} |
||||
}); |
Loading…
Reference in new issue