Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / android / infobars / infobar_container_android.h
blob2e22da99952de6275cc0d0a9fd3985660389e382
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_
8 #include <map>
9 #include <string>
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"
17 class InfoBarAndroid;
19 namespace content {
20 class WebContents;
23 class InfoBarContainerAndroid : public infobars::InfoBarContainer {
24 public:
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_;
34 private:
35 ~InfoBarContainerAndroid() override;
37 // InfobarContainer:
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
45 // container.
46 void AttachJavaInfoBar(InfoBarAndroid* android_bar);
48 // We're owned by the java infobar, need to use a weak ref so it can destroy
49 // us.
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_