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