Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Unified Diff: remoting/client/extension/background.js

Issue 6532042: Make chromoting connect always work (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698