| 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/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 16 | 17 |
| 17 namespace content { | 18 namespace content { |
| 18 | 19 |
| 19 class WebContents; | 20 class WebContents; |
| 20 | 21 |
| 21 // Android wrapper around WebContents that provides safer passage from java and | 22 // Android wrapper around WebContents that provides safer passage from java and |
| 22 // back to native and provides java with a means of communicating with its | 23 // back to native and provides java with a means of communicating with its |
| 23 // native counterpart. | 24 // native counterpart. |
| 24 class CONTENT_EXPORT WebContentsAndroid | 25 class CONTENT_EXPORT WebContentsAndroid |
| 25 : public base::SupportsUserData::Data { | 26 : public base::SupportsUserData::Data { |
| 26 public: | 27 public: |
| 27 static bool Register(JNIEnv* env); | 28 static bool Register(JNIEnv* env); |
| 28 | 29 |
| 29 explicit WebContentsAndroid(WebContents* web_contents); | 30 explicit WebContentsAndroid(WebContents* web_contents); |
| 30 virtual ~WebContentsAndroid(); | 31 virtual ~WebContentsAndroid(); |
| 31 | 32 |
| 32 WebContents* web_contents() const { return web_contents_; } | 33 WebContents* web_contents() const { return web_contents_; } |
| 33 | 34 |
| 34 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); | 35 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); |
| 35 | 36 |
| 36 // Methods called from Java | 37 // Methods called from Java |
| 37 base::android::ScopedJavaLocalRef<jstring> GetTitle(JNIEnv* env, | 38 base::android::ScopedJavaLocalRef<jstring> GetTitle(JNIEnv* env, |
| 38 jobject obj) const; | 39 jobject obj) const; |
| 39 base::android::ScopedJavaLocalRef<jstring> GetVisibleURL(JNIEnv* env, | 40 base::android::ScopedJavaLocalRef<jstring> GetVisibleURL(JNIEnv* env, |
| 40 jobject obj) const; | 41 jobject obj) const; |
| 41 void Stop(JNIEnv* env, jobject obj); | 42 void Stop(JNIEnv* env, jobject obj); |
| 43 jint GetBackgroundColor(JNIEnv* env, jobject obj); |
| 44 void OnHide(JNIEnv* env, jobject obj); |
| 45 void OnShow(JNIEnv* env, jobject obj); |
| 46 void PauseVideo(); |
| 47 void AddStyleSheetByURL( |
| 48 JNIEnv* env, jobject obj, jstring url); |
| 49 void ShowInterstitialPage( |
| 50 JNIEnv* env, jobject obj, jstring jurl, jlong delegate_ptr); |
| 51 jboolean IsShowingInterstitialPage(JNIEnv* env, jobject obj); |
| 52 jboolean IsRenderWidgetHostViewReady(JNIEnv* env, jobject obj); |
| 53 void ExitFullscreen(JNIEnv* env, jobject obj); |
| 54 void UpdateTopControlsState( |
| 55 JNIEnv* env, |
| 56 jobject obj, |
| 57 bool enable_hiding, |
| 58 bool enable_showing, |
| 59 bool animate); |
| 60 void ShowImeIfNeeded(JNIEnv* env, jobject obj); |
| 61 void ScrollFocusedEditableNodeIntoView(JNIEnv* env, jobject obj); |
| 62 void SelectWordAroundCaret(JNIEnv* env, jobject obj); |
| 42 | 63 |
| 43 void InsertCSS(JNIEnv* env, jobject jobj, jstring jcss); | 64 void InsertCSS(JNIEnv* env, jobject jobj, jstring jcss); |
| 44 | 65 |
| 45 private: | 66 private: |
| 67 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); |
| 68 |
| 46 WebContents* web_contents_; | 69 WebContents* web_contents_; |
| 47 NavigationControllerAndroid navigation_controller_; | 70 NavigationControllerAndroid navigation_controller_; |
| 48 base::android::ScopedJavaGlobalRef<jobject> obj_; | 71 base::android::ScopedJavaGlobalRef<jobject> obj_; |
| 49 | 72 |
| 50 DISALLOW_COPY_AND_ASSIGN(WebContentsAndroid); | 73 DISALLOW_COPY_AND_ASSIGN(WebContentsAndroid); |
| 51 }; | 74 }; |
| 52 | 75 |
| 53 } // namespace content | 76 } // namespace content |
| 54 | 77 |
| 55 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_ANDROID_H_ | 78 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_ANDROID_H_ |
| OLD | NEW |