Unregister from GCM when the only GCM app is removed
[chromium-blink-merge.git] / chrome / test / data / register_form.html
blobb2bd767b963bd7c57aeb74949e4c6deda86b2669
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>
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));
18 </style>
19 <script>
20 document.addEventListener('DOMContentLoaded', load);
21 var hostUrl = 'chrome://register';
23 window.addEventListener('message', processMessage);
25 function $(o) {
26 return document.getElementById(o);
29 function load() {
30 var msg = {
31 type: 'get_user_info',
32 domain: location.href,
33 payload: {}
35 window.parent.postMessage(msg, hostUrl);
36 $('url').textContent = location.href;
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 registration(false);
44 return;
47 if (e.data.type == 'set_user_info') {
48 var info = e.data.payload;
49 $('info').textContent = 'OS: ' + info.os_name + ', ' +
50 info.os_version + ' SKU:' + info.system_sku + ', system hwqual: ' +
51 info.system_hwqual + ', SN: ' + info.system_serial + ', lang: ' +
52 info.os_language + ', connection: ' + info.os_connection + ', user: ' +
53 info.user_email;
56 $('messageInfo').textContent = 'e.origin: ' + e.origin +
57 ', e.data.domain: ' + e.data.domain;
60 function registration(result) {
61 var msg = {
62 type: 'complete_registration',
63 domain: location.href,
64 payload: {
65 registration_status: result
68 var parent = window.parent;
69 parent.postMessage(msg, hostUrl);
71 </script>
72 </head>
73 <body>
74 <div id="main">
75 <h3>Register your computer with Google</h3>
76 <i>This registration form is hosted at </i><div id="url"></div><br>
77 <i>User info received from host page:</i><br>
78 <div id="info"></div><br>
79 <i>Message info:</i><br>
80 <div id="messageInfo"></div><br>
81 <input type="button" value="Skip" onclick="registration(false);">
82 <input type="button" value="Register" onclick="registration(true);">
83 </div>
84 </body></html>