| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 Oobe signin screen implementation. | 6 * @fileoverview Oobe signin screen implementation. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 cr.define('login', function() { | 9 cr.define('login', function() { |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 this.extension_url_ = data.startUrl; | 59 this.extension_url_ = data.startUrl; |
| 60 // TODO(xiyuan): Pre-populate Gaia with data.email (if any). | 60 // TODO(xiyuan): Pre-populate Gaia with data.email (if any). |
| 61 }, | 61 }, |
| 62 | 62 |
| 63 /** | 63 /** |
| 64 * Checks if message comes from the loaded authentication extension. | 64 * Checks if message comes from the loaded authentication extension. |
| 65 * @param e {object} Payload of the received HTML5 message. | 65 * @param e {object} Payload of the received HTML5 message. |
| 66 * @type {bool} | 66 * @type {bool} |
| 67 */ | 67 */ |
| 68 isAuthExtMessage_: function(e) { | 68 isAuthExtMessage_: function(e) { |
| 69 return this.extension_url_.indexOf(e.origin) == 0; | 69 return this.extension_url_ != null && |
| 70 this.extension_url_.indexOf(e.origin) == 0 && |
| 71 e.source == $('signin-frame').contentWindow; |
| 70 }, | 72 }, |
| 71 | 73 |
| 72 /** | 74 /** |
| 73 * Event handler that is invoked when HTML5 message is received. | 75 * Event handler that is invoked when HTML5 message is received. |
| 74 * @param e {object} Payload of the received HTML5 message. | 76 * @param e {object} Payload of the received HTML5 message. |
| 75 */ | 77 */ |
| 76 onMessage_: function(e) { | 78 onMessage_: function(e) { |
| 77 var msg = e.data; | 79 var msg = e.data; |
| 78 if (msg.method == 'completeLogin' && this.isAuthExtMessage_(e)) { | 80 if (msg.method == 'completeLogin' && this.isAuthExtMessage_(e)) { |
| 79 chrome.send('completeLogin', [msg.email, msg.password] ); | 81 chrome.send('completeLogin', [msg.email, msg.password] ); |
| 80 } | 82 } |
| 81 } | 83 } |
| 82 }; | 84 }; |
| 83 | 85 |
| 84 return { | 86 return { |
| 85 GaiaSigninScreen: GaiaSigninScreen | 87 GaiaSigninScreen: GaiaSigninScreen |
| 86 }; | 88 }; |
| 87 }); | 89 }); |
| OLD | NEW |