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

Unified Diff: chrome/browser/resources/md_user_manager/import_supervised_user.js

Issue 2024233003: MD User Manager: Refactors existing dialogs in User Manager into <user-manager-dialog> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@md-user-manager-locked-test
Patch Set: Removed user_manager_dialog gyp target 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/md_user_manager/import_supervised_user.js
diff --git a/chrome/browser/resources/md_user_manager/import_supervised_user.js b/chrome/browser/resources/md_user_manager/import_supervised_user.js
index a820afa77e2ff2b96581cf3c49c45ea5dd958a45..f35c55e20779ca34975ac3b5442b4993e7f2a3fb 100644
--- a/chrome/browser/resources/md_user_manager/import_supervised_user.js
+++ b/chrome/browser/resources/md_user_manager/import_supervised_user.js
@@ -3,7 +3,7 @@
// found in the LICENSE file.
/**
- * @fileoverview 'import-supervised-user' is a popup that allows user to select
+ * @fileoverview 'import-supervised-user' is a dialog that allows user to select
* a supervised profile from a list of profiles to import on the current device.
*/
(function() {
@@ -22,16 +22,6 @@ Polymer({
properties: {
/**
- * True if the element is currently hidden. The element toggles this in
- * order to display itself or hide itself once done.
- * @private {boolean}
- */
- popupHidden_: {
- type: Boolean,
- value: true
- },
-
- /**
* The currently signed in user and the custodian.
* @private {?SignedInUser}
*/
@@ -59,8 +49,13 @@ Polymer({
}
},
+ /** override */
+ ready: function() {
+ this.$.dialog.lastFocusableNode = this.$.cancel;
+ },
+
/**
- * Displays the popup.
+ * Displays the dialog.
* @param {(!SignedInUser|undefined)} signedInUser
* @param {!Array<!SupervisedUser>} supervisedUsers
*/
@@ -76,14 +71,7 @@ Polymer({
this.signedInUser_ = signedInUser || null;
if (this.signedInUser_)
- this.popupHidden_ = false;
-
- if (this.popupHidden_)
- return;
-
- this.async(function() {
- this.$$('paper-listbox').focus();
- }.bind(this));
+ this.$.dialog.open();
},
/**
@@ -99,20 +87,16 @@ Polymer({
},
/**
- * Hides the popup.
+ * param {number} supervisedUserIndex Index of the selected supervised user.
* @private
- */
- onCancelTap_: function() {
- this.popupHidden_ = true;
- },
-
- /**
- * Returns true if the 'Import' button should be enabled and false otherwise.
- * @private
- * @return {boolean}
+ * @return {boolean} Whether the 'Import' button should be disabled.
*/
isImportDisabled_: function(supervisedUserIndex) {
- return supervisedUserIndex == NO_USER_SELECTED;
+ var disabled = supervisedUserIndex == NO_USER_SELECTED;
+ if (!disabled) {
+ this.$.dialog.lastFocusableNode = this.$.import;
+ }
+ return disabled;
},
/**
@@ -123,7 +107,7 @@ Polymer({
onImportTap_: function() {
var supervisedUser = this.supervisedUsers_[this.supervisedUserIndex_];
if (this.signedInUser_ && supervisedUser) {
- this.popupHidden_ = true;
+ this.$.dialog.close();
// Event is caught by create-profile.
this.fire('import', {supervisedUser: supervisedUser,
signedInUser: this.signedInUser_});

Powered by Google App Engine
This is Rietveld 408576698