| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 Base class for all login WebUI screens. | 6 * @fileoverview Base class for all login WebUI screens. |
| 7 */ | 7 */ |
| 8 cr.define('login', function() { | 8 cr.define('login', function() { |
| 9 var Screen = cr.ui.define('div'); | 9 var Screen = cr.ui.define('div'); |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 /** | 48 /** |
| 49 * Sends message to Chrome, adding needed prefix to message name. All | 49 * Sends message to Chrome, adding needed prefix to message name. All |
| 50 * arguments after |messageName| are packed into message parameters list. | 50 * arguments after |messageName| are packed into message parameters list. |
| 51 * | 51 * |
| 52 * @param {string} messageName Name of message without a prefix. | 52 * @param {string} messageName Name of message without a prefix. |
| 53 * @param {...*} varArgs parameters for message. | 53 * @param {...*} varArgs parameters for message. |
| 54 */ | 54 */ |
| 55 send: function(messageName, varArgs) { | 55 send: function(messageName, varArgs) { |
| 56 if (arguments.length == 0) | 56 if (arguments.length == 0) |
| 57 throw Error('Message name is not provided.'); | 57 throw Error("Message name is not provided."); |
| 58 var fullMessageName = this.sendPrefix_ + messageName; | 58 var fullMessageName = this.sendPrefix_ + messageName; |
| 59 var payload = Array.prototype.slice.call(arguments, 1); | 59 var payload = Array.prototype.slice.call(arguments, 1); |
| 60 chrome.send(fullMessageName, payload); | 60 chrome.send(fullMessageName, payload); |
| 61 }, | 61 }, |
| 62 | 62 |
| 63 decorate: doNothing, | 63 decorate: doNothing, |
| 64 | 64 |
| 65 /** | 65 /** |
| 66 * Returns minimal size that screen prefers to have. Default implementation | 66 * Returns minimal size that screen prefers to have. Default implementation |
| 67 * returns current screen size. | 67 * returns current screen size. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 return screen[x].apply(screen, arguments); | 220 return screen[x].apply(screen, arguments); |
| 221 }; | 221 }; |
| 222 })(propertyName); | 222 })(propertyName); |
| 223 } | 223 } |
| 224 }); | 224 }); |
| 225 constructor.contextChanged = function() { | 225 constructor.contextChanged = function() { |
| 226 var screen = $(id); | 226 var screen = $(id); |
| 227 screen.contextChanged_.apply(screen, arguments); | 227 screen.contextChanged_.apply(screen, arguments); |
| 228 } | 228 } |
| 229 constructor.prototype.name = function() { return id; }; | 229 constructor.prototype.name = function() { return id; }; |
| 230 constructor.prototype.sendPrefix_ = 'login.' + name + '.'; |
| 230 | 231 |
| 231 constructor.register = function() { | 232 constructor.register = function() { |
| 232 var screen = $(id); | 233 var screen = $(id); |
| 233 constructor.decorate(screen); | 234 constructor.decorate(screen); |
| 234 Oobe.getInstance().registerScreen(screen); | 235 Oobe.getInstance().registerScreen(screen); |
| 235 }; | 236 }; |
| 236 | 237 |
| 237 var result = {}; | 238 var result = {}; |
| 238 result[name] = constructor; | 239 result[name] = constructor; |
| 239 return result; | 240 return result; |
| 240 }); | 241 }); |
| 241 } | 242 } |
| 242 }; | 243 }; |
| 243 }); | 244 }); |
| 244 | 245 |
| OLD | NEW |