| 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 #ifndef CHROME_BROWSER_UI_ANDROID_INFOBARS_INFOBAR_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_UI_ANDROID_INFOBARS_INFOBAR_ANDROID_H_ |
| 6 #define CHROME_BROWSER_UI_ANDROID_INFOBARS_INFOBAR_ANDROID_H_ | 6 #define CHROME_BROWSER_UI_ANDROID_INFOBARS_INFOBAR_ANDROID_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/android/jni_weak_ref.h" | 10 #include "base/android/jni_weak_ref.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 virtual void SetJavaInfoBar( | 48 virtual void SetJavaInfoBar( |
| 49 const base::android::JavaRef<jobject>& java_info_bar); | 49 const base::android::JavaRef<jobject>& java_info_bar); |
| 50 jobject GetJavaInfoBar(); | 50 jobject GetJavaInfoBar(); |
| 51 bool HasSetJavaInfoBar() const; | 51 bool HasSetJavaInfoBar() const; |
| 52 | 52 |
| 53 // Tells the Java-side counterpart of this InfoBar to point to the replacement | 53 // Tells the Java-side counterpart of this InfoBar to point to the replacement |
| 54 // InfoBar instead of this one. | 54 // InfoBar instead of this one. |
| 55 void ReassignJavaInfoBar(InfoBarAndroid* replacement); | 55 void ReassignJavaInfoBar(InfoBarAndroid* replacement); |
| 56 | 56 |
| 57 virtual void OnLinkClicked(JNIEnv* env, jobject obj) {} | 57 virtual void OnLinkClicked(JNIEnv* env, |
| 58 void OnButtonClicked(JNIEnv* env, jobject obj, jint action); | 58 const base::android::JavaParamRef<jobject>& obj) {} |
| 59 void OnCloseButtonClicked(JNIEnv* env, jobject obj); | 59 void OnButtonClicked(JNIEnv* env, |
| 60 const base::android::JavaParamRef<jobject>& obj, |
| 61 jint action); |
| 62 void OnCloseButtonClicked(JNIEnv* env, |
| 63 const base::android::JavaParamRef<jobject>& obj); |
| 60 | 64 |
| 61 void CloseJavaInfoBar(); | 65 void CloseJavaInfoBar(); |
| 62 | 66 |
| 63 // Maps from a Chromium ID (IDR_TRANSLATE) to a enum value that Java code can | 67 // Maps from a Chromium ID (IDR_TRANSLATE) to a enum value that Java code can |
| 64 // translate into a Drawable ID using the ResourceId class. | 68 // translate into a Drawable ID using the ResourceId class. |
| 65 int GetEnumeratedIconId(); | 69 int GetEnumeratedIconId(); |
| 66 | 70 |
| 67 // Acquire the java infobar from a different one. This is used to do in-place | 71 // Acquire the java infobar from a different one. This is used to do in-place |
| 68 // replacements. | 72 // replacements. |
| 69 virtual void PassJavaInfoBar(InfoBarAndroid* source) {} | 73 virtual void PassJavaInfoBar(InfoBarAndroid* source) {} |
| 70 | 74 |
| 71 protected: | 75 protected: |
| 72 // Derived classes must implement this method to process the corresponding | 76 // Derived classes must implement this method to process the corresponding |
| 73 // action. | 77 // action. |
| 74 virtual void ProcessButton(int action) = 0; | 78 virtual void ProcessButton(int action) = 0; |
| 75 | 79 |
| 76 void CloseInfoBar(); | 80 void CloseInfoBar(); |
| 77 InfoBarAndroid* infobar_android() { return this; } | 81 InfoBarAndroid* infobar_android() { return this; } |
| 78 | 82 |
| 79 private: | 83 private: |
| 80 base::android::ScopedJavaGlobalRef<jobject> java_info_bar_; | 84 base::android::ScopedJavaGlobalRef<jobject> java_info_bar_; |
| 81 | 85 |
| 82 DISALLOW_COPY_AND_ASSIGN(InfoBarAndroid); | 86 DISALLOW_COPY_AND_ASSIGN(InfoBarAndroid); |
| 83 }; | 87 }; |
| 84 | 88 |
| 85 // Registers the NativeInfoBar's native methods through JNI. | 89 // Registers the NativeInfoBar's native methods through JNI. |
| 86 bool RegisterNativeInfoBar(JNIEnv* env); | 90 bool RegisterNativeInfoBar(JNIEnv* env); |
| 87 | 91 |
| 88 #endif // CHROME_BROWSER_UI_ANDROID_INFOBARS_INFOBAR_ANDROID_H_ | 92 #endif // CHROME_BROWSER_UI_ANDROID_INFOBARS_INFOBAR_ANDROID_H_ |
| OLD | NEW |