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

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

Issue 2617663002: WIP: run clang-format-js on lots of things (Closed)
Patch Set: merge Created 3 years, 11 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 fa8a4181c642b69d16a814735227be2b4f91c09a..f1d1118e8b6cadf8e6bbdd7bebf87f5cd93eaa8c 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
@@ -7,191 +7,193 @@
* saved password.
*/
(function() {
-'use strict';
+ 'use strict';
-Polymer({
- is: 'settings-address-edit-dialog',
+ Polymer({
+ is: 'settings-address-edit-dialog',
- behaviors: [
- I18nBehavior,
- ],
+ behaviors: [
+ I18nBehavior,
+ ],
- properties: {
- /** @type {chrome.autofillPrivate.AddressEntry} */
- address: Object,
+ properties: {
+ /** @type {chrome.autofillPrivate.AddressEntry} */
+ address: Object,
- /** @private */
- title_: String,
+ /** @private */
+ title_: String,
- /** @private {!Array<!chrome.autofillPrivate.CountryEntry>} */
- countries_: Array,
+ /** @private {!Array<!chrome.autofillPrivate.CountryEntry>} */
+ countries_: Array,
- /**
- * Updates the address wrapper.
- * @private {string|undefined}
- */
- countryCode_: {
- type: String,
- observer: 'onUpdateCountryCode_',
- },
+ /**
+ * Updates the address wrapper.
+ * @private {string|undefined}
+ */
+ countryCode_: {
+ type: String,
+ observer: 'onUpdateCountryCode_',
+ },
- /** @private {!Array<!Array<!settings.address.AddressComponentUI>>} */
- addressWrapper_: Object,
+ /** @private {!Array<!Array<!settings.address.AddressComponentUI>>} */
+ addressWrapper_: Object,
- /** @private */
- phoneNumber_: String,
+ /** @private */
+ phoneNumber_: String,
- /** @private */
- email_: String,
+ /** @private */
+ email_: String,
- /** @private */
- canSave_: Boolean,
- },
-
- /** @override */
- attached: function() {
- this.countryInfo =
- settings.address.CountryDetailManagerImpl.getInstance();
- this.countryInfo.getCountryList().then(function(countryList) {
- this.countries_ = countryList;
-
- this.title_ =
- this.i18n(this.address.guid ? 'editAddressTitle' : 'addAddressTitle');
-
- // |phoneNumbers| and |emailAddresses| are a single item array.
- // See crbug.com/497934 for details.
- this.phoneNumber_ =
- this.address.phoneNumbers ? this.address.phoneNumbers[0] : '';
- this.email_ =
- this.address.emailAddresses ? this.address.emailAddresses[0] : '';
-
- this.async(function() {
- if (this.countryCode_ == this.address.countryCode)
- this.updateAddressWrapper_();
- else
- this.countryCode_ = this.address.countryCode;
+ /** @private */
+ canSave_: Boolean,
+ },
+
+ /** @override */
+ attached: function() {
+ this.countryInfo =
+ settings.address.CountryDetailManagerImpl.getInstance();
+ this.countryInfo.getCountryList().then(function(countryList) {
+ this.countries_ = countryList;
+
+ this.title_ = this.i18n(
+ this.address.guid ? 'editAddressTitle' : 'addAddressTitle');
+
+ // |phoneNumbers| and |emailAddresses| are a single item array.
+ // See crbug.com/497934 for details.
+ this.phoneNumber_ =
+ this.address.phoneNumbers ? this.address.phoneNumbers[0] : '';
+ this.email_ =
+ this.address.emailAddresses ? this.address.emailAddresses[0] : '';
+
+ this.async(function() {
+ if (this.countryCode_ == this.address.countryCode)
+ this.updateAddressWrapper_();
+ else
+ this.countryCode_ = this.address.countryCode;
+ }.bind(this));
}.bind(this));
- }.bind(this));
- // Open is called on the dialog after the address wrapper has been updated.
- },
+ // Open is called on the dialog after the address wrapper has been
+ // updated.
+ },
- /**
+ /**
* Returns a class to denote how long this entry is.
* @param {settings.address.AddressComponentUI} setting
* @return {string}
*/
- long_: function(setting) {
- return setting.component.isLongField ? 'long' : '';
- },
+ long_: function(setting) {
+ return setting.component.isLongField ? 'long' : '';
+ },
- /**
- * Updates the wrapper that represents this address in the country's format.
- * @private
- */
- updateAddressWrapper_: function() {
- // Default to the last country used if no country code is provided.
- var countryCode = this.countryCode_ || this.countries_[0].countryCode;
- this.countryInfo.getAddressFormat(countryCode).then(function(format) {
- this.addressWrapper_ = format.components.map(function(component) {
- return component.row.map(function(c) {
- return new settings.address.AddressComponentUI(this.address, c);
+ /**
+ * Updates the wrapper that represents this address in the country's format.
+ * @private
+ */
+ updateAddressWrapper_: function() {
+ // Default to the last country used if no country code is provided.
+ var countryCode = this.countryCode_ || this.countries_[0].countryCode;
+ this.countryInfo.getAddressFormat(countryCode).then(function(format) {
+ this.addressWrapper_ = format.components.map(function(component) {
+ return component.row.map(function(c) {
+ return new settings.address.AddressComponentUI(this.address, c);
+ }.bind(this));
}.bind(this));
- }.bind(this));
- // Flush dom before resize and savability updates.
- Polymer.dom.flush();
+ // Flush dom before resize and savability updates.
+ Polymer.dom.flush();
- this.updateCanSave_();
+ this.updateCanSave_();
- this.fire('on-update-address-wrapper'); // For easier testing.
+ this.fire('on-update-address-wrapper'); // For easier testing.
- var dialog = /** @type {HTMLDialogElement} */(this.$.dialog);
- if (!dialog.open)
- dialog.showModal();
- }.bind(this));
- },
+ var dialog = /** @type {HTMLDialogElement} */ (this.$.dialog);
+ if (!dialog.open)
+ dialog.showModal();
+ }.bind(this));
+ },
- updateCanSave_: function() {
- var inputs = this.$.dialog.querySelectorAll('.address-column');
+ updateCanSave_: function() {
+ var inputs = this.$.dialog.querySelectorAll('.address-column');
- for (var i = 0; i < inputs.length; ++i) {
- if (inputs[i].value) {
- this.canSave_ = true;
- this.fire('on-update-can-save'); // For easier testing.
- return;
+ for (var i = 0; i < inputs.length; ++i) {
+ if (inputs[i].value) {
+ this.canSave_ = true;
+ this.fire('on-update-can-save'); // For easier testing.
+ return;
+ }
}
- }
- this.canSave_ = false;
- this.fire('on-update-can-save'); // For easier testing.
- },
+ this.canSave_ = false;
+ this.fire('on-update-can-save'); // For easier testing.
+ },
- /**
+ /**
* @param {!chrome.autofillPrivate.CountryEntry} country
* @return {string}
* @private
*/
- getCode_: function(country) {
- return country.countryCode || 'SPACER';
- },
+ getCode_: function(country) {
+ return country.countryCode || 'SPACER';
+ },
- /**
+ /**
* @param {!chrome.autofillPrivate.CountryEntry} country
* @return {string}
* @private
*/
- getName_: function(country) {
- return country.name || '------';
- },
+ getName_: function(country) {
+ return country.name || '------';
+ },
- /**
+ /**
* @param {!chrome.autofillPrivate.CountryEntry} country
* @return {boolean}
* @private
*/
- isDivision_: function(country) {
- return !country.countryCode;
- },
+ isDivision_: function(country) {
+ return !country.countryCode;
+ },
- /** @private */
- onCancelTap_: function() {
- this.$.dialog.cancel();
- },
+ /** @private */
+ onCancelTap_: function() {
+ this.$.dialog.cancel();
+ },
- /**
- * Handler for tapping the save button.
- * @private
- */
- onSaveButtonTap_: function() {
- // Set a default country if none is set.
- if (!this.address.countryCode)
- this.address.countryCode = this.countries_[0].countryCode;
+ /**
+ * Handler for tapping the save button.
+ * @private
+ */
+ onSaveButtonTap_: function() {
+ // Set a default country if none is set.
+ if (!this.address.countryCode)
+ this.address.countryCode = this.countries_[0].countryCode;
- this.address.phoneNumbers = this.phoneNumber_ ? [this.phoneNumber_] : [];
- this.address.emailAddresses = this.email_ ? [this.email_] : [];
+ this.address.phoneNumbers = this.phoneNumber_ ? [this.phoneNumber_] : [];
+ this.address.emailAddresses = this.email_ ? [this.email_] : [];
- this.fire('save-address', this.address);
- this.$.dialog.close();
- },
+ this.fire('save-address', this.address);
+ this.$.dialog.close();
+ },
- /**
- * Syncs the country code back to the address and rebuilds the address wrapper
- * for the new location.
- * @param {string|undefined} countryCode
- * @private
- */
- onUpdateCountryCode_: function(countryCode) {
- this.address.countryCode = countryCode;
- this.updateAddressWrapper_();
- },
-
- /** @private */
- onCountryChange_: function() {
- var countrySelect = /** @type {!HTMLSelectElement} */ (this.$$('select'));
- this.countryCode_ = countrySelect.value;
- },
-});
+ /**
+ * Syncs the country code back to the address and rebuilds the address
+ * wrapper
+ * for the new location.
+ * @param {string|undefined} countryCode
+ * @private
+ */
+ onUpdateCountryCode_: function(countryCode) {
+ this.address.countryCode = countryCode;
+ this.updateAddressWrapper_();
+ },
+
+ /** @private */
+ onCountryChange_: function() {
+ var countrySelect = /** @type {!HTMLSelectElement} */ (this.$$('select'));
+ this.countryCode_ = countrySelect.value;
+ },
+ });
})();
cr.define('settings.address', function() {

Powered by Google App Engine
This is Rietveld 408576698