mirror of
https://github.com/GoogleChrome/chrome-extensions-samples.git
synced 2026-03-27 13:29:34 +07:00
Update Web Intents sample to correctly handle window closing
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
var main = null;
|
||||
var mainWindow = null;
|
||||
chrome.experimental.app.onLaunched.addListener(function(data) {
|
||||
if (main) {
|
||||
main.focus();
|
||||
if (mainWindow && !mainWindow.closed) {
|
||||
mainWindow.chrome.appWindow.focus();
|
||||
} else {
|
||||
chrome.appWindow.create('index.html', {
|
||||
width: 700,
|
||||
@@ -10,7 +10,7 @@ chrome.experimental.app.onLaunched.addListener(function(data) {
|
||||
minHeight: 473,
|
||||
type: 'none'
|
||||
}, function(win) {
|
||||
main = win;
|
||||
mainWindow = win;
|
||||
if (data && data.intent && data.intent.type.indexOf('image') === 0)
|
||||
win.webkitIntent = data.intent || null;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user