summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorestade <estade@chromium.org>2015-01-21 18:24:22 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-22 02:25:49 +0000
commit29e41141428199096695bcf97833403214da808a (patch)
tree8cf5350b6ef1db1c713785d7432101fee68c6ce7
parentc9bd3b9a5667a36c05592ec9d16533be91b4567c (diff)
downloadchromium_src-29e41141428199096695bcf97833403214da808a.zip
chromium_src-29e41141428199096695bcf97833403214da808a.tar.gz
chromium_src-29e41141428199096695bcf97833403214da808a.tar.bz2
Minor changes to still-unfinal chrome://settings/autofill wallet UI
1. add checkbox 2. add new pref 3. move checkbox to top of dialog (near mac contact book checkbox) BUG=446698 Review URL: https://codereview.chromium.org/858053003 Cr-Commit-Position: refs/heads/master@{#312532}
-rw-r--r--chrome/browser/autofill/android/personal_data_manager_android.cc6
-rw-r--r--chrome/browser/resources/options/autofill_options.html53
-rw-r--r--chrome/browser/resources/options/autofill_options.js6
-rw-r--r--components/autofill/core/browser/autofill_manager.cc4
-rw-r--r--components/autofill/core/browser/personal_data_manager.cc3
-rw-r--r--components/autofill/core/common/autofill_pref_names.cc3
-rw-r--r--components/autofill/core/common/autofill_pref_names.h1
7 files changed, 50 insertions, 26 deletions
diff --git a/chrome/browser/autofill/android/personal_data_manager_android.cc b/chrome/browser/autofill/android/personal_data_manager_android.cc
index 1b3f11a..527f29d 100644
--- a/chrome/browser/autofill/android/personal_data_manager_android.cc
+++ b/chrome/browser/autofill/android/personal_data_manager_android.cc
@@ -22,6 +22,7 @@
#include "components/autofill/core/browser/autofill_type.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/personal_data_manager.h"
+#include "components/autofill/core/common/autofill_pref_names.h"
#include "components/autofill/core/common/autofill_switches.h"
#include "jni/PersonalDataManager_jni.h"
@@ -354,13 +355,12 @@ static jboolean IsWalletImportFeatureAvailable(JNIEnv* env, jclass clazz) {
// Returns whether the Wallet import feature is enabled.
static jboolean IsWalletImportEnabled(JNIEnv* env, jclass clazz) {
- // TODO(estade): there is no pref yet, so just pretend yes.
- return true;
+ return GetPrefs()->GetBoolean(autofill::prefs::kAutofillWalletImportEnabled);
}
// Enables or disables the Wallet import feature.
static void SetWalletImportEnabled(JNIEnv* env, jclass clazz, jboolean enable) {
- // TODO(estade): there is no pref yet, so no-op.
+ GetPrefs()->SetBoolean(autofill::prefs::kAutofillWalletImportEnabled, enable);
}
// Returns an ISO 3166-1-alpha-2 country code for a |jcountry_name| using
diff --git a/chrome/browser/resources/options/autofill_options.html b/chrome/browser/resources/options/autofill_options.html
index 91529fb..716cedd 100644
--- a/chrome/browser/resources/options/autofill_options.html
+++ b/chrome/browser/resources/options/autofill_options.html
@@ -12,6 +12,27 @@
</label>
</div>
</if>
+ <!-- TODO(estade): This section shouldn't show if you're not signed into
+ sync. Or perhaps it should show with a link to go sign in with sync?
+ -->
+ <div id="autofill-wallet-setting-area" class="settings-row" hidden>
+ <div class="checkbox">
+ <label>
+ <input pref="autofill.wallet_import_enabled" type="checkbox">
+ <span>
+ Include
+ <a target="_blank" i18n-values="href:manageWalletAddressesUrl">
+ addresses</a>
+ and
+ <a target="_blank"
+ i18n-values="href:manageWalletPaymentMethodsUrl">cards</a>
+ stored in your Google Wallet
+ <!-- A reminder not to launch this UI. -->
+ <span style="font-size: 80%">translate me!</span>
+ </span>
+ </div>
+ </div>
+
<h3 i18n-content="autofillAddresses"></h3>
<div class="settings-list">
<list id="address-list"></list>
@@ -20,6 +41,7 @@
</button>
</div>
</div>
+
<h3 i18n-content="autofillCreditCards"></h3>
<div class="settings-list">
<list id="creditcard-list"></list>
@@ -28,29 +50,20 @@
i18n-content="autofillAddCreditCard"></button>
</div>
</div>
- <!-- TODO(estade): This section shouldn't show if you're not signed into
- sync. -->
- <div id="autofill-wallet-card-area" class="settings-row" hidden>
+
+ <!-- TODO(estade): what do we do with this section when the pref is unset?
+ -->
+ <div id="autofill-wallet-remask-cards-area">
+ <span class="settings-row">Credit cards from Wallet require authentication
+ once and then remain unlocked.
+ </span>
+ <a id="remask-server-cards-link"
+ is="action-link">Reset authenticated cards</a>
<!-- A reminder not to launch this UI. -->
- <span>Warning, these strings are not translated!</span>
- <div>
- Chrome will also suggest
- <a target="_blank" i18n-values="href:manageWalletAddressesUrl">
- addresses</a>
- and
- <a target="_blank" i18n-values="href:manageWalletPaymentMethodsUrl">
- cards</a>
- stored in your Wallet.
- </div>
- <div>
- <span>Credit cards from Wallet require authentication once and
- then remain unlocked.
- </span>
- <a id="remask-server-cards-link"
- is="action-link">Reset authenticated cards</a>
- </div>
+ <span style="font-size: 80%">translate me!</span>
</div>
</div>
+
<div class="action-area">
<a id="autofill-help" target="_blank" i18n-values="href:helpUrl"
i18n-content="helpButton">
diff --git a/chrome/browser/resources/options/autofill_options.js b/chrome/browser/resources/options/autofill_options.js
index 49ce81f..ce9775d 100644
--- a/chrome/browser/resources/options/autofill_options.js
+++ b/chrome/browser/resources/options/autofill_options.js
@@ -89,8 +89,10 @@ cr.define('options', function() {
return true; // Always follow the href
};
- $('autofill-wallet-card-area').hidden =
- !loadTimeData.getBoolean('enableAutofillWalletIntegration');
+ var enableWalletIntegration =
+ loadTimeData.getBoolean('enableAutofillWalletIntegration');
+ $('autofill-wallet-remask-cards-area').hidden = !enableWalletIntegration;
+ $('autofill-wallet-setting-area').hidden = !enableWalletIntegration;
// TODO(estade): there should probably be some indication of success.
$('remask-server-cards-link').onclick = function(event) {
chrome.send('remaskServerCards');
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc
index 02c45a63..18bd355 100644
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -173,6 +173,10 @@ void AutofillManager::RegisterProfilePrefs(
prefs::kAutofillEnabled,
true,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
+ registry->RegisterBooleanPref(
+ prefs::kAutofillWalletImportEnabled,
+ true,
+ user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
#if defined(OS_MACOSX)
registry->RegisterBooleanPref(
prefs::kAutofillAuxiliaryProfilesEnabled,
diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc
index c8d9d8e..911d07b 100644
--- a/components/autofill/core/browser/personal_data_manager.cc
+++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -676,7 +676,8 @@ const std::vector<CreditCard*>& PersonalDataManager::GetCreditCards() const {
credit_cards_.insert(credit_cards_.end(), local_credit_cards_.begin(),
local_credit_cards_.end());
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableWalletCardImport)) {
+ switches::kEnableWalletCardImport) &&
+ pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) {
credit_cards_.insert(credit_cards_.end(), server_credit_cards_.begin(),
server_credit_cards_.end());
}
diff --git a/components/autofill/core/common/autofill_pref_names.cc b/components/autofill/core/common/autofill_pref_names.cc
index 829d5e7..62fe49b 100644
--- a/components/autofill/core/common/autofill_pref_names.cc
+++ b/components/autofill/core/common/autofill_pref_names.cc
@@ -38,5 +38,8 @@ const char kAutofillPositiveUploadRate[] = "autofill.positive_upload_rate";
// true, then kAutofillMacAddressBookQueried is expected to also be true.
const char kAutofillUseMacAddressBook[] = "autofill.use_mac_address_book";
+// Boolean that's true when Wallet card and address import is enabled.
+const char kAutofillWalletImportEnabled[] = "autofill.wallet_import_enabled";
+
} // namespace prefs
} // namespace autofill
diff --git a/components/autofill/core/common/autofill_pref_names.h b/components/autofill/core/common/autofill_pref_names.h
index ea830cc..087780e 100644
--- a/components/autofill/core/common/autofill_pref_names.h
+++ b/components/autofill/core/common/autofill_pref_names.h
@@ -17,6 +17,7 @@ extern const char kAutofillMacAddressBookShowedCount[];
extern const char kAutofillNegativeUploadRate[];
extern const char kAutofillPositiveUploadRate[];
extern const char kAutofillUseMacAddressBook[];
+extern const char kAutofillWalletImportEnabled[];
} // namespace prefs
} // namespace autofill