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

Side by Side Diff: remoting/webapp/base.js

Issue 514343002: XMPP implementation in JavaScript. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « remoting/remoting_webapp_files.gypi ('k') | remoting/webapp/js_proto/chrome_proto.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * A module that contains basic utility components and methods for the 7 * A module that contains basic utility components and methods for the
8 * chromoting project 8 * chromoting project
9 * 9 *
10 */ 10 */
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 378
379 listeners.forEach( 379 listeners.forEach(
380 /** @param {function(*=):void} listener */ 380 /** @param {function(*=):void} listener */
381 function(listener){ 381 function(listener){
382 if (listener) { 382 if (listener) {
383 listener(opt_details); 383 listener(opt_details);
384 } 384 }
385 }); 385 });
386 } 386 }
387 }; 387 };
388
389 /**
390 * Converts UTF-8 string to ArrayBuffer.
391 *
392 * @param {string} string
393 * @return {ArrayBuffer}
394 */
395 base.encodeUtf8 = function(string) {
396 var utf8String = unescape(encodeURIComponent(string));
397 var result = new Uint8Array(utf8String.length);
398 for (var i = 0; i < utf8String.length; i++)
399 result[i] = utf8String.charCodeAt(i);
400 return result.buffer;
401 }
402
403 /**
404 * Decodes UTF-8 string from ArrayBuffer.
405 *
406 * @param {ArrayBuffer} buffer
407 * @return {string}
408 */
409 base.decodeUtf8 = function(buffer) {
410 return decodeURIComponent(
411 escape(String.fromCharCode.apply(null, new Uint8Array(buffer))));
412 }
OLDNEW
« no previous file with comments | « remoting/remoting_webapp_files.gypi ('k') | remoting/webapp/js_proto/chrome_proto.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698