Chromium Code Reviews| Index: remoting/client/extension/background.js |
| diff --git a/remoting/client/extension/background.js b/remoting/client/extension/background.js |
| index b8b400d5c70f90824a5d054e404a980f5a4c137c..1e657773104a05763fd7e1d76f2d824e456c72fa 100644 |
| --- a/remoting/client/extension/background.js |
| +++ b/remoting/client/extension/background.js |
| @@ -63,11 +63,26 @@ function openChromotingTab(hostName, hostJid) { |
| " hostName='" + request.hostName + "'" + |
| " hostJid='" + request.hostJid + "'" + |
| " auth_token='" + request.xmppAuth + "'"); |
| - navigate(newTabUrl, function(tab) { |
| - console.log("We're trying now to send to " + tab.id); |
| - chrome.tabs.sendRequest( |
| - tab.id, request, function() { |
| - console.log('Tab finished connect.'); |
| - }); |
| - }); |
| + |
| + var sendRequestFunc = function (tab) { |
| + console.log("We're trying now to send to " + tab.id); |
|
awong
2011/02/18 00:31:01
At some point, I'm wondering if we should have a c
Alpha Left Google
2011/02/18 00:44:06
hm.. i was thinking about this too, but since we d
|
| + chrome.tabs.sendRequest( |
| + tab.id, request, function() { |
| + console.log('Tab finished connect.'); |
| + }); |
| + }; |
| + |
| + var checkStatusFunc = function (tab) { |
| + if (tab.status == "complete") { |
| + sendRequestFunc(tab); |
| + return; |
| + } |
| + |
| + // Wait for 500ms and then get the tab and check its status. |
|
awong
2011/02/18 00:31:01
Is there no way to have a signal on tab status cha
Alpha Left Google
2011/02/18 00:44:06
there's only two ways, pass arguments as url into
|
| + setTimeout(function() { |
| + chrome.tabs.get(tab.id, checkStatusFunc); |
| + }, 500); |
| + } |
| + |
| + navigate(newTabUrl, checkStatusFunc); |
| } |