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_weak_ref.h"
12 #include "base/android/scoped_java_ref.h"
13 #include "base/basictypes.h"
14 #include "base/compiler_specific.h"
15 #include "components/infobars/core/infobar_container.h"
23 class InfoBarContainerAndroid
: public infobars::InfoBarContainer
{
25 InfoBarContainerAndroid(JNIEnv
* env
,
26 jobject infobar_container
);
27 void SetWebContents(JNIEnv
* env
, jobject obj
, jobject web_contents
);
28 void Destroy(JNIEnv
* env
, jobject obj
);
30 JavaObjectWeakGlobalRef
java_container() const {
31 return weak_java_infobar_container_
;
35 ~InfoBarContainerAndroid() override
;
38 void PlatformSpecificAddInfoBar(infobars::InfoBar
* infobar
,
39 size_t position
) override
;
40 void PlatformSpecificRemoveInfoBar(infobars::InfoBar
* infobar
) override
;
41 void PlatformSpecificReplaceInfoBar(infobars::InfoBar
* old_infobar
,
42 infobars::InfoBar
* new_infobar
) override
;
44 // Create the Java equivalent of |android_bar| and add it to the java
46 void AttachJavaInfoBar(InfoBarAndroid
* android_bar
);
48 // We're owned by the java infobar, need to use a weak ref so it can destroy
50 JavaObjectWeakGlobalRef weak_java_infobar_container_
;
52 DISALLOW_COPY_AND_ASSIGN(InfoBarContainerAndroid
);
55 // Registers the InfoBarContainer's native methods through JNI.
56 bool RegisterInfoBarContainer(JNIEnv
* env
);
58 #endif // CHROME_BROWSER_UI_ANDROID_INFOBARS_INFOBAR_CONTAINER_ANDROID_H_