OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.infobar; | 5 package org.chromium.chrome.browser.infobar; |
6 | 6 |
7 import android.graphics.Bitmap; | 7 import android.graphics.Bitmap; |
8 | 8 |
9 import org.chromium.base.CalledByNative; | 9 import org.chromium.base.CalledByNative; |
10 import org.chromium.chrome.browser.ResourceId; | 10 import org.chromium.chrome.browser.ResourceId; |
| 11 import org.chromium.ui.base.WindowAndroid; |
11 | 12 |
12 /** | 13 /** |
13 * Provides JNI methods for ConfirmInfoBars | 14 * Provides JNI methods for ConfirmInfoBars |
14 */ | 15 */ |
15 public class ConfirmInfoBarDelegate { | 16 public class ConfirmInfoBarDelegate { |
16 | 17 |
17 private ConfirmInfoBarDelegate() { | 18 private ConfirmInfoBarDelegate() { |
18 } | 19 } |
19 | 20 |
20 @CalledByNative | 21 @CalledByNative |
21 public static ConfirmInfoBarDelegate create() { | 22 public static ConfirmInfoBarDelegate create() { |
22 return new ConfirmInfoBarDelegate(); | 23 return new ConfirmInfoBarDelegate(); |
23 } | 24 } |
24 | 25 |
25 /** | 26 /** |
26 * Creates and begins the process for showing a ConfirmInfoBar. | 27 * Creates and begins the process for showing a ConfirmInfoBar. |
| 28 * @param windowAndroid The owning window for the infobar. |
27 * @param enumeratedIconId ID corresponding to the icon that will be shown f
or the InfoBar. | 29 * @param enumeratedIconId ID corresponding to the icon that will be shown f
or the InfoBar. |
28 * The ID must have been mapped using the ResourceMa
pper class before | 30 * The ID must have been mapped using the ResourceMa
pper class before |
29 * passing it to this function. | 31 * passing it to this function. |
30 * @param iconBitmap Bitmap to use if there is no equivalent Java resource f
or enumeratedIconId. | 32 * @param iconBitmap Bitmap to use if there is no equivalent Java resource f
or |
| 33 * enumeratedIconId. |
31 * @param message Message to display to the user indicating what the InfoBar
is for. | 34 * @param message Message to display to the user indicating what the InfoBar
is for. |
32 * @param linkText Link text to display in addition to the message. | 35 * @param linkText Link text to display in addition to the message. |
33 * @param buttonOk String to display on the OK button. | 36 * @param buttonOk String to display on the OK button. |
34 * @param buttonCancel String to display on the Cancel button. | 37 * @param buttonCancel String to display on the Cancel button. |
| 38 * @param contentSettings The list of ContentSettingTypes being requested by
this infobar. |
35 */ | 39 */ |
36 @CalledByNative | 40 @CalledByNative |
37 InfoBar showConfirmInfoBar(int enumeratedIconId, Bitmap iconBitmap, String m
essage, | 41 InfoBar showConfirmInfoBar(WindowAndroid windowAndroid, int enumeratedIconId
, |
38 String linkText, String buttonOk, String buttonCancel) { | 42 Bitmap iconBitmap, String message, String linkText, String buttonOk, |
| 43 String buttonCancel, int[] contentSettings) { |
39 int drawableId = ResourceId.mapToDrawableId(enumeratedIconId); | 44 int drawableId = ResourceId.mapToDrawableId(enumeratedIconId); |
40 | 45 |
41 ConfirmInfoBar infoBar = new ConfirmInfoBar( | 46 ConfirmInfoBar infoBar = new ConfirmInfoBar( |
42 null, drawableId, iconBitmap, message, linkText, buttonOk, butto
nCancel); | 47 null, drawableId, iconBitmap, message, linkText, buttonOk, butto
nCancel); |
| 48 infoBar.setContentSettings(windowAndroid, contentSettings); |
| 49 |
43 return infoBar; | 50 return infoBar; |
44 } | 51 } |
45 } | 52 } |
OLD | NEW |