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

Unified Diff: chrome/browser/resources/chromeos/login/user_pod_row.js

Issue 7628013: [ChromeOS] Add an extra stage to remove a user in WebUI login. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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/chromeos/login/user_pod_row.js
diff --git a/chrome/browser/resources/chromeos/login/user_pod_row.js b/chrome/browser/resources/chromeos/login/user_pod_row.js
index 54a2b030b1e0d260a907b28828f74ba8e38e9b2e..4f4bed0db99886f9e89f2fc0c406bc4fd407321a 100644
--- a/chrome/browser/resources/chromeos/login/user_pod_row.js
+++ b/chrome/browser/resources/chromeos/login/user_pod_row.js
@@ -46,6 +46,8 @@ cr.define('login', function() {
this.enterButtonElement.addEventListener('click',
this.activate.bind(this));
+ this.removeUserButtonElement.addEventListener('mouseout',
+ this.handleRemoveButtonMouseOut_.bind(this));
},
/**
@@ -143,6 +145,27 @@ cr.define('login', function() {
},
/**
+ * Whether remove button is active state.
+ * @type {boolean}
+ */
+ get activeRemoveButton() {
+ return this.removeUserButtonElement.classList.contains('active');
+ },
+ set activeRemoveButton(active) {
+ if (active == this.activeRemoveButton)
+ return;
+
+ if (active) {
+ this.removeUserButtonElement.classList.add('active');
+ this.removeUserButtonElement.textContent =
+ localStrings.getString('removeUser');
+ } else {
+ this.removeUserButtonElement.classList.remove('active');
+ this.removeUserButtonElement.textContent = '';
+ }
+ },
+
+ /**
* Focuses on input element.
*/
focusInput: function() {
@@ -179,11 +202,28 @@ cr.define('login', function() {
},
/**
+ * Handles mouseout on remove button button.
+ */
+ handleRemoveButtonMouseOut_: function(e) {
+ this.activeRemoveButton = false;
+ },
+
+ /**
+ * Handles mousedown on remove user button.
+ */
+ handleRemoevButtonMouseDown_: function(e) {
+ if (this.activeRemoveButton)
+ chrome.send('removeUser', [this.user.emailAddress]);
+ else
+ this.activeRemoveButton = true;
+ },
+
+ /**
* Handles mousedown event.
*/
handleMouseDown_: function(e) {
if (e.target == this.removeUserButtonElement) {
- chrome.send('removeUser', [this.user.emailAddress]);
+ this.handleRemoevButtonMouseDown_(e);
// Prevent default so that we don't trigger 'focus' event.
e.preventDefault();
@@ -338,6 +378,7 @@ cr.define('login', function() {
// we are not using gaia ext for signin or
// the user has a valid oauth token.
for (var i = 0; i < this.pods.length; ++i) {
+ this.pods[i].activeRemoveButton = false;
if (this.pods[i] == pod) {
pod.classList.remove("faded");
pod.classList.add("focused");
@@ -359,6 +400,7 @@ cr.define('login', function() {
for (var i = 0; i < this.pods.length; ++i) {
this.pods[i].classList.remove('focused');
this.pods[i].classList.remove('faded');
+ this.pods[i].activeRemoveButton = false;
}
this.focusedPod_ = undefined;
}

Powered by Google App Engine
This is Rietveld 408576698