Chromium Code Reviews| 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 |
| 18 using base::android::ScopedJavaLocalRef; | |
|
Yaron
2014/07/15 21:23:48
Don't add this to header
AKVT
2014/07/16 09:53:47
Done.
| |
| 19 | |
| 17 namespace content { | 20 namespace content { |
| 18 | 21 |
| 19 class WebContents; | 22 class WebContents; |
| 20 | 23 |
| 21 // Android wrapper around WebContents that provides safer passage from java and | 24 // 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 | 25 // back to native and provides java with a means of communicating with its |
| 23 // native counterpart. | 26 // native counterpart. |
| 24 class CONTENT_EXPORT WebContentsAndroid | 27 class CONTENT_EXPORT WebContentsAndroid |
| 25 : public base::SupportsUserData::Data { | 28 : public base::SupportsUserData::Data { |
| 26 public: | 29 public: |
| 27 static bool Register(JNIEnv* env); | 30 static bool Register(JNIEnv* env); |
| 28 | 31 |
| 29 explicit WebContentsAndroid(WebContents* web_contents); | 32 explicit WebContentsAndroid(WebContents* web_contents); |
| 30 virtual ~WebContentsAndroid(); | 33 virtual ~WebContentsAndroid(); |
| 31 | 34 |
| 32 WebContents* web_contents() const { return web_contents_; } | 35 WebContents* web_contents() const { return web_contents_; } |
| 33 | 36 |
| 34 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); | 37 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); |
| 35 | 38 |
| 36 // Methods called from Java | 39 // Methods called from Java |
| 37 base::android::ScopedJavaLocalRef<jstring> GetTitle(JNIEnv* env, | 40 base::android::ScopedJavaLocalRef<jstring> GetTitle(JNIEnv* env, |
| 38 jobject obj) const; | 41 jobject obj) const; |
| 39 base::android::ScopedJavaLocalRef<jstring> GetVisibleURL(JNIEnv* env, | 42 base::android::ScopedJavaLocalRef<jstring> GetVisibleURL(JNIEnv* env, |
| 40 jobject obj) const; | 43 jobject obj) const; |
| 41 void Stop(JNIEnv* env, jobject obj); | 44 void Stop(JNIEnv* env, jobject obj); |
| 45 float dpi_scale() const { return dpi_scale_; } | |
|
Yaron
2014/07/15 21:23:48
Why did this move and why is it still duplicated i
AKVT
2014/07/16 09:53:47
I will take care this one during next patch.
| |
| 46 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); | |
| 47 jint GetBackgroundColor(JNIEnv* env, jobject obj); | |
| 48 void OnHide(JNIEnv* env, jobject obj); | |
| 49 void OnShow(JNIEnv* env, jobject obj); | |
| 50 void PauseVideo(); | |
| 51 void AddStyleSheetByURL( | |
| 52 JNIEnv* env, jobject obj, jstring url); | |
| 53 void ShowInterstitialPage( | |
| 54 JNIEnv* env, jobject obj, jstring jurl, jlong delegate_ptr); | |
| 55 jboolean IsShowingInterstitialPage(JNIEnv* env, jobject obj); | |
| 56 jboolean IsRenderWidgetHostViewReady(JNIEnv* env, jobject obj); | |
| 57 void ExitFullscreen(JNIEnv* env, jobject obj); | |
| 58 void UpdateTopControlsState( | |
| 59 JNIEnv* env, | |
| 60 jobject obj, | |
| 61 bool enable_hiding, | |
| 62 bool enable_showing, | |
| 63 bool animate); | |
| 64 void ShowImeIfNeeded(JNIEnv* env, jobject obj); | |
| 65 void ScrollFocusedEditableNodeIntoView(JNIEnv* env, jobject obj); | |
| 66 void SelectWordAroundCaret(JNIEnv* env, jobject obj); | |
| 67 ScopedJavaLocalRef<jstring> GetOriginalUrlForActiveNavigationEntry( | |
|
Yaron
2014/07/15 21:23:48
base::android::ScopedJavaLocalRef
AKVT
2014/07/16 09:53:47
Done.
| |
| 68 JNIEnv* env, | |
| 69 jobject obj); | |
| 70 long GetNativeImeAdapter(JNIEnv* env, jobject obj); | |
| 71 bool GetUseDesktopUserAgent(JNIEnv* env, jobject obj); | |
| 72 void ClearSslPreferences(JNIEnv* env, jobject obj); | |
| 73 void SetUseDesktopUserAgent( | |
| 74 JNIEnv* env, | |
| 75 jobject obj, | |
| 76 jboolean enabled, | |
| 77 jboolean reload_on_state_change); | |
| 78 void ExtractSmartClipData( | |
| 79 JNIEnv* env, | |
| 80 jobject obj, | |
| 81 jint x, | |
| 82 jint y, | |
| 83 jint width, | |
| 84 jint height); | |
| 42 | 85 |
| 43 void InsertCSS(JNIEnv* env, jobject jobj, jstring jcss); | 86 void InsertCSS(JNIEnv* env, jobject jobj, jstring jcss); |
| 44 | 87 |
| 45 private: | 88 private: |
| 46 WebContents* web_contents_; | 89 WebContents* web_contents_; |
| 47 NavigationControllerAndroid navigation_controller_; | 90 NavigationControllerAndroid navigation_controller_; |
| 91 // Device scale factor. | |
| 92 float dpi_scale_; | |
| 48 base::android::ScopedJavaGlobalRef<jobject> obj_; | 93 base::android::ScopedJavaGlobalRef<jobject> obj_; |
| 49 | 94 |
| 50 DISALLOW_COPY_AND_ASSIGN(WebContentsAndroid); | 95 DISALLOW_COPY_AND_ASSIGN(WebContentsAndroid); |
| 51 }; | 96 }; |
| 52 | 97 |
| 53 } // namespace content | 98 } // namespace content |
| 54 | 99 |
| 55 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_ANDROID_H_ | 100 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_ANDROID_H_ |
| OLD | NEW |