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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_ANDROID_INFOBARS_INFOBAR_CONTAINER_ANDROID_H_
6 #define CHROME_BROWSER_UI_ANDROID_INFOBARS_INFOBAR_CONTAINER_ANDROID_H_
11 #include "base/android/jni_helper.h"
12 #include "base/android/scoped_java_ref.h"
13 #include "base/basictypes.h"
14 #include "base/compiler_specific.h"
15 #include "chrome/browser/infobars/infobar_container.h"
23 class InfoBarContainerAndroid
: public InfoBarContainer
{
25 InfoBarContainerAndroid(JNIEnv
* env
,
26 jobject infobar_container
,
27 jobject auto_login_delegate
);
28 void Destroy(JNIEnv
* env
, jobject obj
);
30 JavaObjectWeakGlobalRef
auto_login_delegate() const {
31 return weak_java_auto_login_delegate_
;
34 JavaObjectWeakGlobalRef
java_container() const {
35 return weak_java_infobar_container_
;
39 virtual ~InfoBarContainerAndroid() OVERRIDE
;
42 virtual void PlatformSpecificAddInfoBar(InfoBar
* infobar
,
43 size_t position
) OVERRIDE
;
44 virtual void PlatformSpecificRemoveInfoBar(InfoBar
* infobar
) OVERRIDE
;
45 virtual void PlatformSpecificReplaceInfoBar(InfoBar
* old_infobar
,
46 InfoBar
* new_infobar
) OVERRIDE
;
48 // Create the Java equivalent of |android_bar| and add it to the java
50 void AttachJavaInfoBar(InfoBarAndroid
* android_bar
);
52 // We're owned by the java infobar, need to use a weak ref so it can destroy
54 JavaObjectWeakGlobalRef weak_java_infobar_container_
;
55 JavaObjectWeakGlobalRef weak_java_auto_login_delegate_
;
57 DISALLOW_COPY_AND_ASSIGN(InfoBarContainerAndroid
);
60 // Registers the InfoBarContainer's native methods through JNI.
61 bool RegisterInfoBarContainer(JNIEnv
* env
);
63 #endif // CHROME_BROWSER_UI_ANDROID_INFOBARS_INFOBAR_CONTAINER_ANDROID_H_