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