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

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

Issue 410293004: Split OptionsPage into Page and PageManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed feedback Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 /** @const */ var OptionsPage = options.OptionsPage; 6 /** @const */ var Page = cr.ui.pageManager.Page;
7 /** @const */ var PageManager = cr.ui.pageManager.PageManager;
7 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; 8 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel;
8 9
9 /** 10 /**
10 * AutofillEditAddressOverlay class 11 * AutofillEditAddressOverlay class
11 * Encapsulated handling of the 'Add Page' overlay page. 12 * Encapsulated handling of the 'Add Page' overlay page.
12 * @class 13 * @class
13 */ 14 */
14 function AutofillEditAddressOverlay() { 15 function AutofillEditAddressOverlay() {
15 OptionsPage.call(this, 'autofillEditAddress', 16 Page.call(this, 'autofillEditAddress',
16 loadTimeData.getString('autofillEditAddressTitle'), 17 loadTimeData.getString('autofillEditAddressTitle'),
17 'autofill-edit-address-overlay'); 18 'autofill-edit-address-overlay');
18 } 19 }
19 20
20 cr.addSingletonGetter(AutofillEditAddressOverlay); 21 cr.addSingletonGetter(AutofillEditAddressOverlay);
21 22
22 AutofillEditAddressOverlay.prototype = { 23 AutofillEditAddressOverlay.prototype = {
23 __proto__: OptionsPage.prototype, 24 __proto__: Page.prototype,
24 25
25 /** 26 /**
26 * The GUID of the loaded address. 27 * The GUID of the loaded address.
27 * @type {string} 28 * @type {string}
28 */ 29 */
29 guid_: '', 30 guid_: '',
30 31
31 /** 32 /**
32 * The BCP 47 language code for the layout of input fields. 33 * The BCP 47 language code for the layout of input fields.
33 * @type {string} 34 * @type {string}
34 */ 35 */
35 languageCode_: '', 36 languageCode_: '',
36 37
37 /** 38 /**
38 * The saved field values for the address. For example, if the user changes 39 * The saved field values for the address. For example, if the user changes
39 * from United States to Switzerland, then the State field will be hidden 40 * from United States to Switzerland, then the State field will be hidden
40 * and its value will be stored here. If the user changes back to United 41 * and its value will be stored here. If the user changes back to United
41 * States, then the State field will be restored to its previous value, as 42 * States, then the State field will be restored to its previous value, as
42 * stored in this object. 43 * stored in this object.
43 * @type {Object} 44 * @type {Object}
44 */ 45 */
45 savedFieldValues_: {}, 46 savedFieldValues_: {},
46 47
47 /** 48 /**
48 * Initializes the page. 49 * Initializes the page.
49 */ 50 */
50 initializePage: function() { 51 initializePage: function() {
51 OptionsPage.prototype.initializePage.call(this); 52 Page.prototype.initializePage.call(this);
52 53
53 this.createMultiValueLists_(); 54 this.createMultiValueLists_();
54 55
55 var self = this; 56 var self = this;
56 $('autofill-edit-address-cancel-button').onclick = function(event) { 57 $('autofill-edit-address-cancel-button').onclick = function(event) {
57 self.dismissOverlay_(); 58 self.dismissOverlay_();
58 }; 59 };
59 60
60 // TODO(jhawkins): Investigate other possible solutions. 61 // TODO(jhawkins): Investigate other possible solutions.
61 $('autofill-edit-address-apply-button').onclick = function(event) { 62 $('autofill-edit-address-apply-button').onclick = function(event) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 * Clears any uncommitted input, resets the stored GUID and dismisses the 148 * Clears any uncommitted input, resets the stored GUID and dismisses the
148 * overlay. 149 * overlay.
149 * @private 150 * @private
150 */ 151 */
151 dismissOverlay_: function() { 152 dismissOverlay_: function() {
152 this.setInputFields_({}); 153 this.setInputFields_({});
153 this.inputFieldChanged_(); 154 this.inputFieldChanged_();
154 this.guid_ = ''; 155 this.guid_ = '';
155 this.languageCode_ = ''; 156 this.languageCode_ = '';
156 this.savedInputFields_ = {}; 157 this.savedInputFields_ = {};
157 OptionsPage.closeOverlay(); 158 PageManager.closeOverlay();
158 }, 159 },
159 160
160 /** 161 /**
161 * @return {Element} The element used to switch countries. 162 * @return {Element} The element used to switch countries.
162 * @private 163 * @private
163 */ 164 */
164 getCountrySwitcher_: function() { 165 getCountrySwitcher_: function() {
165 return this.pageDiv.querySelector('[field=country]'); 166 return this.pageDiv.querySelector('[field=country]');
166 }, 167 },
167 168
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 var phoneList = instance.pageDiv.querySelector('[field=phone]'); 426 var phoneList = instance.pageDiv.querySelector('[field=phone]');
426 instance.setMultiValueList_(phoneList, numbers); 427 instance.setMultiValueList_(phoneList, numbers);
427 phoneList.didReceiveValidationResult(); 428 phoneList.didReceiveValidationResult();
428 }; 429 };
429 430
430 // Export 431 // Export
431 return { 432 return {
432 AutofillEditAddressOverlay: AutofillEditAddressOverlay 433 AutofillEditAddressOverlay: AutofillEditAddressOverlay
433 }; 434 };
434 }); 435 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698