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

Unified Diff: chrome/browser/resources/settings/passwords_and_forms_page/address_edit_dialog.js

Issue 2965643004: MD Settings: Convert remaining classes to ES6 syntax. (Closed)
Patch Set: Fix Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/passwords_and_forms_page/address_edit_dialog.js
diff --git a/chrome/browser/resources/settings/passwords_and_forms_page/address_edit_dialog.js b/chrome/browser/resources/settings/passwords_and_forms_page/address_edit_dialog.js
index ca28ebf668a7f5abbd856fb69e02a74280c3ac02..ed4ac4370a64fa37d617234e508841c7906fbded 100644
--- a/chrome/browser/resources/settings/passwords_and_forms_page/address_edit_dialog.js
+++ b/chrome/browser/resources/settings/passwords_and_forms_page/address_edit_dialog.js
@@ -200,32 +200,33 @@ Polymer({
cr.define('settings.address', function() {
/**
* Creates a wrapper against a single data member for an address.
- * @param {!chrome.autofillPrivate.AddressEntry} address
- * @param {!chrome.autofillPrivate.AddressComponent} component
- * @constructor
*/
- function AddressComponentUI(address, component) {
- Object.defineProperty(this, 'value', {
- get: function() {
- return this.getValue_();
- },
- set: function(newValue) {
- this.setValue_(newValue);
- },
- });
- this.address_ = address;
- this.component = component;
- this.isTextArea =
- component.field == chrome.autofillPrivate.AddressField.ADDRESS_LINES;
- }
+ class AddressComponentUI {
+ /**
+ * @param {!chrome.autofillPrivate.AddressEntry} address
+ * @param {!chrome.autofillPrivate.AddressComponent} component
+ */
+ constructor(address, component) {
+ Object.defineProperty(this, 'value', {
+ get: function() {
+ return this.getValue_();
+ },
+ set: function(newValue) {
+ this.setValue_(newValue);
+ },
+ });
+ this.address_ = address;
+ this.component = component;
+ this.isTextArea =
+ component.field == chrome.autofillPrivate.AddressField.ADDRESS_LINES;
+ }
- AddressComponentUI.prototype = {
/**
* Gets the value from the address that's associated with this component.
* @return {string|undefined}
* @private
*/
- getValue_: function() {
+ getValue_() {
var address = this.address_;
switch (this.component.field) {
case chrome.autofillPrivate.AddressField.FULL_NAME:
@@ -251,14 +252,14 @@ cr.define('settings.address', function() {
default:
assertNotReached();
}
- },
+ }
/**
* Sets the value in the address that's associated with this component.
* @param {string} value
* @private
*/
- setValue_: function(value) {
+ setValue_(value) {
var address = this.address_;
switch (this.component.field) {
case chrome.autofillPrivate.AddressField.FULL_NAME:
@@ -291,52 +292,48 @@ cr.define('settings.address', function() {
default:
assertNotReached();
}
- },
- };
+ }
+ }
/** @interface */
- function CountryDetailManager() {}
- CountryDetailManager.prototype = {
+ class CountryDetailManager {
/**
* Gets the list of available countries.
* The default country will be first, followed by a separator, followed by
* an alphabetized list of countries available.
* @return {!Promise<!Array<!chrome.autofillPrivate.CountryEntry>>}
*/
- getCountryList: assertNotReached,
+ getCountryList() {}
/**
* Gets the address format for a given country code.
* @param {string} countryCode
* @return {!Promise<!chrome.autofillPrivate.AddressComponents>}
*/
- getAddressFormat: assertNotReached,
- };
+ getAddressFormat(countryCode) {}
+ }
/**
* Default implementation. Override for testing.
* @implements {settings.address.CountryDetailManager}
- * @constructor
*/
- function CountryDetailManagerImpl() {}
- cr.addSingletonGetter(CountryDetailManagerImpl);
- CountryDetailManagerImpl.prototype = {
- __proto__: CountryDetailManager,
-
+ class CountryDetailManagerImpl {
/** @override */
- getCountryList: function() {
+ getCountryList() {
return new Promise(function(callback) {
chrome.autofillPrivate.getCountryList(callback);
});
- },
+ }
/** @override */
- getAddressFormat: function(countryCode) {
+ getAddressFormat(countryCode) {
return new Promise(function(callback) {
chrome.autofillPrivate.getAddressComponents(countryCode, callback);
});
- },
- };
+ }
+ }
+
+ cr.addSingletonGetter(CountryDetailManagerImpl);
return {
AddressComponentUI: AddressComponentUI,

Powered by Google App Engine
This is Rietveld 408576698