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.
5 package org.chromium.chrome.browser.infobar;
7 import org.chromium.base.CalledByNative;
8 import org.chromium.chrome.browser.ResourceId;
11 * Provides JNI methods for SavePasswordInfoBars.
13 public class SavePasswordInfoBarDelegate {
14 private SavePasswordInfoBarDelegate() {
18 public static SavePasswordInfoBarDelegate create() {
19 return new SavePasswordInfoBarDelegate();
23 * Creates and begins the process for showing a SavePasswordInfoBarDelegate.
24 * @param nativeInfoBar Pointer to the C++ InfoBar corresponding to the Java InfoBar.
25 * @param enumeratedIconId ID corresponding to the icon that will be shown for the InfoBar.
26 * The ID must have been mapped using the ResourceMapper class before
27 * passing it to this function.
28 * @param message Message to display to the user indicating what the InfoBar is for.
29 * @param buttonOk String to display on the OK button.
30 * @param buttonCancel String to display on the Cancel button.
33 InfoBar showSavePasswordInfoBar(long nativeInfoBar, int enumeratedIconId, String message,
34 String buttonOk, String buttonCancel) {
35 int drawableId = ResourceId.mapToDrawableId(enumeratedIconId);
36 SavePasswordInfoBar infoBar = new SavePasswordInfoBar(
37 nativeInfoBar, this, drawableId, message, buttonOk, buttonCancel);
42 * Sets whether additional authentication should be required before this password can be
43 * autofilled into a form.
45 * @param nativeInfoBar The native infobar pointer.
46 * @param useAdditionalAuthencation Whether additional authentication should be required.
48 void setUseAdditionalAuthentication(long nativeInfoBar, boolean useAdditionalAuthencation) {
49 nativeSetUseAdditionalAuthentication(nativeInfoBar, useAdditionalAuthencation);
52 private native void nativeSetUseAdditionalAuthentication(
53 long nativeSavePasswordInfoBar, boolean useAdditionalAuthentication);