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

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

Issue 2068713003: Refactors profile avatar selector into a Polymer element to use in md-settings & md-user-manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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 9
10 /** @typedef {{url: string, label:string}} */ 10 /** @typedef {{url: string, label:string}} */
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 onCancelTap_: function(event) { 367 onCancelTap_: function(event) {
368 if (this.createInProgress_) { 368 if (this.createInProgress_) {
369 this.createInProgress_ = false; 369 this.createInProgress_ = false;
370 this.browserProxy_.cancelCreateProfile(); 370 this.browserProxy_.cancelCreateProfile();
371 } else { 371 } else {
372 this.fire('change-page', {page: 'user-pods-page'}); 372 this.fire('change-page', {page: 'user-pods-page'});
373 } 373 }
374 }, 374 },
375 375
376 /** 376 /**
377 * Handler for when the user clicks a new profile icon.
378 * @param {!Event} event
379 * @private
380 */
381 onIconTap_: function(event) {
382 var element = Polymer.dom(event).rootTarget;
383
384 if (element.nodeName == 'IMG')
385 this.profileIconUrl_ = element.src;
386 else if (element.dataset && element.dataset.iconUrl)
387 this.profileIconUrl_ = element.dataset.iconUrl;
388
389 // Button toggle state is controlled by the selected icon URL. Prevent
390 // tap events from changing the toggle state.
391 event.preventDefault();
392 },
393
394 /**
395 * Handles profile create/import success message pushed by the browser. 377 * Handles profile create/import success message pushed by the browser.
396 * @param {!ProfileInfo} profileInfo Details of the created/imported profile. 378 * @param {!ProfileInfo} profileInfo Details of the created/imported profile.
397 * @private 379 * @private
398 */ 380 */
399 handleSuccess_: function(profileInfo) { 381 handleSuccess_: function(profileInfo) {
400 this.createInProgress_ = false; 382 this.createInProgress_ = false;
401 if (profileInfo.showConfirmation) { 383 if (profileInfo.showConfirmation) {
402 this.fire('change-page', {page: 'supervised-create-confirm-page', 384 this.fire('change-page', {page: 'supervised-create-confirm-page',
403 data: profileInfo}); 385 data: profileInfo});
404 } else { 386 } else {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 * Computed binding that returns True if there are any signed-in users. 466 * Computed binding that returns True if there are any signed-in users.
485 * @param {!Array<!SignedInUser>} signedInUsers signed-in users. 467 * @param {!Array<!SignedInUser>} signedInUsers signed-in users.
486 * @return {boolean} 468 * @return {boolean}
487 * @private 469 * @private
488 */ 470 */
489 isSignedIn_: function(signedInUsers) { 471 isSignedIn_: function(signedInUsers) {
490 return signedInUsers.length > 0; 472 return signedInUsers.length > 0;
491 } 473 }
492 }); 474 });
493 }()); 475 }());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698