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.content.Context; | 7 import android.content.Context; |
8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
9 import android.view.View; | 9 import android.view.View; |
10 import android.widget.TextView; | 10 import android.widget.TextView; |
11 | 11 |
12 import org.chromium.base.annotations.CalledByNative; | 12 import org.chromium.base.annotations.CalledByNative; |
13 import org.chromium.chrome.R; | 13 import org.chromium.chrome.R; |
| 14 import org.chromium.chrome.browser.snackbar.SnackbarManager; |
14 | 15 |
15 /** | 16 /** |
16 * The base class for all InfoBar classes. | 17 * The base class for all InfoBar classes. |
17 * Note that infobars expire by default when a new navigation occurs. | 18 * Note that infobars expire by default when a new navigation occurs. |
18 * Make sure to use setExpireOnNavigation(false) if you want an infobar to be st
icky. | 19 * Make sure to use setExpireOnNavigation(false) if you want an infobar to be st
icky. |
19 */ | 20 */ |
20 public abstract class InfoBar implements InfoBarView { | 21 public abstract class InfoBar implements InfoBarView { |
21 private static final String TAG = "InfoBar"; | 22 private static final String TAG = "InfoBar"; |
22 | 23 |
23 private final int mIconDrawableId; | 24 private final int mIconDrawableId; |
(...skipping 29 matching lines...) Expand all Loading... |
53 @CalledByNative | 54 @CalledByNative |
54 private final void setNativeInfoBar(long nativeInfoBarPtr) { | 55 private final void setNativeInfoBar(long nativeInfoBarPtr) { |
55 mNativeInfoBarPtr = nativeInfoBarPtr; | 56 mNativeInfoBarPtr = nativeInfoBarPtr; |
56 } | 57 } |
57 | 58 |
58 @CalledByNative | 59 @CalledByNative |
59 protected void onNativeDestroyed() { | 60 protected void onNativeDestroyed() { |
60 mNativeInfoBarPtr = 0; | 61 mNativeInfoBarPtr = 0; |
61 } | 62 } |
62 | 63 |
| 64 public SnackbarManager getSnackbarManager() { |
| 65 return mContainer != null ? mContainer.getSnackbarManager() : null; |
| 66 } |
| 67 |
63 /** | 68 /** |
64 * Sets the Context used when creating the InfoBar. | 69 * Sets the Context used when creating the InfoBar. |
65 */ | 70 */ |
66 protected void setContext(Context context) { | 71 protected void setContext(Context context) { |
67 mContext = context; | 72 mContext = context; |
68 } | 73 } |
69 | 74 |
70 /** | 75 /** |
71 * @return The Context used to create the InfoBar. This will be null until
the InfoBar is added | 76 * @return The Context used to create the InfoBar. This will be null until
the InfoBar is added |
72 * to the InfoBarContainer, and should never be null afterward. | 77 * to the InfoBarContainer, and should never be null afterward. |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 @Override | 211 @Override |
207 public void createContent(InfoBarLayout layout) { | 212 public void createContent(InfoBarLayout layout) { |
208 } | 213 } |
209 | 214 |
210 @InfoBarIdentifier | 215 @InfoBarIdentifier |
211 private native int nativeGetInfoBarIdentifier(long nativeInfoBarAndroid); | 216 private native int nativeGetInfoBarIdentifier(long nativeInfoBarAndroid); |
212 private native void nativeOnLinkClicked(long nativeInfoBarAndroid); | 217 private native void nativeOnLinkClicked(long nativeInfoBarAndroid); |
213 private native void nativeOnButtonClicked(long nativeInfoBarAndroid, int act
ion); | 218 private native void nativeOnButtonClicked(long nativeInfoBarAndroid, int act
ion); |
214 private native void nativeOnCloseButtonClicked(long nativeInfoBarAndroid); | 219 private native void nativeOnCloseButtonClicked(long nativeInfoBarAndroid); |
215 } | 220 } |
OLD | NEW |