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

Side by Side Diff: ui/webui/resources/js/util.js

Issue 132013002: Replace own callback handling with Promises. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address nits. Created 6 years, 11 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
« no previous file with comments | « chrome/browser/ui/webui/options/managed_user_import_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <include src="assert.js"> 5 <include src="assert.js">
6 6
7 /** 7 /**
8 * The global object. 8 * The global object.
9 * @type {!Object} 9 * @type {!Object}
10 * @const 10 * @const
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 .replace(/"/g, '&quot;') 394 .replace(/"/g, '&quot;')
395 .replace(/'/g, '&#39;'); 395 .replace(/'/g, '&#39;');
396 } 396 }
397 397
398 /** 398 /**
399 * Shortens the provided string (if necessary) to a string of length at most 399 * Shortens the provided string (if necessary) to a string of length at most
400 * |maxLength|. 400 * |maxLength|.
401 * @param {string} original The original string. 401 * @param {string} original The original string.
402 * @param {number} maxLength The maximum length allowed for the string. 402 * @param {number} maxLength The maximum length allowed for the string.
403 * @return {string} The original string if its length does not exceed 403 * @return {string} The original string if its length does not exceed
404 * |maxLength|. Otherwise the first |maxLength| - 3 characters with '...' 404 * |maxLength|. Otherwise the first |maxLength| - 1 characters with '...'
405 * appended. 405 * appended.
406 */ 406 */
407 function elide(original, maxLength) { 407 function elide(original, maxLength) {
408 if (original.length <= maxLength) 408 if (original.length <= maxLength)
409 return original; 409 return original;
410 return original.substring(0, maxLength - 3) + '...'; 410 return original.substring(0, maxLength - 1) + '\u2026';
411 } 411 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/managed_user_import_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698