| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 }, | 76 }, |
| 77 | 77 |
| 78 /** | 78 /** |
| 79 * Event handler that is invoked just before the frame is shown. | 79 * Event handler that is invoked just before the frame is shown. |
| 80 * @param data {string} Screen init payload. Url of auth extension start | 80 * @param data {string} Screen init payload. Url of auth extension start |
| 81 * page. | 81 * page. |
| 82 */ | 82 */ |
| 83 onBeforeShow: function(data) { | 83 onBeforeShow: function(data) { |
| 84 console.log('Opening extension: ' + data.startUrl + | 84 console.log('Opening extension: ' + data.startUrl + |
| 85 ', opt_email=' + data.email); | 85 ', opt_email=' + data.email); |
| 86 |
| 86 var frame = $('signin-frame'); | 87 var frame = $('signin-frame'); |
| 87 frame.addEventListener('load', function(e) { | 88 frame.addEventListener('load', function(e) { |
| 88 console.log('Frame loaded: ' + data.startUrl); | 89 console.log('Frame loaded: ' + data.startUrl); |
| 89 }); | 90 }); |
| 90 frame.contentWindow.location.href = data.startUrl; | 91 |
| 91 this.extension_url_ = data.startUrl; | 92 var params = []; |
| 92 // TODO(xiyuan): Pre-populate Gaia with data.email (if any). | 93 if (data.hl) |
| 94 params.push('hl=' + encodeURIComponent(data.hl)); |
| 95 if (data.email) |
| 96 params.push('email=' + encodeURIComponent(data.email)); |
| 97 |
| 98 var url = data.startUrl; |
| 99 if (params.length) |
| 100 url += '?' + params.join('&'); |
| 101 |
| 102 frame.contentWindow.location.href = url; |
| 103 this.extension_url_ = url; |
| 93 | 104 |
| 94 $('createAccount').hidden = !data.createAccount; | 105 $('createAccount').hidden = !data.createAccount; |
| 95 $('guestSignin').hidden = !data.guestSignin; | 106 $('guestSignin').hidden = !data.guestSignin; |
| 96 | 107 |
| 97 this.loading = true; | 108 this.loading = true; |
| 98 }, | 109 }, |
| 99 | 110 |
| 100 /** | 111 /** |
| 101 * Checks if message comes from the loaded authentication extension. | 112 * Checks if message comes from the loaded authentication extension. |
| 102 * @param e {object} Payload of the received HTML5 message. | 113 * @param e {object} Payload of the received HTML5 message. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 130 // Reload and show the sign-in UI if needed. | 141 // Reload and show the sign-in UI if needed. |
| 131 if (takeFocus) | 142 if (takeFocus) |
| 132 Oobe.showSigninUI(); | 143 Oobe.showSigninUI(); |
| 133 } | 144 } |
| 134 }; | 145 }; |
| 135 | 146 |
| 136 return { | 147 return { |
| 137 GaiaSigninScreen: GaiaSigninScreen | 148 GaiaSigninScreen: GaiaSigninScreen |
| 138 }; | 149 }; |
| 139 }); | 150 }); |
| OLD | NEW |