| 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 function initParams() { | 5 function initParams() { |
| 6 var hash; | 6 var hash; |
| 7 var hashes = window.location.href.slice( | 7 var hashes = window.location.href.slice( |
| 8 window.location.href.indexOf('?') + 1).split('&'); | 8 window.location.href.indexOf('?') + 1).split('&'); |
| 9 | 9 |
| 10 // Prepopulate via cookies first. | 10 // Prepopulate via cookies first. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 parsed_response = JSON.parse(xhr.responseText); | 123 parsed_response = JSON.parse(xhr.responseText); |
| 124 hostlist_div.appendChild(document.createTextNode('--Found Hosts--')); | 124 hostlist_div.appendChild(document.createTextNode('--Found Hosts--')); |
| 125 hostlist_div.appendChild(document.createElement('br')); | 125 hostlist_div.appendChild(document.createElement('br')); |
| 126 appendHostLinks(parsed_response.data.items); | 126 appendHostLinks(parsed_response.data.items); |
| 127 } else { | 127 } else { |
| 128 console.log('bad status on host list query: "' + xhr.status + ' ' + xhr.st
atusText); | 128 console.log('bad status on host list query: "' + xhr.status + ' ' + xhr.st
atusText); |
| 129 hostlist_div.appendChild(document.createTextNode('!! Failed !!. :\'(')); | 129 hostlist_div.appendChild(document.createTextNode('!! Failed !!. :\'(')); |
| 130 } | 130 } |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 xhr.open('GET', 'http://www-googleapis-test.sandbox.google.com/chromoting/v1/@
me/hosts'); | 133 xhr.open('GET', 'https://www.googleapis.com/chromoting/v1/@me/hosts'); |
| 134 xhr.setRequestHeader('Content-Type', 'text/plain;charset=UTF-8'); | 134 xhr.setRequestHeader('Content-Type', 'text/plain;charset=UTF-8'); |
| 135 xhr.setRequestHeader('Authorization', 'GoogleLogin auth=' + token); | 135 xhr.setRequestHeader('Authorization', 'GoogleLogin auth=' + token); |
| 136 xhr.send(null); | 136 xhr.send(null); |
| 137 } | 137 } |
| 138 | 138 |
| 139 function appendHostLinks(hostlist) { | 139 function appendHostLinks(hostlist) { |
| 140 // A host link entry should look like: | 140 // A host link entry should look like: |
| 141 // - Host: <a onclick="openChromotingTab(host_jid); return false;">NAME (JID)</a
> <br /> | 141 // - Host: <a onclick="openChromotingTab(host_jid); return false;">NAME (JID)</a
> <br /> |
| 142 var host; | 142 var host; |
| 143 var host_link; | 143 var host_link; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 172 background.openChromotingTab(host_jid); | 172 background.openChromotingTab(host_jid); |
| 173 } | 173 } |
| 174 | 174 |
| 175 function setAuthCookies(form) { | 175 function setAuthCookies(form) { |
| 176 var now = new Date(); | 176 var now = new Date(); |
| 177 now.setTime(now.getTime() + 1000 * 60 * 60 * 24 * 365) | 177 now.setTime(now.getTime() + 1000 * 60 * 60 * 24 * 365) |
| 178 | 178 |
| 179 setCookie('xmpp_auth', form.xmpp_auth.value, 100); | 179 setCookie('xmpp_auth', form.xmpp_auth.value, 100); |
| 180 setCookie('chromoting_auth', form.chromoting_auth.value, 100); | 180 setCookie('chromoting_auth', form.chromoting_auth.value, 100); |
| 181 } | 181 } |
| OLD | NEW |