OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_ANDROID_INFOBAR_INFOBAR_CONTAINER_ANDROID_H_ |
| 6 #define CHROME_BROWSER_UI_ANDROID_INFOBAR_INFOBAR_CONTAINER_ANDROID_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <string> |
| 10 |
| 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" |
| 16 |
| 17 class InfoBarAndroid; |
| 18 class InfoBarDelegate; |
| 19 class InfoBarService; |
| 20 |
| 21 namespace content { |
| 22 class WebContents; |
| 23 } |
| 24 |
| 25 class InfoBarContainerAndroid : public InfoBarContainer { |
| 26 public: |
| 27 InfoBarContainerAndroid(JNIEnv* env, |
| 28 jobject infobar_container, |
| 29 jobject auto_login_delegate); |
| 30 void Destroy(JNIEnv* env, jobject obj); |
| 31 |
| 32 JavaObjectWeakGlobalRef auto_login_delegate() const { |
| 33 return weak_java_auto_login_delegate_; |
| 34 } |
| 35 |
| 36 JavaObjectWeakGlobalRef java_container() const { |
| 37 return weak_java_infobar_container_; |
| 38 } |
| 39 |
| 40 // The prerender is swapping the web contents. |
| 41 void OnWebContentsReplaced(content::WebContents* old_web_contents, |
| 42 content::WebContents* new_web_contents); |
| 43 |
| 44 private: |
| 45 virtual ~InfoBarContainerAndroid() OVERRIDE; |
| 46 |
| 47 // InfobarContainer |
| 48 virtual void PlatformSpecificAddInfoBar(InfoBar* infobar, size_t position) |
| 49 OVERRIDE; |
| 50 virtual void PlatformSpecificRemoveInfoBar(InfoBar* infobar) OVERRIDE; |
| 51 virtual void PlatformSpecificReplaceInfoBar(InfoBar* old_infobar, |
| 52 InfoBar* new_infobar) OVERRIDE; |
| 53 |
| 54 // Create the Java equivalent of |android_bar| and add it to the java |
| 55 // container |
| 56 void AttachJavaInfoBar(InfoBarAndroid* android_bar); |
| 57 |
| 58 // We're owned by the java infobar, need to use a weak ref so it can destroy |
| 59 // us. |
| 60 JavaObjectWeakGlobalRef weak_java_infobar_container_; |
| 61 JavaObjectWeakGlobalRef weak_java_auto_login_delegate_; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(InfoBarContainerAndroid); |
| 64 }; |
| 65 |
| 66 // Register the InfoBarContainer's native methods through jni |
| 67 bool RegisterInfoBarContainer(JNIEnv* env); |
| 68 |
| 69 #endif // CHROME_BROWSER_UI_ANDROID_INFOBAR_INFOBAR_CONTAINER_ANDROID_H_ |
OLD | NEW |