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

Side by Side 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: comments 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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);
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 // This function will run when after the url for the tab is updated. If
76 // the tab is not yet loaded it will wait for another 500ms to inspect
77 // again.
78 var checkStatusFunc = function (tab) {
79 if (tab.status == "complete") {
80 sendRequestFunc(tab);
81 return;
82 }
83
84 // Wait for 500ms and then get the tab and check its status.
85 setTimeout(function() {
86 chrome.tabs.get(tab.id, checkStatusFunc);
87 }, 500);
88 }
89
90 navigate(newTabUrl, checkStatusFunc);
73 } 91 }
OLDNEW
« 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