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

Side by Side 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: more changes 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html i18n-values="dir:textdirection"> 2 <html i18n-values="dir:textdirection">
3 <head> 3 <head>
4 <style type="text/css"> 4 <style type="text/css">
5 body { 5 body {
6 margin: 0px; 6 margin: 10px 10px 0px 10px;
arv (Not doing code reviews) 2011/08/23 01:25:33 s/0px/0/
Daniel Erat 2011/08/23 21:45:09 Done.
7 -webkit-user-select: none;
8 }
9
10 form {
11 margin: 0;
12 }
13
14 #explanation {
15 cursor: default;
16 }
17
18 #fields {
19 padding: 10px 0;
20 margin-left: auto;
21 margin-right: auto;
22 }
23
24 #usernameLabelCell,
25 #passwordLabelCell {
26 text-align: right;
Daniel Erat 2011/08/23 00:48:04 This isn't RTL-friendly, but with the exception of
arv (Not doing code reviews) 2011/08/23 01:25:33 RTL text-align: end;
Daniel Erat 2011/08/23 21:45:09 Done.
27 padding-right: 5px;
arv (Not doing code reviews) 2011/08/23 01:25:33 -webkit-padding-end: 5px;
Daniel Erat 2011/08/23 21:45:09 Done.
28 }
29
30 #username,
31 #password {
32 width: 150px;
7 } 33 }
8 34
9 #buttons { 35 #buttons {
10 text-align: right; 36 text-align: right;
arv (Not doing code reviews) 2011/08/23 01:25:33 text-align: end;
Daniel Erat 2011/08/23 21:45:09 Done.
11 } 37 }
12 38
13 html[dir='rtl'] #buttons { 39 html[dir='rtl'] #buttons {
14 text-align: left; 40 text-align: left;
arv (Not doing code reviews) 2011/08/23 01:25:33 with text-alugn: end this can be removed
Daniel Erat 2011/08/23 21:45:09 Done.
15 } 41 }
16 42
17 #username,
18 #password {
19 width: 220px;
20 }
21 </style> 43 </style>
22 <script type="text/javascript"> 44 <script type="text/javascript">
arv (Not doing code reviews) 2011/08/23 01:25:33 remove type
Daniel Erat 2011/08/23 21:45:09 Done.
23 function $(o) { 45 function $(o) {
24 return document.getElementById(o); 46 return document.getElementById(o);
25 } 47 }
26 48
27 function disableControls() { 49 function disableControls() {
28 $('username').disabled = true; 50 $('username').disabled = true;
29 $('password').disabled = true; 51 $('password').disabled = true;
30 $('login').disabled = true; 52 $('login').disabled = true;
31 $('cancel').disabled = true; 53 $('cancel').disabled = true;
32 } 54 }
33 55
34 function sendCredentialsAndClose() { 56 function sendCredentialsAndClose() {
35 disableControls(); 57 disableControls();
36 58
37 var result = JSON.stringify({ 59 var result = JSON.stringify({
38 'username': $('username').value, 60 'username': $('username').value,
39 'password': $('password').value}); 61 'password': $('password').value});
40 62
41 chrome.send('DialogClose', [result]); 63 chrome.send('DialogClose', [result]);
42 } 64 }
43 65
66 function cancel() {
67 disableControls();
68 chrome.send('DialogClose');
69 }
70
71 function handleSubmit(e) {
72 sendCredentialsAndClose();
73 e.preventDefault();
74 }
75
76 function handleKeyDown(e) {
77 if (e.keyCode == 27) { // Escape
78 cancel();
79 e.preventDefault();
80 }
81 }
82
44 function setAutofillCredentials(username, password) { 83 function setAutofillCredentials(username, password) {
45 $('username').value = username; 84 $('username').value = username;
46 $('password').value = password; 85 $('password').value = password;
47 } 86 }
48 87
49 function load() { 88 function load() {
89 document.addEventListener('keydown', handleKeyDown);
50 $('explanation').textContent = chrome.dialogArguments; 90 $('explanation').textContent = chrome.dialogArguments;
51 91 $('form').onsubmit = handleSubmit;
52 $('cancel').onclick = function() { 92 $('cancel').onclick = cancel;
53 disableControls();
54 chrome.send('DialogClose', ['']);
55 };
56
57 $('login').onclick = function() {
58 sendCredentialsAndClose();
59 };
60
61 $('username').focus(); 93 $('username').focus();
62 94
63 chrome.send('GetAutofill', ['']); 95 chrome.send('GetAutofill', ['']);
64 } 96 }
65 97
66 document.addEventListener('DOMContentLoaded', load); 98 document.addEventListener('DOMContentLoaded', load);
67 </script> 99 </script>
68 </head> 100 </head>
69 <body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize"> 101 <body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize">
70 <div id="explanation"></div> 102 <div id="explanation"></div>
71 <table> 103 <form id="form">
72 <tr> 104 <table id="fields">
73 <td i18n-content="username"></td> 105 <tr>
74 <td> 106 <td id="usernameLabelCell">
arv (Not doing code reviews) 2011/08/23 01:25:33 username-label-cell https://sites.google.com/a/ch
Daniel Erat 2011/08/23 21:45:09 Done.
75 <input id="username" type="text"> 107 <label for="username" i18n-content="username"></label>
76 </td> 108 </td>
77 </tr> 109 <td>
78 <tr> 110 <input id="username" type="text">
79 <td i18n-content="password"></td> 111 </td>
80 <td> 112 </tr>
81 <input id="password" name="password" type="password"> 113 <tr>
82 </td> 114 <td id="passwordLabelCell">
83 </tr> 115 <label for="password" i18n-content="password"></label>
84 </table> 116 </td>
85 <div id="buttons"> 117 <td>
86 <input id="cancel" type="button" i18n-values="value:cancel"> 118 <input id="password" name="password" type="password">
87 <input id="login" type="button" i18n-values="value:signin"> 119 </td>
88 </div> 120 </tr>
121 </table>
122 <div id="buttons">
123 <input id="cancel" type="button" i18n-values="value:cancel">
124 <input id="login" type="submit" i18n-values="value:signin">
125 </div>
126 </form>
89 </body> 127 </body>
90 </html> 128 </html>
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/login/login_prompt_ui.cc » ('j') | chrome/browser/ui/login/login_prompt_ui.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698