1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <title>Register your computer with Google</title> 6 <style> 7 #form { 8 position: absolute; 9 left: 0; 10 right: 0; 11 top: 0; 12 bottom: 0; 13 overflow: hidden; 14 width: 100%; 15 height: 100%; 16 background: -webkit-linear-gradient(#FAFBFB, #CCD1D4); 17 } 18 19 </style> 20 <script> 21 document.addEventListener('DOMContentLoaded', load); 22 window.addEventListener('message', processMessage); 23 var hostPageDomain = 'chrome://register'; 24 var registerDoneUrl = 'cros://register/success'; 25 var registerSkipUrl = 'cros://register/skipped'; 26 var registrationUrl = ''; 27 28 function load() { 29 chrome.send('getRegistrationUrl', []); 30 } 31 function $(o) { 32 return document.getElementById(o); 33 } 34 35 function processMessage(e) { 36 if (e.data.domain != registrationUrl){ 37 skipRegistration(); 38 return; 39 } 40 41 if (e.data.type == 'get_user_info') { 42 chrome.send('getUserInfo', []); 43 } else if (e.data.type == 'complete_registration') { 44 location.replace(e.data.payload.registration_status ? registerDoneUrl : 45 registerSkipUrl); 46 } 47 } 48 49 function setRegistrationUrl(url) { 50 registrationUrl = url; 51 $('form').contentWindow.location.href = url; 52 } 53 54 function setUserInfo(userInfo) { 55 var msg = { 56 type: 'set_user_info', 57 domain: hostPageDomain, 58 payload: userInfo 59 }; 60 $('form').contentWindow.postMessage(msg, registrationUrl); 61 } 62 63 // Called by WebUI handler when startup manifest is not defined. 64 function skipRegistration() { 65 location.replace(registerSkipUrl); 66 } 67 </script> 68 </head> 69 <body><iframe id="form" frameborder="0"></iframe></body> 70 </html> 71