| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 package org.chromium.chrome.browser.infobar; | |
| 6 | |
| 7 import android.widget.CheckBox; | |
| 8 | |
| 9 import org.chromium.chrome.browser.password_manager.PasswordAuthenticationManage
r; | |
| 10 | |
| 11 /** | |
| 12 * The infobar that allows saving passwords for autofill. | |
| 13 */ | |
| 14 public class SavePasswordInfoBar extends ConfirmInfoBar { | |
| 15 | |
| 16 private final SavePasswordInfoBarDelegate mDelegate; | |
| 17 private final long mNativeInfoBar; | |
| 18 private CheckBox mUseAdditionalAuthenticationCheckbox; | |
| 19 | |
| 20 public SavePasswordInfoBar(long nativeInfoBar, SavePasswordInfoBarDelegate d
elegate, | |
| 21 int iconDrawableId, String message, String primaryButtonText, | |
| 22 String secondaryButtonText) { | |
| 23 super(nativeInfoBar, null, iconDrawableId, message, | |
| 24 null, primaryButtonText, secondaryButtonText); | |
| 25 mNativeInfoBar = nativeInfoBar; | |
| 26 mDelegate = delegate; | |
| 27 } | |
| 28 | |
| 29 @Override | |
| 30 public void createContent(InfoBarLayout layout) { | |
| 31 if (PasswordAuthenticationManager.isPasswordAuthenticationEnabled()) { | |
| 32 mUseAdditionalAuthenticationCheckbox = new CheckBox(getContext()); | |
| 33 mUseAdditionalAuthenticationCheckbox.setText( | |
| 34 PasswordAuthenticationManager.getPasswordProtectionString())
; | |
| 35 layout.setCustomContent(mUseAdditionalAuthenticationCheckbox); | |
| 36 } | |
| 37 | |
| 38 super.createContent(layout); | |
| 39 } | |
| 40 | |
| 41 @Override | |
| 42 public void onButtonClicked(boolean isPrimaryButton) { | |
| 43 if (isPrimaryButton && mUseAdditionalAuthenticationCheckbox != null | |
| 44 && mUseAdditionalAuthenticationCheckbox.isChecked()) { | |
| 45 mDelegate.setUseAdditionalAuthentication(mNativeInfoBar, true); | |
| 46 } | |
| 47 super.onButtonClicked(isPrimaryButton); | |
| 48 } | |
| 49 } | |
| OLD | NEW |