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

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
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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 390
379 listeners.forEach( 391 listeners.forEach(
380 /** @param {function(*=):void} listener */ 392 /** @param {function(*=):void} listener */
381 function(listener){ 393 function(listener){
382 if (listener) { 394 if (listener) {
383 listener(opt_details); 395 listener(opt_details);
384 } 396 }
385 }); 397 });
386 } 398 }
387 }; 399 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698