Commit 3d14d788 authored by Moe Ahmadi's avatar Moe Ahmadi Committed by Commit Bot

[AF][IOS] Add fine-grained profile & credit card toggles to Autofill settings

screenshot: https://drive.google.com/open?id=1td8sD7YO_VwIlY8WTW5xRc4es7bOslxu

Bug: 860526
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I9d2f1a589d9ae1bb5bac45c04ceb973f88385a84
Reviewed-on: https://chromium-review.googlesource.com/1145484
Commit-Queue: Moe Ahmadi <mahmadi@chromium.org>
Reviewed-by: default avataredchin <edchin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577697}
parent 586af386
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
#include "base/macros.h" #include "base/macros.h"
#include "components/autofill/core/browser/personal_data_manager_observer.h" #include "components/autofill/core/browser/personal_data_manager_observer.h"
// PersonalDataManagerObserverBridgeDelegate is used by PersonalDataManager to // PersonalDataManagerObserver is used by PersonalDataManager to informs its
// informs its client implemented in Objective-C when it has finished loading // client implemented in Objective-C when it has finished loading personal data
// personal data from the web database. // from the web database.
@protocol PersonalDataManagerObserverBridgeDelegate<NSObject> @protocol PersonalDataManagerObserver<NSObject>
// Called when the PersonalDataManager changed in some way. // Called when the PersonalDataManager changed in some way.
- (void)onPersonalDataChanged; - (void)onPersonalDataChanged;
...@@ -32,7 +32,7 @@ namespace autofill { ...@@ -32,7 +32,7 @@ namespace autofill {
class PersonalDataManagerObserverBridge : public PersonalDataManagerObserver { class PersonalDataManagerObserverBridge : public PersonalDataManagerObserver {
public: public:
explicit PersonalDataManagerObserverBridge( explicit PersonalDataManagerObserverBridge(
id<PersonalDataManagerObserverBridgeDelegate> delegate); id<PersonalDataManagerObserver> delegate);
~PersonalDataManagerObserverBridge() override; ~PersonalDataManagerObserverBridge() override;
// PersonalDataManagerObserver implementation. // PersonalDataManagerObserver implementation.
...@@ -40,7 +40,7 @@ class PersonalDataManagerObserverBridge : public PersonalDataManagerObserver { ...@@ -40,7 +40,7 @@ class PersonalDataManagerObserverBridge : public PersonalDataManagerObserver {
void OnInsufficientFormData() override; void OnInsufficientFormData() override;
private: private:
__unsafe_unretained id<PersonalDataManagerObserverBridgeDelegate> delegate_; __weak id<PersonalDataManagerObserver> delegate_;
DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerObserverBridge); DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerObserverBridge);
}; };
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
namespace autofill { namespace autofill {
PersonalDataManagerObserverBridge::PersonalDataManagerObserverBridge( PersonalDataManagerObserverBridge::PersonalDataManagerObserverBridge(
id<PersonalDataManagerObserverBridgeDelegate> delegate) id<PersonalDataManagerObserver> delegate)
: delegate_(delegate) { : delegate_(delegate) {
DCHECK(delegate_); DCHECK(delegate_);
} }
......
...@@ -222,6 +222,12 @@ locale. The strings in this file are specific to iOS. ...@@ -222,6 +222,12 @@ locale. The strings in this file are specific to iOS.
<message name="IDS_IOS_AUTOFILL" desc="Title for the view in Settings for enabling/disabling Autofill. [Length: 15em] [iOS only]"> <message name="IDS_IOS_AUTOFILL" desc="Title for the view in Settings for enabling/disabling Autofill. [Length: 15em] [iOS only]">
Autofill Forms Autofill Forms
</message> </message>
<message name="IDS_IOS_ENABLE_AUTOFILL_PROFILES" desc="Title for the the toggle in Autofill Settings for enabling/disabling Autofill Addresses. Title case. [Length: unlimited] [iOS only]">
Save and Fill Addresses
</message>
<message name="IDS_IOS_ENABLE_AUTOFILL_CREDIT_CARDS" desc="Title for the toggle in Autofill Settings for enabling/disabling Autofill Credit Cards. Title case. [Length: unlimited] [iOS only]">
Save and Fill Credit Cards
</message>
<message name="IDS_IOS_AUTOFILL_ACCNAME_HIDE_KEYBOARD" desc="The accessible name for the hide keyboard button in the keyboard accessory shown when filling out forms. [Length: unlimited] [iOS only]"> <message name="IDS_IOS_AUTOFILL_ACCNAME_HIDE_KEYBOARD" desc="The accessible name for the hide keyboard button in the keyboard accessory shown when filling out forms. [Length: unlimited] [iOS only]">
Hide keyboard Hide keyboard
</message> </message>
......
...@@ -373,6 +373,8 @@ source_set("eg_tests") { ...@@ -373,6 +373,8 @@ source_set("eg_tests") {
":settings", ":settings",
"//base", "//base",
"//base/test:test_support", "//base/test:test_support",
"//components/autofill/core/browser",
"//components/autofill/core/browser:test_support",
"//components/autofill/core/common", "//components/autofill/core/common",
"//components/browser_sync", "//components/browser_sync",
"//components/browsing_data/core", "//components/browsing_data/core",
...@@ -389,6 +391,7 @@ source_set("eg_tests") { ...@@ -389,6 +391,7 @@ source_set("eg_tests") {
"//ios/chrome/app/strings", "//ios/chrome/app/strings",
"//ios/chrome/app/theme", "//ios/chrome/app/theme",
"//ios/chrome/browser", "//ios/chrome/browser",
"//ios/chrome/browser/autofill",
"//ios/chrome/browser/browser_state", "//ios/chrome/browser/browser_state",
"//ios/chrome/browser/browsing_data:feature_flags", "//ios/chrome/browser/browsing_data:feature_flags",
"//ios/chrome/browser/content_settings", "//ios/chrome/browser/content_settings",
......
...@@ -72,8 +72,8 @@ TEST_F(AutofillCollectionViewControllerTest, TestInitialization) { ...@@ -72,8 +72,8 @@ TEST_F(AutofillCollectionViewControllerTest, TestInitialization) {
// Expect one header section. // Expect one header section.
EXPECT_EQ(1, NumberOfSections()); EXPECT_EQ(1, NumberOfSections());
// Expect header section to contain one row. // Expect header section to contain three rows.
EXPECT_EQ(1, NumberOfItemsInSection(0)); EXPECT_EQ(3, NumberOfItemsInSection(0));
} }
// Adding a single address results in an address section. // Adding a single address results in an address section.
...@@ -82,8 +82,8 @@ TEST_F(AutofillCollectionViewControllerTest, TestOneProfile) { ...@@ -82,8 +82,8 @@ TEST_F(AutofillCollectionViewControllerTest, TestOneProfile) {
CreateController(); CreateController();
// Expect two sections (header and addresses section). // Expect two sections (header and addresses section).
EXPECT_EQ(2, NumberOfSections()); EXPECT_EQ(2, NumberOfSections());
// Expect header section to contain one row. // Expect header section to contain three rows.
EXPECT_EQ(1, NumberOfItemsInSection(0)); EXPECT_EQ(3, NumberOfItemsInSection(0));
// Expect address section to contain 1 row (the address itself). // Expect address section to contain 1 row (the address itself).
EXPECT_EQ(1, NumberOfItemsInSection(1)); EXPECT_EQ(1, NumberOfItemsInSection(1));
} }
...@@ -107,8 +107,8 @@ TEST_F(AutofillCollectionViewControllerTest, TestOneCreditCard) { ...@@ -107,8 +107,8 @@ TEST_F(AutofillCollectionViewControllerTest, TestOneCreditCard) {
CreateController(); CreateController();
// Expect two sections (header and credit card section). // Expect two sections (header and credit card section).
EXPECT_EQ(2, NumberOfSections()); EXPECT_EQ(2, NumberOfSections());
// Expect header section to contain one row. // Expect header section to contain three rows.
EXPECT_EQ(1, NumberOfItemsInSection(0)); EXPECT_EQ(3, NumberOfItemsInSection(0));
// Expect credit card section to contain 1 row (the credit card itself). // Expect credit card section to contain 1 row (the credit card itself).
EXPECT_EQ(1, NumberOfItemsInSection(1)); EXPECT_EQ(1, NumberOfItemsInSection(1));
} }
...@@ -119,8 +119,8 @@ TEST_F(AutofillCollectionViewControllerTest, TestOneProfileItemDeleted) { ...@@ -119,8 +119,8 @@ TEST_F(AutofillCollectionViewControllerTest, TestOneProfileItemDeleted) {
CreateController(); CreateController();
// Expect two sections (header and addresses section). // Expect two sections (header and addresses section).
EXPECT_EQ(2, NumberOfSections()); EXPECT_EQ(2, NumberOfSections());
// Expect header section to contain one row. // Expect header section to contain three rows.
EXPECT_EQ(1, NumberOfItemsInSection(0)); EXPECT_EQ(3, NumberOfItemsInSection(0));
// Expect address section to contain 1 row (the address itself). // Expect address section to contain 1 row (the address itself).
EXPECT_EQ(1, NumberOfItemsInSection(1)); EXPECT_EQ(1, NumberOfItemsInSection(1));
...@@ -158,8 +158,8 @@ TEST_F(AutofillCollectionViewControllerTest, TestOneProfileItemDeleted) { ...@@ -158,8 +158,8 @@ TEST_F(AutofillCollectionViewControllerTest, TestOneProfileItemDeleted) {
// Verify the resulting UI. // Verify the resulting UI.
// Expect one header section. // Expect one header section.
EXPECT_EQ(1, NumberOfSections()); EXPECT_EQ(1, NumberOfSections());
// Expect header section to contain one row. // Expect header section to contain three rows.
EXPECT_EQ(1, NumberOfItemsInSection(0)); EXPECT_EQ(3, NumberOfItemsInSection(0));
} }
} // namespace } // namespace
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