Commit 4529c95d authored by Anne Lim's avatar Anne Lim Committed by Commit Bot

[AF] Pass nullptr instead of empty AccountInfo in SavePasswordInfoBar

This will prevent running into the DCHECK for empty accountId in
ConvertToJavaCoreAccountId.

Bug: 1135847
Change-Id: Ibaca940288f54963bc582deee5b9eb88e2122c37
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2518159Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Commit-Queue: Anne Lim <annelim@google.com>
Cr-Commit-Position: refs/heads/master@{#824336}
parent 182194c6
......@@ -62,7 +62,7 @@ void SavePasswordInfoBarDelegate::Create(
base::WrapUnique(
new SavePasswordInfoBarDelegate(web_contents, std::move(form_to_save),
is_smartlock_branding_enabled)),
should_show_account_footer ? account_info.value() : AccountInfo()));
should_show_account_footer ? account_info : base::nullopt));
}
SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() {
......
......@@ -18,7 +18,7 @@ using base::android::JavaParamRef;
SavePasswordInfoBar::SavePasswordInfoBar(
std::unique_ptr<SavePasswordInfoBarDelegate> delegate,
AccountInfo account_info)
base::Optional<AccountInfo> account_info)
: ChromeConfirmInfoBar(std::move(delegate)) {
account_info_ = account_info;
}
......@@ -41,7 +41,9 @@ SavePasswordInfoBar::CreateRenderInfoBar(JNIEnv* env) {
ScopedJavaLocalRef<jstring> details_message_text = ConvertUTF16ToJavaString(
env, save_password_delegate->GetDetailsMessageText());
ScopedJavaLocalRef<jobject> account_info =
ConvertToJavaAccountInfo(env, account_info_);
account_info_.has_value()
? ConvertToJavaAccountInfo(env, account_info_.value())
: nullptr;
base::android::ScopedJavaLocalRef<jobject> infobar;
infobar.Reset(Java_SavePasswordInfoBar_show(
......
......@@ -19,7 +19,7 @@ class SavePasswordInfoBar : public ChromeConfirmInfoBar {
public:
explicit SavePasswordInfoBar(
std::unique_ptr<SavePasswordInfoBarDelegate> delegate,
AccountInfo account_info);
base::Optional<AccountInfo> account_info);
~SavePasswordInfoBar() override;
private:
......@@ -31,7 +31,7 @@ class SavePasswordInfoBar : public ChromeConfirmInfoBar {
base::android::ScopedJavaGlobalRef<jobject> java_infobar_;
AccountInfo account_info_;
base::Optional<AccountInfo> account_info_;
DISALLOW_COPY_AND_ASSIGN(SavePasswordInfoBar);
};
......
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