| Commit-Queue | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
LGTM! I've added two optional questions/suggestions.
#if BUILDFLAG(IOS_USE_BRANDED_ASSETS)
UIImage* image = MakeSymbolMulticolor(CustomSymbolWithPointSize(
kMulticolorChromeballSymbol, kAutofillAiInfobarSymbolPointSize));
#else
UIImage* image = CustomSymbolWithPointSize(kChromeProductSymbol,
kAutofillAiInfobarSymbolPointSize);
#endif // BUILDFLAG(IOS_USE_BRANDED_ASSETS)
if (image) {
icon_ = ui::ImageModel::FromImage(gfx::Image(image));optional nit: Can we move the icon setup in a method in the namespace and call it here?
TEST_F(ChromeAutofillClientIOSTest, ShowAutofillAiPreFetchFailureNotification) {Would it be useful to add a test for when an infobar already is being shown (that is not the AUTOFILL_AI_PREFETCH_FAILURE_INFOBAR_DELEGATE_IOS), and verifying that after ````client().ShowAutofillAiPreFetchFailureNotification();```` the final infobar is of type AUTOFILL_AI_PREFETCH_FAILURE_INFOBAR_DELEGATE_IOS ?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
#if BUILDFLAG(IOS_USE_BRANDED_ASSETS)
UIImage* image = MakeSymbolMulticolor(CustomSymbolWithPointSize(
kMulticolorChromeballSymbol, kAutofillAiInfobarSymbolPointSize));
#else
UIImage* image = CustomSymbolWithPointSize(kChromeProductSymbol,
kAutofillAiInfobarSymbolPointSize);
#endif // BUILDFLAG(IOS_USE_BRANDED_ASSETS)
if (image) {
icon_ = ui::ImageModel::FromImage(gfx::Image(image));optional nit: Can we move the icon setup in a method in the namespace and call it here?
Done.
TEST_F(ChromeAutofillClientIOSTest, ShowAutofillAiPreFetchFailureNotification) {Would it be useful to add a test for when an infobar already is being shown (that is not the AUTOFILL_AI_PREFETCH_FAILURE_INFOBAR_DELEGATE_IOS), and verifying that after ````client().ShowAutofillAiPreFetchFailureNotification();```` the final infobar is of type AUTOFILL_AI_PREFETCH_FAILURE_INFOBAR_DELEGATE_IOS ?
Infobar popups have priority. If two infobar popups with different priorities are called at the same time, infobars should contain both. Showing them on the screen is not directly tied to the array. What we can do however here is to call it twice, and see the same infobar item is only scheduled once.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
LGTM!
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Small nit that I forgot to mention in my last review.
constexpr CGFloat kAutofillAiInfobarSymbolPointSize = 24.0;nit: There should be a comment above this constant.
ui::ImageModel GetPrefetchFailureIcon() {nit: There should be a comment above this method.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
constexpr CGFloat kAutofillAiInfobarSymbolPointSize = 24.0;nit: There should be a comment above this constant.
Done.
nit: There should be a comment above this method.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
AUTOFILL_AI_PREFETCH_FAILURE_INFOBAR_DELEGATE_IOS = 136,Nit: the UI string uses "PRE_FETCH" instead of "PREFETCH", so this probably should use the same two word spelling.
bool AutofillAiPrefetchFailureInfoBarDelegateIOS::Accept() {
return true;
}Do we need this? (seems like the default behaviour is the same as the default behaviour if you don't have observers)
bool AutofillAiPrefetchFailureInfoBarDelegateIOS::ShouldExpire(
const NavigationDetails& details) const {
return true;
}I think this one should be removed, or the infobar will immediately expire on ANY navigation event, including same-document navigations (like hash changes) or subframe loads. The default implementation (InfoBarDelegate::ShouldExpire) should be correct.
infobars::InfoBarDelegate::InfobarPriority
AutofillAiPrefetchFailureInfoBarDelegateIOS::GetPriority() const {
return infobars::InfoBarDelegate::InfobarPriority::kDefault;
}Isn't this the default implementation too?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
AUTOFILL_AI_PREFETCH_FAILURE_INFOBAR_DELEGATE_IOS = 136,Nit: the UI string uses "PRE_FETCH" instead of "PREFETCH", so this probably should use the same two word spelling.
I have updated this to use two word spelling. I searched `./components` and found "Prefetch" is commonly used in code. So, I am keeping the file names and class names in this CL.
bool AutofillAiPrefetchFailureInfoBarDelegateIOS::Accept() {
return true;
}Do we need this? (seems like the default behaviour is the same as the default behaviour if you don't have observers)
Removed. This is the default behavior.
bool AutofillAiPrefetchFailureInfoBarDelegateIOS::ShouldExpire(
const NavigationDetails& details) const {
return true;
}I think this one should be removed, or the infobar will immediately expire on ANY navigation event, including same-document navigations (like hash changes) or subframe loads. The default implementation (InfoBarDelegate::ShouldExpire) should be correct.
Removed.
infobars::InfoBarDelegate::InfobarPriority
AutofillAiPrefetchFailureInfoBarDelegateIOS::GetPriority() const {
return infobars::InfoBarDelegate::InfobarPriority::kDefault;
}Isn't this the default implementation too?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Hi Kaan, please take a look at the changes to `components/infobars/core/infobar_delegate.h`.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Hi Joe. Please take a look at the changes to `t/m/h/m/b/enums.xml`.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +2 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +2 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
5 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: ios/chrome/browser/autofill/ui_bundled/chrome_autofill_client_ios_unittest.mm
Insertions: 1, Deletions: 1.
@@ -265,7 +265,7 @@
infobars::InfoBar* infobar = infobar_manager->infobars()[0];
EXPECT_EQ(infobar->delegate()->GetIdentifier(),
infobars::InfoBarDelegate::
- AUTOFILL_AI_PREFETCH_FAILURE_INFOBAR_DELEGATE_IOS);
+ AUTOFILL_AI_PRE_FETCH_FAILURE_INFOBAR_DELEGATE_IOS);
// Calling it again should replace the existing one, so count remains 1.
client().ShowAutofillAiPreFetchFailureNotification();
```
```
The name of the file: ios/chrome/browser/autofill/ui_bundled/chrome_autofill_client_ios.mm
Insertions: 1, Deletions: 1.
@@ -690,7 +690,7 @@
const auto existing_infobar =
std::ranges::find(infobar_manager_->infobars(),
infobars::InfoBarDelegate::
- AUTOFILL_AI_PREFETCH_FAILURE_INFOBAR_DELEGATE_IOS,
+ AUTOFILL_AI_PRE_FETCH_FAILURE_INFOBAR_DELEGATE_IOS,
&infobars::InfoBar::GetIdentifier);
if (existing_infobar != infobar_manager_->infobars().cend()) {
```
```
The name of the file: ios/chrome/browser/autofill/model/autofill_ai_prefetch_failure_infobar_delegate_ios.mm
Insertions: 1, Deletions: 1.
@@ -41,7 +41,7 @@
infobars::InfoBarDelegate::InfoBarIdentifier
AutofillAiPrefetchFailureInfoBarDelegateIOS::GetIdentifier() const {
return infobars::InfoBarDelegate::
- AUTOFILL_AI_PREFETCH_FAILURE_INFOBAR_DELEGATE_IOS;
+ AUTOFILL_AI_PRE_FETCH_FAILURE_INFOBAR_DELEGATE_IOS;
}
ui::ImageModel AutofillAiPrefetchFailureInfoBarDelegateIOS::GetIcon() const {
```
[iOS] Add infobar message for Autofill AI prefetch failures
This CL adds infobar support for Autofill AI prefetch failures which can
happen for fetching Ambient Autofill entities.
Branded Asset:
https://screenshot.googleplex.com/AVRH5qEgap6Mn5T
None Branded Asset:
https://screenshot.googleplex.com/LZxPqe4gpgiiuak
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
InfobarType::kInfobarTypeConfirm, std::move(delegate)));I've came across the autofill AI infobar when reviewing another infobar CL, and I'm wondering why haven't you used `kInfobarTypeAutofillAiSaveEntity` here? If you are doing `kInfobarTypeConfirm` here, does all the switch statement with `kInfobarTypeAutofillAiSaveEntity` even work?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
InfobarType::kInfobarTypeConfirm, std::move(delegate)));I've came across the autofill AI infobar when reviewing another infobar CL, and I'm wondering why haven't you used `kInfobarTypeAutofillAiSaveEntity` here? If you are doing `kInfobarTypeConfirm` here, does all the switch statement with `kInfobarTypeAutofillAiSaveEntity` even work?
The `ShowAutofillAiPreFetchFailureNotification` method is showing another type of infobar message that differs from `ShowEntityImportBubble` (which uses `kInfobarTypeAutofillAiSaveEntity`).
This is showing a generic confirmation infobar message. When a user taps Got It, it disappears.
`kInfobarTypeAutofillAiSaveEntity` however, shows an infobar, and pops up a dialog when a user taps "Save", and performs a series of actions.
Yes, `kInfobarTypeAutofillAiSaveEntity` is working. There are mutilple EG tests testing its behavior. Did you notice any issues that may not be covered by EG tests?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
InfobarType::kInfobarTypeConfirm, std::move(delegate)));Leo ZhaoI've came across the autofill AI infobar when reviewing another infobar CL, and I'm wondering why haven't you used `kInfobarTypeAutofillAiSaveEntity` here? If you are doing `kInfobarTypeConfirm` here, does all the switch statement with `kInfobarTypeAutofillAiSaveEntity` even work?
The `ShowAutofillAiPreFetchFailureNotification` method is showing another type of infobar message that differs from `ShowEntityImportBubble` (which uses `kInfobarTypeAutofillAiSaveEntity`).
This is showing a generic confirmation infobar message. When a user taps Got It, it disappears.
`kInfobarTypeAutofillAiSaveEntity` however, shows an infobar, and pops up a dialog when a user taps "Save", and performs a series of actions.
Yes, `kInfobarTypeAutofillAiSaveEntity` is working. There are mutilple EG tests testing its behavior. Did you notice any issues that may not be covered by EG tests?
I didn't see `ShowEntityImportBubble`. Ok that makes sense, thanks!
One question - should the metric "Mobile.Messages.Banner.Event.InfobarTypeAutofillAiSaveEntity" fire as a result of `ShowAutofillAiPreFetchFailureNotification`? If I understand the infobar code correctly it shouldn't. If the metric is expected to fire, you might want to double check.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
InfobarType::kInfobarTypeConfirm, std::move(delegate)));Leo ZhaoI've came across the autofill AI infobar when reviewing another infobar CL, and I'm wondering why haven't you used `kInfobarTypeAutofillAiSaveEntity` here? If you are doing `kInfobarTypeConfirm` here, does all the switch statement with `kInfobarTypeAutofillAiSaveEntity` even work?
Ginny HuangThe `ShowAutofillAiPreFetchFailureNotification` method is showing another type of infobar message that differs from `ShowEntityImportBubble` (which uses `kInfobarTypeAutofillAiSaveEntity`).
This is showing a generic confirmation infobar message. When a user taps Got It, it disappears.
`kInfobarTypeAutofillAiSaveEntity` however, shows an infobar, and pops up a dialog when a user taps "Save", and performs a series of actions.
Yes, `kInfobarTypeAutofillAiSaveEntity` is working. There are mutilple EG tests testing its behavior. Did you notice any issues that may not be covered by EG tests?
I didn't see `ShowEntityImportBubble`. Ok that makes sense, thanks!
One question - should the metric "Mobile.Messages.Banner.Event.InfobarTypeAutofillAiSaveEntity" fire as a result of `ShowAutofillAiPreFetchFailureNotification`? If I understand the infobar code correctly it shouldn't. If the metric is expected to fire, you might want to double check.
(I mean as a result of `ShowAutofillAiPreFetchFailureNotification` - I am sure that `ShowEntityImportBubble` would have triggered that histogram)
InfobarType::kInfobarTypeConfirm, std::move(delegate)));Leo ZhaoI've came across the autofill AI infobar when reviewing another infobar CL, and I'm wondering why haven't you used `kInfobarTypeAutofillAiSaveEntity` here? If you are doing `kInfobarTypeConfirm` here, does all the switch statement with `kInfobarTypeAutofillAiSaveEntity` even work?
Ginny HuangThe `ShowAutofillAiPreFetchFailureNotification` method is showing another type of infobar message that differs from `ShowEntityImportBubble` (which uses `kInfobarTypeAutofillAiSaveEntity`).
This is showing a generic confirmation infobar message. When a user taps Got It, it disappears.
`kInfobarTypeAutofillAiSaveEntity` however, shows an infobar, and pops up a dialog when a user taps "Save", and performs a series of actions.
Yes, `kInfobarTypeAutofillAiSaveEntity` is working. There are mutilple EG tests testing its behavior. Did you notice any issues that may not be covered by EG tests?
Ginny HuangI didn't see `ShowEntityImportBubble`. Ok that makes sense, thanks!
One question - should the metric "Mobile.Messages.Banner.Event.InfobarTypeAutofillAiSaveEntity" fire as a result of `ShowAutofillAiPreFetchFailureNotification`? If I understand the infobar code correctly it shouldn't. If the metric is expected to fire, you might want to double check.
(I mean as a result of `ShowAutofillAiPreFetchFailureNotification` - I am sure that `ShowEntityImportBubble` would have triggered that histogram)
It is nice to know that ShowAutofillAiPreFetchFailureNotification did not trigger `Mobile.Messages.Banner.Event.InfobarTypeAutofillAiSaveEntity`. The two infobar messages serve different purposes. Prefetch notification should not trigger save entity. (Some background, `InfobarTypeAutofillAiSaveEntity` is triggered by a user submitting a form that Autofill Ai recognizes. The prefetch notification is for another project called Ambient Autofill which only happens when prefetch of a form failed).
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |