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