OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Offline login implementation. | 6 * @fileoverview Offline login implementation. |
7 */ | 7 */ |
8 | 8 |
9 /** | 9 /** |
10 * Initialize the offline page. | 10 * Initialize the offline page. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 form.email.focus(); | 59 form.email.focus(); |
60 } | 60 } |
61 window.parent.postMessage({'method': 'loginUILoaded'}, 'chrome://oobe/'); | 61 window.parent.postMessage({'method': 'loginUILoaded'}, 'chrome://oobe/'); |
62 } | 62 } |
63 | 63 |
64 /** | 64 /** |
65 * Handles initialization message from parent page. | 65 * Handles initialization message from parent page. |
66 * @param {MessageEvent} e | 66 * @param {MessageEvent} e |
67 */ | 67 */ |
68 function handleInitializeMessage(e) { | 68 function handleInitializeMessage(e) { |
69 var ALLOWED_PARENT_ORIGINS = [ | 69 var ALLOWED_PARENT_ORIGINS = ['chrome://oobe', 'chrome://chrome-signin']; |
70 'chrome://oobe', | |
71 'chrome://chrome-signin' | |
72 ]; | |
73 | 70 |
74 if (ALLOWED_PARENT_ORIGINS.indexOf(e.origin) == -1) | 71 if (ALLOWED_PARENT_ORIGINS.indexOf(e.origin) == -1) |
75 return; | 72 return; |
76 | 73 |
77 window.removeEventListener('message', handleInitializeMessage); | 74 window.removeEventListener('message', handleInitializeMessage); |
78 | 75 |
79 var params = e.data; | 76 var params = e.data; |
80 params.parentPage = e.origin; | 77 params.parentPage = e.origin; |
81 load(params); | 78 load(params); |
82 } | 79 } |
83 | 80 |
84 document.addEventListener('DOMContentLoaded', function() { | 81 document.addEventListener('DOMContentLoaded', function() { |
85 window.addEventListener('message', handleInitializeMessage); | 82 window.addEventListener('message', handleInitializeMessage); |
86 window.parent.postMessage({'method': 'loginUIDOMContentLoaded'}, '*'); | 83 window.parent.postMessage({'method': 'loginUIDOMContentLoaded'}, '*'); |
87 }); | 84 }); |
OLD | NEW |