OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <!-- Test page for Chrome OS register form that is hosted at OEM partner site |
| 3 and is loaded in chrome://register host page --> |
| 4 <html><head> |
| 5 <title>Registration test form</title> |
| 6 <style> |
| 7 |
| 8 #main { |
| 9 position: absolute; |
| 10 left: 0; |
| 11 right: 0; |
| 12 top: 0; |
| 13 bottom: 0; |
| 14 padding: 10px; |
| 15 overflow: hidden; |
| 16 background: -webkit-gradient(linear, left top, left bottom, from(#FAFBFB), to(
#CCD1D4)); |
| 17 } |
| 18 </style> |
| 19 <script> |
| 20 document.addEventListener('DOMContentLoaded', load); |
| 21 var hostUrl = 'chrome://register'; |
| 22 |
| 23 window.addEventListener('message', processMessage); |
| 24 |
| 25 function $(o) { |
| 26 return document.getElementById(o); |
| 27 } |
| 28 |
| 29 function load() { |
| 30 var msg = { |
| 31 type: 'get_user_info', |
| 32 domain: location.href, |
| 33 payload: {} |
| 34 }; |
| 35 window.parent.postMessage(msg, hostUrl); |
| 36 $('url').textContent = location.href; |
| 37 } |
| 38 |
| 39 function processMessage(e) { |
| 40 // TODO(nkostylev): e.origin is passed as null and not checked. |
| 41 // Probably because it's served from chrome:// scheme. |
| 42 if (e.data.domain != hostUrl) |
| 43 return; |
| 44 |
| 45 if (e.data.type == 'set_user_info') { |
| 46 // TODO(nkostylev): Extract all available system/user info. |
| 47 // http://crosbug.com/4813 |
| 48 var info = e.data.payload; |
| 49 $('info').textContent = 'OS: ' + info.os_name + ', ' + |
| 50 info.os_version + ' SKU:' + info.system_sku; |
| 51 } |
| 52 |
| 53 $('messageInfo').textContent = 'e.origin: ' + e.origin + |
| 54 ', e.data.domain: ' + e.data.domain; |
| 55 } |
| 56 |
| 57 function registration(result) { |
| 58 var msg = { |
| 59 type: 'complete_registration', |
| 60 domain: location.href, |
| 61 payload: { |
| 62 registration_status: result |
| 63 } |
| 64 }; |
| 65 var parent = window.parent; |
| 66 parent.postMessage(msg, hostUrl); |
| 67 } |
| 68 </script> |
| 69 </head> |
| 70 <body> |
| 71 <div id="main"> |
| 72 <h3>Register your computer with Google</h3> |
| 73 <i>This registration form is hosted at </i><div id="url"></div><br> |
| 74 <i>User info received from host page:</i><br> |
| 75 <div id="info"></div><br> |
| 76 <i>Message info:</i><br> |
| 77 <div id="messageInfo"></div><br> |
| 78 <input type="button" value="Skip" onclick="registration(false);"> |
| 79 <input type="button" value="Register" onclick="registration(true);"> |
| 80 </div> |
| 81 </body></html> |
OLD | NEW |