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

Unified Diff: chrome/browser/resources/http_auth.html

Issue 7709013: chromeos: Make WebUI auth dialog handle Enter and Escape. (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/http_auth.html
diff --git a/chrome/browser/resources/http_auth.html b/chrome/browser/resources/http_auth.html
index 53fb6999c184f00f1f28dea25af1d62f17883390..918f68291f8ca238a65735658e3fc34d60bdf949 100644
--- a/chrome/browser/resources/http_auth.html
+++ b/chrome/browser/resources/http_auth.html
@@ -41,23 +41,34 @@
chrome.send('DialogClose', [result]);
}
+ function cancel() {
+ disableControls();
+ chrome.send('DialogClose', ['']);
arv (Not doing code reviews) 2011/08/23 00:14:59 chrome.send('DialogClose')
Daniel Erat 2011/08/23 00:48:04 Done.
+ }
+
+ function handleSubmit(e) {
+ sendCredentialsAndClose();
+ return false;
arv (Not doing code reviews) 2011/08/23 00:14:59 e.preventDefault()
Daniel Erat 2011/08/23 00:48:04 Done.
+ }
+
+ function handleKeyDown(e) {
+ if (event.keyCode == 27) {
xiyuan 2011/08/22 22:29:05 nit: use 'e' instead of 'event'
xiyuan 2011/08/22 22:29:05 nit: add a comment of what key this is.
arv (Not doing code reviews) 2011/08/23 00:14:59 // Esc
Daniel Erat 2011/08/23 00:48:04 Done.
Daniel Erat 2011/08/23 00:48:04 Done.
+ cancel();
+ return false;
xiyuan 2011/08/22 22:29:05 nit: you probably don't need to return anything.
arv (Not doing code reviews) 2011/08/23 00:14:59 e.preventDefault();
Daniel Erat 2011/08/23 00:48:04 Done.
+ }
+ return true;
xiyuan 2011/08/22 22:29:05 same here.
+ }
+
function setAutofillCredentials(username, password) {
$('username').value = username;
$('password').value = password;
}
function load() {
+ document.onkeydown = handleKeyDown;
Daniel Erat 2011/08/22 22:14:18 Should I be setting the body element's handler ins
xiyuan 2011/08/22 22:29:05 Think it's fine to use document.
xiyuan 2011/08/22 22:29:05 nit: suggest to use document.addEventListener('key
Daniel Erat 2011/08/23 00:48:04 Done.
$('explanation').textContent = chrome.dialogArguments;
-
- $('cancel').onclick = function() {
- disableControls();
- chrome.send('DialogClose', ['']);
- };
-
- $('login').onclick = function() {
- sendCredentialsAndClose();
- };
-
+ $('form').onsubmit = handleSubmit;
+ $('cancel').onclick = cancel;
$('username').focus();
chrome.send('GetAutofill', ['']);
@@ -68,23 +79,25 @@
</head>
<body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize">
<div id="explanation"></div>
- <table>
- <tr>
- <td i18n-content="username"></td>
- <td>
- <input id="username" type="text">
- </td>
- </tr>
- <tr>
- <td i18n-content="password"></td>
- <td>
- <input id="password" name="password" type="password">
- </td>
- </tr>
- </table>
- <div id="buttons">
- <input id="cancel" type="button" i18n-values="value:cancel">
- <input id="login" type="button" i18n-values="value:signin">
- </div>
+ <form id="form">
arv (Not doing code reviews) 2011/08/23 00:14:59 Add this to your css form { margin: 0; }
Daniel Erat 2011/08/23 00:48:04 Done.
+ <table>
+ <tr>
+ <td i18n-content="username"></td>
+ <td>
+ <input id="username" type="text">
+ </td>
+ </tr>
+ <tr>
+ <td i18n-content="password"></td>
+ <td>
+ <input id="password" name="password" type="password">
+ </td>
+ </tr>
+ </table>
+ <div id="buttons">
+ <input id="cancel" type="button" i18n-values="value:cancel">
+ <input id="login" type="submit" i18n-values="value:signin">
+ </div>
+ </form>
</body>
</html>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698