Commit 0893bae1 authored by sczs's avatar sczs Committed by Commit Bot

[ios] Uses SaveCard Messages UI if flag is enabled.

If IsSaveCardInfobarMessagesUIEnabled() is enabled then a
InfobarSaveCardCoordinator will be used to create the SaveCard InfoBarIOS
object. This will cause SaveCard to be presented using the new Messages UI.

Bug: 1014652
Change-Id: Ib3aae8939bf2a8720938dee4484adfbd8cf3c5ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1869712Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707866}
parent 76f496a7
......@@ -48,6 +48,8 @@ source_set("autofill") {
"//ios/chrome/browser/ui/collection_view/cells",
"//ios/chrome/browser/ui/colors",
"//ios/chrome/browser/ui/coordinators:chrome_coordinators",
"//ios/chrome/browser/ui/infobars:feature_flags",
"//ios/chrome/browser/ui/infobars/coordinators",
"//ios/chrome/browser/ui/util",
"//ios/chrome/browser/web_state_list:web_state_list",
"//ios/chrome/browser/webdata_services",
......
......@@ -40,6 +40,8 @@
#include "ios/chrome/browser/ui/autofill/card_name_fix_flow_view_bridge.h"
#include "ios/chrome/browser/ui/autofill/card_unmask_prompt_view_bridge.h"
#include "ios/chrome/browser/ui/autofill/save_card_infobar_controller.h"
#import "ios/chrome/browser/ui/infobars/coordinators/infobar_save_card_coordinator.h"
#import "ios/chrome/browser/ui/infobars/infobar_feature.h"
#include "ios/chrome/browser/webdata_services/web_data_service_factory.h"
#include "ios/chrome/common/channel_info.h"
#include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
......@@ -56,9 +58,16 @@ namespace {
// Creates and returns an infobar for saving credit cards.
std::unique_ptr<infobars::InfoBar> CreateSaveCardInfoBarMobile(
std::unique_ptr<autofill::AutofillSaveCardInfoBarDelegateMobile> delegate) {
SaveCardInfoBarController* controller = [[SaveCardInfoBarController alloc]
initWithInfoBarDelegate:delegate.get()];
return std::make_unique<InfoBarIOS>(controller, std::move(delegate));
if (IsSaveCardInfobarMessagesUIEnabled()) {
InfobarSaveCardCoordinator* coordinator =
[[InfobarSaveCardCoordinator alloc]
initWithInfoBarDelegate:delegate.get()];
return std::make_unique<InfoBarIOS>(coordinator, std::move(delegate));
} else {
SaveCardInfoBarController* controller = [[SaveCardInfoBarController alloc]
initWithInfoBarDelegate:delegate.get()];
return std::make_unique<InfoBarIOS>(controller, std::move(delegate));
}
}
} // 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