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

Side by Side Diff: chrome/browser/resources/whispernet_proxy/js/init.js

Issue 461803003: Stop playing/recording when not needed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 'use strict'; 5 'use strict';
6 6
7 // Globals holding our encoder and decoder. We will never have more than one 7 // Globals holding our encoder and decoder. We will never have more than one
8 // Global variable that will be used to access this Nacl bridge. 8 // Global variable that will be used to access this Nacl bridge.
9 var whispernetNacl = null; 9 var whispernetNacl = null;
10 10
(...skipping 24 matching lines...) Expand all
35 chrome.copresencePrivate.sendInitialized(true); 35 chrome.copresencePrivate.sendInitialized(true);
36 } 36 }
37 37
38 /** 38 /**
39 * Sends a request to whispernet to encode a token. 39 * Sends a request to whispernet to encode a token.
40 * @param {string} token Token to encode. This needs to be a base64 string. 40 * @param {string} token Token to encode. This needs to be a base64 string.
41 * @param {boolean} audible Whether we should use encode audible samples. 41 * @param {boolean} audible Whether we should use encode audible samples.
42 */ 42 */
43 function encodeTokenRequest(token, audible) { 43 function encodeTokenRequest(token, audible) {
44 if (whisperEncoder) { 44 if (whisperEncoder) {
45 console.log('Got encoding request');
xiyuan 2014/08/12 18:57:50 nit: remove debugging log?
rkc 2014/08/13 00:28:59 Done.
45 whisperEncoder.encode(atob(token), audible, true); 46 whisperEncoder.encode(atob(token), audible, true);
46 } else { 47 } else {
47 console.error('encodeTokenRequest: Whisper not initialized!'); 48 console.error('encodeTokenRequest: Whisper not initialized!');
48 } 49 }
49 } 50 }
50 51
51 /** 52 /**
52 * Sends a request to whispernet to decode samples. 53 * Sends a request to whispernet to decode samples.
53 * @param {ArrayBuffer} samples Array of samples to decode. 54 * @param {ArrayBuffer} samples Array of samples to decode.
54 */ 55 */
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 */ 97 */
97 function initWhispernet() { 98 function initWhispernet() {
98 console.log('init: Starting Nacl bridge.'); 99 console.log('init: Starting Nacl bridge.');
99 // TODO(rkc): Figure out how to embed the .nmf and the .pexe into component 100 // TODO(rkc): Figure out how to embed the .nmf and the .pexe into component
100 // resources without having to rename them to .js. 101 // resources without having to rename them to .js.
101 whispernetNacl = new NaclBridge('whispernet_proxy.nmf.png', 102 whispernetNacl = new NaclBridge('whispernet_proxy.nmf.png',
102 onWhispernetLoaded); 103 onWhispernetLoaded);
103 } 104 }
104 105
105 window.addEventListener('DOMContentLoaded', initWhispernet); 106 window.addEventListener('DOMContentLoaded', initWhispernet);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698