Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * If there is already a tab with the given URL, switch focus to it. Otherwise, | 6 * If there is already a tab with the given URL, switch focus to it. Otherwise, |
| 7 * create a new tab and open the URL. | 7 * create a new tab and open the URL. |
| 8 * | 8 * |
| 9 * @param url The URL to open. | 9 * @param url The URL to open. |
| 10 */ | 10 */ |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 xmppAuth: getCookie('xmpp_auth'), | 56 xmppAuth: getCookie('xmpp_auth'), |
| 57 hostName: hostName, | 57 hostName: hostName, |
| 58 hostJid: hostJid, | 58 hostJid: hostJid, |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 console.log("Attempt to connect with" + | 61 console.log("Attempt to connect with" + |
| 62 " username='" + request.username + "'" + | 62 " username='" + request.username + "'" + |
| 63 " hostName='" + request.hostName + "'" + | 63 " hostName='" + request.hostName + "'" + |
| 64 " hostJid='" + request.hostJid + "'" + | 64 " hostJid='" + request.hostJid + "'" + |
| 65 " auth_token='" + request.xmppAuth + "'"); | 65 " auth_token='" + request.xmppAuth + "'"); |
| 66 navigate(newTabUrl, function(tab) { | 66 |
| 67 console.log("We're trying now to send to " + tab.id); | 67 var sendRequestFunc = function (tab) { |
| 68 chrome.tabs.sendRequest( | 68 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
| |
| 69 tab.id, request, function() { | 69 chrome.tabs.sendRequest( |
| 70 console.log('Tab finished connect.'); | 70 tab.id, request, function() { |
| 71 }); | 71 console.log('Tab finished connect.'); |
| 72 }); | 72 }); |
| 73 }; | |
| 74 | |
| 75 var checkStatusFunc = function (tab) { | |
| 76 if (tab.status == "complete") { | |
| 77 sendRequestFunc(tab); | |
| 78 return; | |
| 79 } | |
| 80 | |
| 81 // 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
| |
| 82 setTimeout(function() { | |
| 83 chrome.tabs.get(tab.id, checkStatusFunc); | |
| 84 }, 500); | |
| 85 } | |
| 86 | |
| 87 navigate(newTabUrl, checkStatusFunc); | |
| 73 } | 88 } |
| OLD | NEW |