Commit a85ac36b authored by sebsg's avatar sebsg Committed by Commit Bot

[Autofill] Remove split settings page part1.

This removes code from the html and js files.

Bug: 930204
Change-Id: Ia3ff2e6f0c85ee2d820edaba8ce63127a3eca984
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1500055
Commit-Queue: Sebastien Seguin-Gagnon <sebsg@chromium.org>
Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#637818}
parent 833b27d3
...@@ -59,8 +59,6 @@ ...@@ -59,8 +59,6 @@
<span>$i18nRaw{manageCreditCardsLabel}</span> <span>$i18nRaw{manageCreditCardsLabel}</span>
</div> </div>
<!--The version of settings that contains all the credit cards.-->
<template is="dom-if" if="[[!splitCreditCardList_]]">
<div class="settings-box continuation"> <div class="settings-box continuation">
<h2 class="start">$i18n{creditCards}</h2> <h2 class="start">$i18n{creditCards}</h2>
<paper-button id="addCreditCard" <paper-button id="addCreditCard"
...@@ -86,45 +84,6 @@ ...@@ -86,45 +84,6 @@
<settings-credit-card-list id="creditCardList" class="list-frame" <settings-credit-card-list id="creditCardList" class="list-frame"
credit-cards="[[creditCards]]"> credit-cards="[[creditCards]]">
</settings-credit-card-list> </settings-credit-card-list>
</template>
<!--The version of settings that have split credit card sections.-->
<template is="dom-if" if="[[splitCreditCardList_]]">
<!--The section that contains the local credit cards.-->
<div class="settings-box continuation">
<h2 class="start">$i18n{localCreditCardsSectionTitle}</h2>
<paper-button id="addCreditCard"
class="secondary-button header-aligned-button"
on-click="onAddCreditCardTap_"
hidden$="[[!prefs.autofill.credit_card_enabled.value]]">
$i18n{add}
</paper-button>
</div>
<div class="settings-box two-line" id="migrateCreditCards"
hidden$="[[!checkIfMigratable_(syncStatus, localCreditCards,
prefs.autofill.credit_card_enabled.value)]]"
on-click="onMigrateCreditCardsClick_" actionable>
<div class="start">
$i18n{migrateCreditCardsLabel}
<div class="secondary">[[migratableCreditCardsInfo_]]</div>
</div>
<paper-icon-button-light id="migrateCreditCardsButton"
class="subpage-arrow">
<button aria-label="[[migrateCreditCardsLabel_]]"></button>
</paper-icon-button-light>
</div>
<settings-credit-card-list id="localCreditCardList" class="list-frame"
credit-cards="[[localCreditCards]]">
</settings-credit-card-list>
<!--The section that contains the server credit cards.-->
<div class="settings-box continuation">
<h2 class="start">$i18n{serverCreditCardsSectionTitle}</h2>
</div>
<settings-credit-card-list id="serverCreditCardList" class="list-frame"
credit-cards="[[serverCreditCards]]">
</settings-credit-card-list>
</template>
<cr-action-menu id="creditCardSharedMenu"> <cr-action-menu id="creditCardSharedMenu">
<button id="menuEditCreditCard" class="dropdown-item" <button id="menuEditCreditCard" class="dropdown-item"
......
...@@ -18,54 +18,18 @@ class PaymentsManager { ...@@ -18,54 +18,18 @@ class PaymentsManager {
*/ */
addCreditCardListChangedListener(listener) {} addCreditCardListChangedListener(listener) {}
/**
* Add an observer to the list of local credit cards.
* @param {function(!Array<!PaymentsManager.CreditCardEntry>):void} listener
*/
addLocalCreditCardListChangedListener(listener) {}
/**
* Add an observer to the list of server credit cards.
* @param {function(!Array<!PaymentsManager.CreditCardEntry>):void} listener
*/
addServerCreditCardListChangedListener(listener) {}
/** /**
* Remove an observer from the list of credit cards. * Remove an observer from the list of credit cards.
* @param {function(!Array<!PaymentsManager.CreditCardEntry>):void} listener * @param {function(!Array<!PaymentsManager.CreditCardEntry>):void} listener
*/ */
removeCreditCardListChangedListener(listener) {} removeCreditCardListChangedListener(listener) {}
/**
* Remove an observer from the list of local credit cards.
* @param {function(!Array<!PaymentsManager.CreditCardEntry>):void} listener
*/
removeLocalCreditCardListChangedListener(listener) {}
/**
* Remove an observer from the list of server credit cards.
* @param {function(!Array<!PaymentsManager.CreditCardEntry>):void} listener
*/
removeServerCreditCardListChangedListener(listener) {}
/** /**
* Request the list of credit cards. * Request the list of credit cards.
* @param {function(!Array<!PaymentsManager.CreditCardEntry>):void} callback * @param {function(!Array<!PaymentsManager.CreditCardEntry>):void} callback
*/ */
getCreditCardList(callback) {} getCreditCardList(callback) {}
/**
* Request the list of local credit cards.
* @param {function(!Array<!PaymentsManager.CreditCardEntry>):void} callback
*/
getLocalCreditCardList(callback) {}
/**
* Request the list of server credit cards.
* @param {function(!Array<!PaymentsManager.CreditCardEntry>):void} callback
*/
getServerCreditCardList(callback) {}
/** @param {string} guid The GUID of the credit card to remove. */ /** @param {string} guid The GUID of the credit card to remove. */
removeCreditCard(guid) {} removeCreditCard(guid) {}
...@@ -102,48 +66,16 @@ class PaymentsManagerImpl { ...@@ -102,48 +66,16 @@ class PaymentsManagerImpl {
chrome.autofillPrivate.onCreditCardListChanged.addListener(listener); chrome.autofillPrivate.onCreditCardListChanged.addListener(listener);
} }
/** @override */
addLocalCreditCardListChangedListener(listener) {
chrome.autofillPrivate.onLocalCreditCardListChanged.addListener(listener);
}
/** @override */
addServerCreditCardListChangedListener(listener) {
chrome.autofillPrivate.onServerCreditCardListChanged.addListener(listener);
}
/** @override */ /** @override */
removeCreditCardListChangedListener(listener) { removeCreditCardListChangedListener(listener) {
chrome.autofillPrivate.onCreditCardListChanged.removeListener(listener); chrome.autofillPrivate.onCreditCardListChanged.removeListener(listener);
} }
/** @override */
removeLocalCreditCardListChangedListener(listener) {
chrome.autofillPrivate.onLocalCreditCardListChanged.removeListener(
listener);
}
/** @override */
removeServerCreditCardListChangedListener(listener) {
chrome.autofillPrivate.onServerCreditCardListChanged.removeListener(
listener);
}
/** @override */ /** @override */
getCreditCardList(callback) { getCreditCardList(callback) {
chrome.autofillPrivate.getCreditCardList(callback); chrome.autofillPrivate.getCreditCardList(callback);
} }
/** @override */
getLocalCreditCardList(callback) {
chrome.autofillPrivate.getLocalCreditCardList(callback);
}
/** @override */
getServerCreditCardList(callback) {
chrome.autofillPrivate.getServerCreditCardList(callback);
}
/** @override */ /** @override */
removeCreditCard(guid) { removeCreditCard(guid) {
chrome.autofillPrivate.removeEntry(assert(guid)); chrome.autofillPrivate.removeEntry(assert(guid));
...@@ -190,18 +122,6 @@ Polymer({ ...@@ -190,18 +122,6 @@ Polymer({
*/ */
creditCards: Array, creditCards: Array,
/**
* An array of saved locl credit cards.
* @type {!Array<!PaymentsManager.CreditCardEntry>}
*/
localCreditCards: Array,
/**
* An array of saved server credit cards.
* @type {!Array<!PaymentsManager.CreditCardEntry>}
*/
serverCreditCards: Array,
/** /**
* The model for any credit card related action menus or dialogs. * The model for any credit card related action menus or dialogs.
* @private {?chrome.autofillPrivate.CreditCardEntry} * @private {?chrome.autofillPrivate.CreditCardEntry}
...@@ -291,18 +211,6 @@ Polymer({ ...@@ -291,18 +211,6 @@ Polymer({
}, },
readOnly: true, readOnly: true,
}, },
/**
* True when the cards list should be split in two..
* @private {boolean}
*/
splitCreditCardList_: {
type: Boolean,
value: function() {
return loadTimeData.getBoolean('splitCreditCardList');
},
readOnly: true,
},
}, },
listeners: { listeners: {
...@@ -330,18 +238,6 @@ Polymer({ ...@@ -330,18 +238,6 @@ Polymer({
*/ */
setCreditCardsListener_: null, setCreditCardsListener_: null,
/**
* @type {?function(!Array<!PaymentsManager.CreditCardEntry>)}
* @private
*/
setLocalCreditCardsListener_: null,
/**
* @type {?function(!Array<!PaymentsManager.CreditCardEntry>)}
* @private
*/
setServerCreditCardsListener_: null,
/** @private {?settings.SyncBrowserProxy} */ /** @private {?settings.SyncBrowserProxy} */
syncBrowserProxy_: null, syncBrowserProxy_: null,
...@@ -352,35 +248,19 @@ Polymer({ ...@@ -352,35 +248,19 @@ Polymer({
const setCreditCardsListener = list => { const setCreditCardsListener = list => {
this.creditCards = list; this.creditCards = list;
}; };
/** @type {function(!Array<!PaymentsManager.CreditCardEntry>)} */
const setLocalCreditCardsListener = list => {
this.localCreditCards = list;
};
/** @type {function(!Array<!PaymentsManager.CreditCardEntry>)} */
const setServerCreditCardsListener = list => {
this.serverCreditCards = list;
};
// Remember the bound reference in order to detach. // Remember the bound reference in order to detach.
this.setCreditCardsListener_ = setCreditCardsListener; this.setCreditCardsListener_ = setCreditCardsListener;
this.setLocalCreditCardsListener_ = setLocalCreditCardsListener;
this.setServerCreditCardsListener_ = setServerCreditCardsListener;
// Set the managers. These can be overridden by tests. // Set the managers. These can be overridden by tests.
this.paymentsManager_ = PaymentsManagerImpl.getInstance(); this.paymentsManager_ = PaymentsManagerImpl.getInstance();
// Request initial data. // Request initial data.
this.paymentsManager_.getCreditCardList(setCreditCardsListener); this.paymentsManager_.getCreditCardList(setCreditCardsListener);
this.paymentsManager_.getLocalCreditCardList(setLocalCreditCardsListener);
this.paymentsManager_.getServerCreditCardList(setServerCreditCardsListener);
// Listen for changes. // Listen for changes.
this.paymentsManager_.addCreditCardListChangedListener( this.paymentsManager_.addCreditCardListChangedListener(
setCreditCardsListener); setCreditCardsListener);
this.paymentsManager_.addLocalCreditCardListChangedListener(
setLocalCreditCardsListener);
this.paymentsManager_.addServerCreditCardListChangedListener(
setServerCreditCardsListener);
this.syncBrowserProxy_ = settings.SyncBrowserProxyImpl.getInstance(); this.syncBrowserProxy_ = settings.SyncBrowserProxyImpl.getInstance();
this.syncBrowserProxy_.getSyncStatus().then( this.syncBrowserProxy_.getSyncStatus().then(
...@@ -397,12 +277,6 @@ Polymer({ ...@@ -397,12 +277,6 @@ Polymer({
this.paymentsManager_.removeCreditCardListChangedListener( this.paymentsManager_.removeCreditCardListChangedListener(
/** @type {function(!Array<!PaymentsManager.CreditCardEntry>)} */ ( /** @type {function(!Array<!PaymentsManager.CreditCardEntry>)} */ (
this.setCreditCardsListener_)); this.setCreditCardsListener_));
this.paymentsManager_.removeLocalCreditCardListChangedListener(
/** @type {function(!Array<!PaymentsManager.CreditCardEntry>)} */ (
this.setLocalCreditCardsListener_));
this.paymentsManager_.removeServerCreditCardListChangedListener(
/** @type {function(!Array<!PaymentsManager.CreditCardEntry>)} */ (
this.setServerCreditCardsListener_));
}, },
/** /**
......
...@@ -1467,8 +1467,6 @@ void AddAutofillStrings(content::WebUIDataSource* html_source, ...@@ -1467,8 +1467,6 @@ void AddAutofillStrings(content::WebUIDataSource* html_source,
{"autofillPageTitle", IDS_SETTINGS_AUTOFILL}, {"autofillPageTitle", IDS_SETTINGS_AUTOFILL},
{"passwords", IDS_SETTINGS_PASSWORDS}, {"passwords", IDS_SETTINGS_PASSWORDS},
{"creditCards", IDS_AUTOFILL_PAYMENT_METHODS}, {"creditCards", IDS_AUTOFILL_PAYMENT_METHODS},
{"localCreditCardsSectionTitle", IDS_AUTOFILL_LOCAL_PAYMENT_METHODS},
{"serverCreditCardsSectionTitle", IDS_AUTOFILL_SERVER_PAYMENT_METHODS},
{"noCreditCardsFound", IDS_SETTINGS_PAYMENT_METHODS_NONE}, {"noCreditCardsFound", IDS_SETTINGS_PAYMENT_METHODS_NONE},
{"googlePayments", IDS_SETTINGS_GOOGLE_PAYMENTS}, {"googlePayments", IDS_SETTINGS_GOOGLE_PAYMENTS},
{"googlePaymentsCached", IDS_SETTINGS_GOOGLE_PAYMENTS_CACHED}, {"googlePaymentsCached", IDS_SETTINGS_GOOGLE_PAYMENTS_CACHED},
...@@ -1952,11 +1950,6 @@ void AddPeopleStrings(content::WebUIDataSource* html_source, Profile* profile) { ...@@ -1952,11 +1950,6 @@ void AddPeopleStrings(content::WebUIDataSource* html_source, Profile* profile) {
html_source->AddBoolean("isAccountManagerEnabled", html_source->AddBoolean("isAccountManagerEnabled",
chromeos::IsAccountManagerAvailable(profile)); chromeos::IsAccountManagerAvailable(profile));
#endif #endif
html_source->AddBoolean(
"splitCreditCardList",
base::FeatureList::IsEnabled(
autofill::features::kAutofillSettingsCardTypeSplit));
} }
void AddPrintingStrings(content::WebUIDataSource* html_source) { void AddPrintingStrings(content::WebUIDataSource* html_source) {
......
...@@ -124,10 +124,6 @@ cr.define('settings_autofill_page', function() { ...@@ -124,10 +124,6 @@ cr.define('settings_autofill_page', function() {
const expected = new PaymentsManagerExpectations(); const expected = new PaymentsManagerExpectations();
expected.requestedCreditCards = 1; expected.requestedCreditCards = 1;
expected.listeningCreditCards = 1; expected.listeningCreditCards = 1;
expected.requestedLocalCreditCards = 1;
expected.listeningLocalCreditCards = 1;
expected.requestedServerCreditCards = 1;
expected.listeningServerCreditCards = 1;
return expected; return expected;
} }
...@@ -176,8 +172,6 @@ cr.define('settings_autofill_page', function() { ...@@ -176,8 +172,6 @@ cr.define('settings_autofill_page', function() {
autofillManager.assertExpectations(autofillExpectations); autofillManager.assertExpectations(autofillExpectations);
paymentsExpectations.listeningCreditCards = 0; paymentsExpectations.listeningCreditCards = 0;
paymentsExpectations.listeningLocalCreditCards = 0;
paymentsExpectations.listeningServerCreditCards = 0;
paymentsManager.assertExpectations(paymentsExpectations); paymentsManager.assertExpectations(paymentsExpectations);
destroyPrefs(prefs); destroyPrefs(prefs);
......
...@@ -220,11 +220,7 @@ TestAutofillManager.prototype = { ...@@ -220,11 +220,7 @@ TestAutofillManager.prototype = {
class PaymentsManagerExpectations { class PaymentsManagerExpectations {
constructor() { constructor() {
this.requestedCreditCards = 0; this.requestedCreditCards = 0;
this.requestedLocalCreditCards = 0;
this.requestedServerCreditCards = 0;
this.listeningCreditCards = 0; this.listeningCreditCards = 0;
this.listeningLocalCreditCards = 0;
this.listeningServerCreditCards = 0;
} }
} }
...@@ -239,15 +235,11 @@ function TestPaymentsManager() { ...@@ -239,15 +235,11 @@ function TestPaymentsManager() {
// Set these to have non-empty data. // Set these to have non-empty data.
this.data = { this.data = {
creditCards: [], creditCards: [],
localCreditCards: [],
serverCreditCards: [],
}; };
// Holds the last callbacks so they can be called when needed. // Holds the last callbacks so they can be called when needed.
this.lastCallback = { this.lastCallback = {
addCreditCardListChangedListener: null, addCreditCardListChangedListener: null,
addLocalCreditCardListChangedListener: null,
addServerCreditCardListChangedListener: null,
}; };
} }
...@@ -258,51 +250,17 @@ TestPaymentsManager.prototype = { ...@@ -258,51 +250,17 @@ TestPaymentsManager.prototype = {
this.lastCallback.addCreditCardListChangedListener = listener; this.lastCallback.addCreditCardListChangedListener = listener;
}, },
/** @override */
addLocalCreditCardListChangedListener: function(listener) {
this.actual_.listeningLocalCreditCards++;
this.lastCallback.addLocalCreditCardListChangedListener = listener;
},
/** @override */
addServerCreditCardListChangedListener: function(listener) {
this.actual_.listeningServerCreditCards++;
this.lastCallback.addServerCreditCardListChangedListener = listener;
},
/** @override */ /** @override */
removeCreditCardListChangedListener: function(listener) { removeCreditCardListChangedListener: function(listener) {
this.actual_.listeningCreditCards--; this.actual_.listeningCreditCards--;
}, },
/** @override */
removeLocalCreditCardListChangedListener: function(listener) {
this.actual_.listeningLocalCreditCards--;
},
/** @override */
removeServerCreditCardListChangedListener: function(listener) {
this.actual_.listeningServerCreditCards--;
},
/** @override */ /** @override */
getCreditCardList: function(callback) { getCreditCardList: function(callback) {
this.actual_.requestedCreditCards++; this.actual_.requestedCreditCards++;
callback(this.data.creditCards); callback(this.data.creditCards);
}, },
/** @override */
getLocalCreditCardList: function(callback) {
this.actual_.requestedLocalCreditCards++;
callback(this.data.localCreditCards);
},
/** @override */
getServerCreditCardList: function(callback) {
this.actual_.requestedServerCreditCards++;
callback(this.data.serverCreditCards);
},
/** /**
* Verifies expectations. * Verifies expectations.
* @param {!PaymentsManagerExpectations} expected * @param {!PaymentsManagerExpectations} expected
...@@ -310,14 +268,6 @@ TestPaymentsManager.prototype = { ...@@ -310,14 +268,6 @@ TestPaymentsManager.prototype = {
assertExpectations: function(expected) { assertExpectations: function(expected) {
const actual = this.actual_; const actual = this.actual_;
assertEquals(expected.requestedCreditCards, actual.requestedCreditCards); assertEquals(expected.requestedCreditCards, actual.requestedCreditCards);
assertEquals(
expected.requestedLocalCreditCards, actual.requestedLocalCreditCards);
assertEquals(
expected.requestedServerCreditCards, actual.requestedServerCreditCards);
assertEquals(expected.listeningCreditCards, actual.listeningCreditCards); assertEquals(expected.listeningCreditCards, actual.listeningCreditCards);
assertEquals(
expected.listeningLocalCreditCards, actual.listeningLocalCreditCards);
assertEquals(
expected.listeningServerCreditCards, actual.listeningServerCreditCards);
}, },
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment