| 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_CONTAINER_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_UI_ANDROID_INFOBARS_INFOBAR_CONTAINER_ANDROID_H_ |
| 6 #define CHROME_BROWSER_UI_ANDROID_INFOBARS_INFOBAR_CONTAINER_ANDROID_H_ | 6 #define CHROME_BROWSER_UI_ANDROID_INFOBARS_INFOBAR_CONTAINER_ANDROID_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/android/jni_helper.h" | 11 #include "base/android/jni_helper.h" |
| 12 #include "base/android/scoped_java_ref.h" | 12 #include "base/android/scoped_java_ref.h" |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "chrome/browser/infobars/infobar_container.h" | 15 #include "components/infobars/core/infobar_container.h" |
| 16 | 16 |
| 17 class InfoBarAndroid; | 17 class InfoBarAndroid; |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 class WebContents; | 20 class WebContents; |
| 21 } | 21 } |
| 22 | 22 |
| 23 class InfoBarContainerAndroid : public InfoBarContainer { | 23 class InfoBarContainerAndroid : public infobars::InfoBarContainer { |
| 24 public: | 24 public: |
| 25 InfoBarContainerAndroid(JNIEnv* env, | 25 InfoBarContainerAndroid(JNIEnv* env, |
| 26 jobject infobar_container, | 26 jobject infobar_container, |
| 27 jobject auto_login_delegate); | 27 jobject auto_login_delegate); |
| 28 void Destroy(JNIEnv* env, jobject obj); | 28 void Destroy(JNIEnv* env, jobject obj); |
| 29 | 29 |
| 30 JavaObjectWeakGlobalRef auto_login_delegate() const { | 30 JavaObjectWeakGlobalRef auto_login_delegate() const { |
| 31 return weak_java_auto_login_delegate_; | 31 return weak_java_auto_login_delegate_; |
| 32 } | 32 } |
| 33 | 33 |
| 34 JavaObjectWeakGlobalRef java_container() const { | 34 JavaObjectWeakGlobalRef java_container() const { |
| 35 return weak_java_infobar_container_; | 35 return weak_java_infobar_container_; |
| 36 } | 36 } |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 virtual ~InfoBarContainerAndroid() OVERRIDE; | 39 virtual ~InfoBarContainerAndroid() OVERRIDE; |
| 40 | 40 |
| 41 // InfobarContainer: | 41 // InfobarContainer: |
| 42 virtual void PlatformSpecificAddInfoBar(InfoBar* infobar, | 42 virtual void PlatformSpecificAddInfoBar(infobars::InfoBar* infobar, |
| 43 size_t position) OVERRIDE; | 43 size_t position) OVERRIDE; |
| 44 virtual void PlatformSpecificRemoveInfoBar(InfoBar* infobar) OVERRIDE; | 44 virtual void PlatformSpecificRemoveInfoBar(infobars::InfoBar* infobar) |
| 45 virtual void PlatformSpecificReplaceInfoBar(InfoBar* old_infobar, | 45 OVERRIDE; |
| 46 InfoBar* new_infobar) OVERRIDE; | 46 virtual void PlatformSpecificReplaceInfoBar( |
| 47 infobars::InfoBar* old_infobar, |
| 48 infobars::InfoBar* new_infobar) OVERRIDE; |
| 47 | 49 |
| 48 // Create the Java equivalent of |android_bar| and add it to the java | 50 // Create the Java equivalent of |android_bar| and add it to the java |
| 49 // container. | 51 // container. |
| 50 void AttachJavaInfoBar(InfoBarAndroid* android_bar); | 52 void AttachJavaInfoBar(InfoBarAndroid* android_bar); |
| 51 | 53 |
| 52 // We're owned by the java infobar, need to use a weak ref so it can destroy | 54 // We're owned by the java infobar, need to use a weak ref so it can destroy |
| 53 // us. | 55 // us. |
| 54 JavaObjectWeakGlobalRef weak_java_infobar_container_; | 56 JavaObjectWeakGlobalRef weak_java_infobar_container_; |
| 55 JavaObjectWeakGlobalRef weak_java_auto_login_delegate_; | 57 JavaObjectWeakGlobalRef weak_java_auto_login_delegate_; |
| 56 | 58 |
| 57 DISALLOW_COPY_AND_ASSIGN(InfoBarContainerAndroid); | 59 DISALLOW_COPY_AND_ASSIGN(InfoBarContainerAndroid); |
| 58 }; | 60 }; |
| 59 | 61 |
| 60 // Registers the InfoBarContainer's native methods through JNI. | 62 // Registers the InfoBarContainer's native methods through JNI. |
| 61 bool RegisterInfoBarContainer(JNIEnv* env); | 63 bool RegisterInfoBarContainer(JNIEnv* env); |
| 62 | 64 |
| 63 #endif // CHROME_BROWSER_UI_ANDROID_INFOBARS_INFOBAR_CONTAINER_ANDROID_H_ | 65 #endif // CHROME_BROWSER_UI_ANDROID_INFOBARS_INFOBAR_CONTAINER_ANDROID_H_ |
| OLD | NEW |