| 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 /** @const */ var CALLBACK_BUTTON_CLICKED = 'buttonClicked'; |
| 10 /** @const */ var CALLBACK_CONTEXT_CHANGED = 'contextChanged'; |
| 9 /** @const */ var CALLBACK_USER_ACTED = 'userActed'; | 11 /** @const */ var CALLBACK_USER_ACTED = 'userActed'; |
| 10 /** @const */ var CALLBACK_CONTEXT_CHANGED = 'contextChanged'; | |
| 11 | 12 |
| 12 function doNothing() {}; | 13 function doNothing() {}; |
| 13 | 14 |
| 14 var querySelectorAll = HTMLDivElement.prototype.querySelectorAll; | 15 var querySelectorAll = HTMLDivElement.prototype.querySelectorAll; |
| 15 | 16 |
| 16 var Screen = function(sendPrefix) { | 17 var Screen = function(sendPrefix) { |
| 17 this.sendPrefix_ = sendPrefix; | 18 this.sendPrefix_ = sendPrefix; |
| 18 this.screenContext_ = null; | 19 this.screenContext_ = null; |
| 19 this.contextObservers_ = {}; | 20 this.contextObservers_ = {}; |
| 20 }; | 21 }; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 }, | 91 }, |
| 91 | 92 |
| 92 /** | 93 /** |
| 93 * @final | 94 * @final |
| 94 */ | 95 */ |
| 95 commitContextChanges: function() { | 96 commitContextChanges: function() { |
| 96 return this.commitContextChangesImpl_.apply(this, arguments); | 97 return this.commitContextChangesImpl_.apply(this, arguments); |
| 97 }, | 98 }, |
| 98 | 99 |
| 99 /** | 100 /** |
| 101 * @final |
| 102 */ |
| 103 declareButton: function(id) { |
| 104 var self = this; |
| 105 var button = this.ownerDocument.createElement('button'); |
| 106 button.id = id; |
| 107 |
| 108 button.addEventListener('click', function(e) { |
| 109 self.sendImpl_(CALLBACK_BUTTON_CLICKED, id); |
| 110 e.stopPropagation(); |
| 111 }); |
| 112 |
| 113 return button; |
| 114 }, |
| 115 |
| 116 /** |
| 100 * @override | 117 * @override |
| 101 * @final | 118 * @final |
| 102 */ | 119 */ |
| 103 querySelectorAll: function() { | 120 querySelectorAll: function() { |
| 104 return this.querySelectorAllImpl_.apply(this, arguments); | 121 return this.querySelectorAllImpl_.apply(this, arguments); |
| 105 }, | 122 }, |
| 106 | 123 |
| 107 /** | 124 /** |
| 108 * Does the following things: | 125 * Does the following things: |
| 109 * * Creates screen context. | 126 * * Creates screen context. |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 | 344 |
| 328 cr.define('login', function() { | 345 cr.define('login', function() { |
| 329 var result = {}; | 346 var result = {}; |
| 330 result[name] = api; | 347 result[name] = api; |
| 331 return result; | 348 return result; |
| 332 }); | 349 }); |
| 333 } | 350 } |
| 334 }; | 351 }; |
| 335 }); | 352 }); |
| 336 | 353 |
| OLD | NEW |