Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: chrome/browser/resources/options/chromeos_accounts_options.js

Issue 3071013: Revert "Revert 53989 - Implement new mock for user options page per chromium-os:5028" (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 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 cr.define('options', function() { 5 cr.define('options', function() {
6 6
7 var OptionsPage = options.OptionsPage; 7 var OptionsPage = options.OptionsPage;
8 8
9 ///////////////////////////////////////////////////////////////////////////// 9 /////////////////////////////////////////////////////////////////////////////
10 // AccountsOptions class: 10 // AccountsOptions class:
(...skipping 19 matching lines...) Expand all
30 __proto__: OptionsPage.prototype, 30 __proto__: OptionsPage.prototype,
31 31
32 /** 32 /**
33 * Initializes AccountsOptions page. 33 * Initializes AccountsOptions page.
34 */ 34 */
35 initializePage: function() { 35 initializePage: function() {
36 // Call base class implementation to starts preference initialization. 36 // Call base class implementation to starts preference initialization.
37 OptionsPage.prototype.initializePage.call(this); 37 OptionsPage.prototype.initializePage.call(this);
38 38
39 // Set up accounts page. 39 // Set up accounts page.
40 $('addUserButton').onclick = function(e) {
41 OptionsPage.showOverlay('addUserOverlay');
42 };
43 $('removeUserButton').onclick = function(e) {
44 $('userList').removeSelectedUser();
45 };
46
47 options.accounts.UserList.decorate($('userList')); 40 options.accounts.UserList.decorate($('userList'));
48 41
49 this.addEventListener('visibleChange', 42 var userNameEdit = $('userNameEdit');
50 cr.bind(this.handleVisibleChange_, this)); 43 options.accounts.UserNameEdit.decorate(userNameEdit);
44 userNameEdit.addEventListener('add', this.handleAddUser_);
45
46 this.addEventListener('visibleChange', this.handleVisibleChange_);
51 }, 47 },
52 48
53 userListInitalized_: false, 49 userListInitalized_: false,
54 50
55 /** 51 /**
56 * Handler for OptionsPage's visible property change event. 52 * Handler for OptionsPage's visible property change event.
53 * @private
57 * @param {Event} e Property change event. 54 * @param {Event} e Property change event.
58 */ 55 */
59 handleVisibleChange_ : function(e) { 56 handleVisibleChange_: function(e) {
60 if (!this.userListInitalized_ && this.visible) { 57 if (!this.userListInitalized_ && this.visible) {
61 this.userListInitalized_ = true; 58 this.userListInitalized_ = true;
62 userList.redraw(); 59 userList.redraw();
63 } 60 }
61 },
62
63 /**
64 * Handler for "add" event fired from userNameEdit.
65 * @private
66 * @param {Event} e Add event fired from userNameEdit.
67 */
68 handleAddUser_: function(e) {
69 $('userList').addUser(e.user);
64 } 70 }
65 }; 71 };
66 72
67 // Export 73 // Export
68 return { 74 return {
69 AccountsOptions: AccountsOptions 75 AccountsOptions: AccountsOptions
70 }; 76 };
71 77
72 }); 78 });
73
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698