| 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 CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_ANDROID_H_ |
| 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_ANDROID_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/supports_user_data.h" | 13 #include "base/supports_user_data.h" |
| 14 #include "content/browser/frame_host/navigation_controller_android.h" | 14 #include "content/browser/frame_host/navigation_controller_android.h" |
| 15 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 15 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| 16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "net/http/http_response_headers.h" |
| 17 | 18 |
| 18 namespace content { | 19 namespace content { |
| 19 | 20 |
| 20 class WebContents; | 21 class WebContents; |
| 21 | 22 |
| 22 // Android wrapper around WebContents that provides safer passage from java and | 23 // Android wrapper around WebContents that provides safer passage from java and |
| 23 // back to native and provides java with a means of communicating with its | 24 // back to native and provides java with a means of communicating with its |
| 24 // native counterpart. | 25 // native counterpart. |
| 25 class CONTENT_EXPORT WebContentsAndroid | 26 class CONTENT_EXPORT WebContentsAndroid |
| 26 : public base::SupportsUserData::Data { | 27 : public base::SupportsUserData::Data { |
| 27 public: | 28 public: |
| 28 static bool Register(JNIEnv* env); | 29 static bool Register(JNIEnv* env); |
| 29 | 30 |
| 30 explicit WebContentsAndroid(WebContents* web_contents); | 31 explicit WebContentsAndroid(WebContents* web_contents); |
| 31 virtual ~WebContentsAndroid(); | 32 virtual ~WebContentsAndroid(); |
| 32 | 33 |
| 33 WebContents* web_contents() const { return web_contents_; } | 34 WebContents* web_contents() const { return web_contents_; } |
| 34 | 35 |
| 35 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); | 36 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); |
| 36 | 37 |
| 37 // Methods called from Java | 38 // Methods called from Java |
| 38 base::android::ScopedJavaLocalRef<jstring> GetTitle(JNIEnv* env, | 39 base::android::ScopedJavaLocalRef<jstring> GetTitle(JNIEnv* env, |
| 39 jobject obj) const; | 40 jobject obj) const; |
| 40 base::android::ScopedJavaLocalRef<jstring> GetVisibleURL(JNIEnv* env, | 41 base::android::ScopedJavaLocalRef<jstring> GetVisibleURL(JNIEnv* env, |
| 41 jobject obj) const; | 42 jobject obj) const; |
| 42 void Stop(JNIEnv* env, jobject obj); | 43 void Stop(JNIEnv* env, jobject obj); |
| 43 jint GetBackgroundColor(JNIEnv* env, jobject obj); | 44 jint GetBackgroundColor(JNIEnv* env, jobject obj); |
| 45 base::android::ScopedJavaLocalRef<jstring> GetURL(JNIEnv* env, jobject) const; |
| 46 jboolean IsIncognito(JNIEnv* env, jobject obj); |
| 47 void ResumeResponseDeferredAtStart(JNIEnv* env, jobject obj); |
| 48 void SetHasPendingNavigationTransitionForTesting(JNIEnv* env, jobject obj); |
| 49 |
| 50 // This method is invoked when the request is deferred immediately after |
| 51 // receiving response headers. |
| 52 void DidDeferAfterResponseStarted( |
| 53 const scoped_refptr<net::HttpResponseHeaders>& headers, |
| 54 const GURL& url); |
| 55 |
| 56 // This method is invoked when a navigation transition is detected, to |
| 57 // determine if the embedder intends to handle it. |
| 58 bool WillHandleDeferAfterResponseStarted(); |
| 59 |
| 44 void OnHide(JNIEnv* env, jobject obj); | 60 void OnHide(JNIEnv* env, jobject obj); |
| 45 void OnShow(JNIEnv* env, jobject obj); | 61 void OnShow(JNIEnv* env, jobject obj); |
| 46 void PauseVideo(); | 62 void PauseVideo(); |
| 47 void AddStyleSheetByURL( | 63 void AddStyleSheetByURL( |
| 48 JNIEnv* env, jobject obj, jstring url); | 64 JNIEnv* env, jobject obj, jstring url); |
| 49 void ShowInterstitialPage( | 65 void ShowInterstitialPage( |
| 50 JNIEnv* env, jobject obj, jstring jurl, jlong delegate_ptr); | 66 JNIEnv* env, jobject obj, jstring jurl, jlong delegate_ptr); |
| 51 jboolean IsShowingInterstitialPage(JNIEnv* env, jobject obj); | 67 jboolean IsShowingInterstitialPage(JNIEnv* env, jobject obj); |
| 52 jboolean IsRenderWidgetHostViewReady(JNIEnv* env, jobject obj); | 68 jboolean IsRenderWidgetHostViewReady(JNIEnv* env, jobject obj); |
| 53 void ExitFullscreen(JNIEnv* env, jobject obj); | 69 void ExitFullscreen(JNIEnv* env, jobject obj); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 69 WebContents* web_contents_; | 85 WebContents* web_contents_; |
| 70 NavigationControllerAndroid navigation_controller_; | 86 NavigationControllerAndroid navigation_controller_; |
| 71 base::android::ScopedJavaGlobalRef<jobject> obj_; | 87 base::android::ScopedJavaGlobalRef<jobject> obj_; |
| 72 | 88 |
| 73 DISALLOW_COPY_AND_ASSIGN(WebContentsAndroid); | 89 DISALLOW_COPY_AND_ASSIGN(WebContentsAndroid); |
| 74 }; | 90 }; |
| 75 | 91 |
| 76 } // namespace content | 92 } // namespace content |
| 77 | 93 |
| 78 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_ANDROID_H_ | 94 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_ANDROID_H_ |
| OLD | NEW |