diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-12 06:05:02 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-12 06:05:02 +0000 |
commit | 8da9f7d456d69bde82fc69f075446a8d63f2998a (patch) | |
tree | fe4baa98725a117ccdd4b0ffd4cf930892837cb2 | |
parent | 8fdb3798ba1f6af297fc0a5474c52d381d9cf2ca (diff) | |
download | chromium_src-8da9f7d456d69bde82fc69f075446a8d63f2998a.zip chromium_src-8da9f7d456d69bde82fc69f075446a8d63f2998a.tar.gz chromium_src-8da9f7d456d69bde82fc69f075446a8d63f2998a.tar.bz2 |
[ChromeOS] Add an extra stage to remove a user in WebUI login.
Morph X button into a little red "Remove" button on first click to let user confirm the action. And remove user on the 2nd click.
BUG=chromium-os:18309
TEST=Verify fix for chromium-os:18309.
Review URL: http://codereview.chromium.org/7628013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96517 0039d316-1c4b-4281-b951-d872f2087c98
3 files changed, 57 insertions, 1 deletions
diff --git a/chrome/browser/resources/chromeos/login/user_pod_row.css b/chrome/browser/resources/chromeos/login/user_pod_row.css index 8ffc031..670efdc 100644 --- a/chrome/browser/resources/chromeos/login/user_pod_row.css +++ b/chrome/browser/resources/chromeos/login/user_pod_row.css @@ -135,6 +135,7 @@ podrow { } .remove-user-button { + -webkit-transition: width .1s ease-in-out, background .2s ease-in-out; -webkit-box-shadow: none; background: url('chrome://theme/IDR_CLOSE_BAR') center center no-repeat; border: 0; @@ -152,3 +153,14 @@ podrow { -webkit-box-shadow: none; background: url('chrome://theme/IDR_CLOSE_BAR_H') center center no-repeat; } + +.remove-user-button.active { + background-color: #e94949; + background-image: none; + border-radius: 4px; + color: white; + font-size: 10px; + height: initial; + padding: 2px 4px; + width: initial; +} diff --git a/chrome/browser/resources/chromeos/login/user_pod_row.js b/chrome/browser/resources/chromeos/login/user_pod_row.js index 54a2b03..4f4bed0 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; } diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc index cd75fbd..87845e3 100644 --- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc @@ -97,6 +97,8 @@ void SigninScreenHandler::GetLocalizedStrings( l10n_util::GetStringUTF16(IDS_CREATE_ACCOUNT_BUTTON)); localized_strings->SetString("guestSignin", l10n_util::GetStringUTF16(IDS_BROWSE_WITHOUT_SIGNING_IN_BUTTON)); + localized_strings->SetString("removeUser", + l10n_util::GetStringUTF16(IDS_LOGIN_REMOVE)); if (extension_driven_) localized_strings->SetString("authType", "ext"); |