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

Side by Side Diff: chrome/browser/resources/md_user_manager/create_profile.js

Issue 1920253002: Refactors parse_html_subset() into i18n_behavior. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Whitelists <span> and exposes another function in I18nBehavior API Created 4 years, 7 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 'create-profile' is a page that contains controls for creating 6 * @fileoverview 'create-profile' is a page that contains controls for creating
7 * a (optionally supervised) profile, including choosing a name, and an avatar. 7 * a (optionally supervised) profile, including choosing a name, and an avatar.
8 */ 8 */
9 (function() { 9 (function() {
10 /** 10 /**
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // creating SUs with the same name (https://crbug.com/557445). 275 // creating SUs with the same name (https://crbug.com/557445).
276 var allOnCurrentDevice = supervisedUsers[i].onCurrentDevice; 276 var allOnCurrentDevice = supervisedUsers[i].onCurrentDevice;
277 for (var j = i + 1; j < supervisedUsers.length; ++j) { 277 for (var j = i + 1; j < supervisedUsers.length; ++j) {
278 if (supervisedUsers[j].name == this.profileName_) { 278 if (supervisedUsers[j].name == this.profileName_) {
279 nameIsUnique = false; 279 nameIsUnique = false;
280 allOnCurrentDevice = allOnCurrentDevice && 280 allOnCurrentDevice = allOnCurrentDevice &&
281 supervisedUsers[j].onCurrentDevice; 281 supervisedUsers[j].onCurrentDevice;
282 } 282 }
283 } 283 }
284 284
285 var extraAllowedAttributes = {
286 'id': function(node, value) {
287 return node.tagName == 'A' && value != '';
288 },
289 'is': function(node, value) {
290 return node.tagName == 'A' && value == 'action-link';
291 },
292 'role': function(node, value) {
293 return node.tagName == 'A' && value == 'link';
294 },
295 'tabindex': function(node, value) {
296 return node.tagName == 'A';
297 },
298 };
299
285 this.handleMessage_(allOnCurrentDevice ? 300 this.handleMessage_(allOnCurrentDevice ?
286 this.i18n('managedProfilesExistingLocalSupervisedUser') : 301 this.i18n('managedProfilesExistingLocalSupervisedUser') :
287 this.i18n('manageProfilesExistingSupervisedUser', 302 this.i18nExtraTagsAttrs('manageProfilesExistingSupervisedUser',
288 HTMLEscape(elide(this.profileName_, /* maxLength */ 50)))); 303 [HTMLEscape(elide(this.profileName_, /* maxLength */ 50))],
304 [], extraAllowedAttributes));
289 return; 305 return;
290 } 306 }
291 // No existing supervised user's name matches the entered profile name. 307 // No existing supervised user's name matches the entered profile name.
292 // Continue with creating the new supervised profile. 308 // Continue with creating the new supervised profile.
293 this.createProfile_(); 309 this.createProfile_();
294 }, 310 },
295 311
296 /** 312 /**
297 * Creates the new profile. 313 * Creates the new profile.
298 * @private 314 * @private
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 * Computed binding that returns True if there are any signed-in users. 439 * Computed binding that returns True if there are any signed-in users.
424 * @param {!Array<!SignedInUser>} signedInUsers signed-in users. 440 * @param {!Array<!SignedInUser>} signedInUsers signed-in users.
425 * @return {boolean} 441 * @return {boolean}
426 * @private 442 * @private
427 */ 443 */
428 isSignedIn_: function(signedInUsers) { 444 isSignedIn_: function(signedInUsers) {
429 return signedInUsers.length > 0; 445 return signedInUsers.length > 0;
430 } 446 }
431 }); 447 });
432 }()); 448 }());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698