summaryrefslogtreecommitdiffstats
path: root/remoting/client/extension/background.js
blob: 9fdf0178e2d6e8ac161958339febf7aa12bde578 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

function openChromotingTab(host_jid) {
  var username = getCookie('username');
  var xmpp_auth = getCookie('xmpp_auth');
  var new_tab_url = chrome.extension.getURL("chromoting_tab.html");
  var request = {
    username: getCookie('username'),
    xmpp_auth: getCookie('xmpp_auth'),
    host_jid: host_jid,
  };
  var tab_args = {
    url: new_tab_url,
  };

  console.log("Attempt to connect with" +
              " username='" + request.username + "'" +
              " host_jid='" + request.host_jid + "'" +
              " auth_token='" + request.xmpp_auth + "'");
  chrome.tabs.create(tab_args, 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.');
          });
    });
}