OLD | NEW |
| (Empty) |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 /////////////////////////////////////////////////////////////////////////////// | |
6 // AddUserOverlay class: | |
7 | |
8 /** | |
9 * Encapsulated handling of ChromeOS accounts add user overlay page. | |
10 * @constructor | |
11 */ | |
12 function AddUserOverlay(model) { | |
13 OptionsPage.call(this, 'addUserOverlay', localStrings.getString('add_user'), | |
14 'addUserOverlayPage'); | |
15 } | |
16 | |
17 AddUserOverlay.getInstance = function() { | |
18 if (!AddUserOverlay.instance_) { | |
19 AddUserOverlay.instance_ = new AddUserOverlay(null); | |
20 } | |
21 return AddUserOverlay.instance_; | |
22 }; | |
23 | |
24 AddUserOverlay.prototype = { | |
25 // Inherit AddUserOverlay from OptionsPage. | |
26 __proto__: OptionsPage.prototype, | |
27 | |
28 /** | |
29 * Initializes AddUserOverlay page. | |
30 * Calls base class implementation to starts preference initialization. | |
31 */ | |
32 initializePage: function() { | |
33 // Call base class implementation to starts preference initialization. | |
34 OptionsPage.prototype.initializePage.call(this); | |
35 | |
36 // Set up the page. | |
37 $('addUserOkButton').onclick = function(e) { | |
38 var newUserEmail = $('userEmailEdit').value; | |
39 if (newUserEmail) | |
40 userList.addUser({'email': newUserEmail}); | |
41 | |
42 OptionsPage.clearOverlays(); | |
43 }; | |
44 | |
45 $('addUserCancelButton').onclick = function(e) { | |
46 OptionsPage.clearOverlays(); | |
47 }; | |
48 | |
49 this.addEventListener('visibleChange', | |
50 cr.bind(this.handleVisibleChange_, this)); | |
51 }, | |
52 | |
53 /** | |
54 * Handler for OptionsPage's visible property change event. | |
55 * @param {Event} e Property change event. | |
56 */ | |
57 handleVisibleChange_: function() { | |
58 $('userEmailEdit').focus(); | |
59 } | |
60 }; | |
OLD | NEW |