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 @@
#include "base/macros.h"
#include "components/autofill/core/browser/personal_data_manager_observer.h"
// PersonalDataManagerObserverBridgeDelegate is used by PersonalDataManager to
// informs its client implemented in Objective-C when it has finished loading
// personal data from the web database.
@protocol PersonalDataManagerObserverBridgeDelegate<NSObject>
// PersonalDataManagerObserver is used by PersonalDataManager to informs its
// client implemented in Objective-C when it has finished loading personal data
// from the web database.
@protocol PersonalDataManagerObserver<NSObject>
// Called when the PersonalDataManager changed in some way.
- (void)onPersonalDataChanged;
......@@ -32,7 +32,7 @@ namespace autofill {
class PersonalDataManagerObserverBridge : public PersonalDataManagerObserver {
public:
explicit PersonalDataManagerObserverBridge(
id<PersonalDataManagerObserverBridgeDelegate> delegate);
id<PersonalDataManagerObserver> delegate);
~PersonalDataManagerObserverBridge() override;
// PersonalDataManagerObserver implementation.
......@@ -40,7 +40,7 @@ class PersonalDataManagerObserverBridge : public PersonalDataManagerObserver {
void OnInsufficientFormData() override;
private:
__unsafe_unretained id<PersonalDataManagerObserverBridgeDelegate> delegate_;
__weak id<PersonalDataManagerObserver> delegate_;
DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerObserverBridge);
};
......
......@@ -13,7 +13,7 @@
namespace autofill {
PersonalDataManagerObserverBridge::PersonalDataManagerObserverBridge(
id<PersonalDataManagerObserverBridgeDelegate> delegate)
id<PersonalDataManagerObserver> delegate)
: delegate_(delegate) {
DCHECK(delegate_);
}
......
......@@ -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]">
Autofill Forms
</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]">
Hide keyboard
</message>
......
......@@ -373,6 +373,8 @@ source_set("eg_tests") {
":settings",
"//base",
"//base/test:test_support",
"//components/autofill/core/browser",
"//components/autofill/core/browser:test_support",
"//components/autofill/core/common",
"//components/browser_sync",
"//components/browsing_data/core",
......@@ -389,6 +391,7 @@ source_set("eg_tests") {
"//ios/chrome/app/strings",
"//ios/chrome/app/theme",
"//ios/chrome/browser",
"//ios/chrome/browser/autofill",
"//ios/chrome/browser/browser_state",
"//ios/chrome/browser/browsing_data:feature_flags",
"//ios/chrome/browser/content_settings",
......
......@@ -72,8 +72,8 @@ TEST_F(AutofillCollectionViewControllerTest, TestInitialization) {
// Expect one header section.
EXPECT_EQ(1, NumberOfSections());
// Expect header section to contain one row.
EXPECT_EQ(1, NumberOfItemsInSection(0));
// Expect header section to contain three rows.
EXPECT_EQ(3, NumberOfItemsInSection(0));
}
// Adding a single address results in an address section.
......@@ -82,8 +82,8 @@ TEST_F(AutofillCollectionViewControllerTest, TestOneProfile) {
CreateController();
// Expect two sections (header and addresses section).
EXPECT_EQ(2, NumberOfSections());
// Expect header section to contain one row.
EXPECT_EQ(1, NumberOfItemsInSection(0));
// Expect header section to contain three rows.
EXPECT_EQ(3, NumberOfItemsInSection(0));
// Expect address section to contain 1 row (the address itself).
EXPECT_EQ(1, NumberOfItemsInSection(1));
}
......@@ -107,8 +107,8 @@ TEST_F(AutofillCollectionViewControllerTest, TestOneCreditCard) {
CreateController();
// Expect two sections (header and credit card section).
EXPECT_EQ(2, NumberOfSections());
// Expect header section to contain one row.
EXPECT_EQ(1, NumberOfItemsInSection(0));
// Expect header section to contain three rows.
EXPECT_EQ(3, NumberOfItemsInSection(0));
// Expect credit card section to contain 1 row (the credit card itself).
EXPECT_EQ(1, NumberOfItemsInSection(1));
}
......@@ -119,8 +119,8 @@ TEST_F(AutofillCollectionViewControllerTest, TestOneProfileItemDeleted) {
CreateController();
// Expect two sections (header and addresses section).
EXPECT_EQ(2, NumberOfSections());
// Expect header section to contain one row.
EXPECT_EQ(1, NumberOfItemsInSection(0));
// Expect header section to contain three rows.
EXPECT_EQ(3, NumberOfItemsInSection(0));
// Expect address section to contain 1 row (the address itself).
EXPECT_EQ(1, NumberOfItemsInSection(1));
......@@ -158,8 +158,8 @@ TEST_F(AutofillCollectionViewControllerTest, TestOneProfileItemDeleted) {
// Verify the resulting UI.
// Expect one header section.
EXPECT_EQ(1, NumberOfSections());
// Expect header section to contain one row.
EXPECT_EQ(1, NumberOfItemsInSection(0));
// Expect header section to contain three rows.
EXPECT_EQ(3, NumberOfItemsInSection(0));
}
} // 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