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

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

Issue 503063004: Hangouts Remote Desktop Part VI - Show confirm dialog before retrieving access code (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/webapp/background/message_window.js ('k') | remoting/webapp/message_window.css » ('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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 143 }
144 var queryParameters = []; 144 var queryParameters = [];
145 for (var key in opt_params) { 145 for (var key in opt_params) {
146 queryParameters.push(encodeURIComponent(key) + "=" + 146 queryParameters.push(encodeURIComponent(key) + "=" +
147 encodeURIComponent(opt_params[key])); 147 encodeURIComponent(opt_params[key]));
148 } 148 }
149 return url + '?' + queryParameters.join('&'); 149 return url + '?' + queryParameters.join('&');
150 }; 150 };
151 151
152 /** 152 /**
153 * Convert special characters (e.g. &, < and >) to HTML entities.
154 *
155 * @param {string} str
156 * @return {string}
157 */
158 base.escapeHTML = function(str) {
159 var div = document.createElement('div');
160 div.appendChild(document.createTextNode(str));
161 return div.innerHTML;
162 };
163
164 /**
153 * Promise is a great tool for writing asynchronous code. However, the construct 165 * Promise is a great tool for writing asynchronous code. However, the construct
154 * var p = new promise(function init(resolve, reject) { 166 * var p = new promise(function init(resolve, reject) {
155 * ... // code that fulfills the Promise. 167 * ... // code that fulfills the Promise.
156 * }); 168 * });
157 * forces the Promise-resolving logic to reside in the |init| function 169 * forces the Promise-resolving logic to reside in the |init| function
158 * of the constructor. This is problematic when you need to resolve the 170 * of the constructor. This is problematic when you need to resolve the
159 * Promise in a member function(which is quite common for event callbacks). 171 * Promise in a member function(which is quite common for event callbacks).
160 * 172 *
161 * base.Deferred comes to the rescue. It encapsulates a Promise 173 * base.Deferred comes to the rescue. It encapsulates a Promise
162 * object and exposes member methods (resolve/reject) to fulfill it. 174 * object and exposes member methods (resolve/reject) to fulfill it.
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 /** 415 /**
404 * Decodes UTF-8 string from ArrayBuffer. 416 * Decodes UTF-8 string from ArrayBuffer.
405 * 417 *
406 * @param {ArrayBuffer} buffer 418 * @param {ArrayBuffer} buffer
407 * @return {string} 419 * @return {string}
408 */ 420 */
409 base.decodeUtf8 = function(buffer) { 421 base.decodeUtf8 = function(buffer) {
410 return decodeURIComponent( 422 return decodeURIComponent(
411 escape(String.fromCharCode.apply(null, new Uint8Array(buffer)))); 423 escape(String.fromCharCode.apply(null, new Uint8Array(buffer))));
412 } 424 }
OLDNEW
« no previous file with comments | « remoting/webapp/background/message_window.js ('k') | remoting/webapp/message_window.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698