| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 this.extension_url_ = data.startUrl; | 60 this.extension_url_ = data.startUrl; |
| 61 // TODO(xiyuan): Pre-populate Gaia with data.email (if any). | 61 // TODO(xiyuan): Pre-populate Gaia with data.email (if any). |
| 62 }, | 62 }, |
| 63 | 63 |
| 64 /** | 64 /** |
| 65 * Checks if message comes from the loaded authentication extension. | 65 * Checks if message comes from the loaded authentication extension. |
| 66 * @param e {object} Payload of the received HTML5 message. | 66 * @param e {object} Payload of the received HTML5 message. |
| 67 * @type {bool} | 67 * @type {bool} |
| 68 */ | 68 */ |
| 69 isAuthExtMessage_: function(e) { | 69 isAuthExtMessage_: function(e) { |
| 70 return this.extension_url_.indexOf(e.origin) == 0; | 70 return this.extension_url_ != null && |
| 71 this.extension_url_.indexOf(e.origin) == 0 && |
| 72 e.source == $('signin-frame').contentWindow; |
| 71 }, | 73 }, |
| 72 | 74 |
| 73 /** | 75 /** |
| 74 * Event handler that is invoked when HTML5 message is received. | 76 * Event handler that is invoked when HTML5 message is received. |
| 75 * @param e {object} Payload of the received HTML5 message. | 77 * @param e {object} Payload of the received HTML5 message. |
| 76 */ | 78 */ |
| 77 onMessage_: function(e) { | 79 onMessage_: function(e) { |
| 78 var msg = e.data; | 80 var msg = e.data; |
| 79 if (msg.method == 'completeLogin' && this.isAuthExtMessage_(e)) { | 81 if (msg.method == 'completeLogin' && this.isAuthExtMessage_(e)) { |
| 80 chrome.send('completeLogin', [msg.email, msg.password] ); | 82 chrome.send('completeLogin', [msg.email, msg.password] ); |
| 81 } | 83 } |
| 82 }, | 84 }, |
| 83 | 85 |
| 84 /** | 86 /** |
| 85 * Clears input fields and switches to input mode. | 87 * Clears input fields and switches to input mode. |
| 86 * @param {boolean} takeFocus True to take focus. | 88 * @param {boolean} takeFocus True to take focus. |
| 87 */ | 89 */ |
| 88 reset: function(takeFocus) { | 90 reset: function(takeFocus) { |
| 89 // Reload and show the sign-in UI. | 91 // Reload and show the sign-in UI. |
| 90 Oobe.showSigninUI(); | 92 Oobe.showSigninUI(); |
| 91 } | 93 } |
| 92 }; | 94 }; |
| 93 | 95 |
| 94 return { | 96 return { |
| 95 GaiaSigninScreen: GaiaSigninScreen | 97 GaiaSigninScreen: GaiaSigninScreen |
| 96 }; | 98 }; |
| 97 }); | 99 }); |
| OLD | NEW |