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/jni_android.h" | 10 #include "base/android/jni_android.h" |
11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/supports_user_data.h" | 16 #include "base/supports_user_data.h" |
17 #include "content/browser/frame_host/navigation_controller_android.h" | 17 #include "content/browser/frame_host/navigation_controller_android.h" |
18 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 18 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 | 22 |
23 class SynchronousCompositorClient; | 23 class SynchronousCompositorClient; |
24 class WebContents; | 24 class WebContentsImpl; |
25 | 25 |
26 // Android wrapper around WebContents that provides safer passage from java and | 26 // Android wrapper around WebContents that provides safer passage from java and |
27 // back to native and provides java with a means of communicating with its | 27 // back to native and provides java with a means of communicating with its |
28 // native counterpart. | 28 // native counterpart. |
29 class CONTENT_EXPORT WebContentsAndroid | 29 class CONTENT_EXPORT WebContentsAndroid |
30 : public base::SupportsUserData::Data { | 30 : public base::SupportsUserData::Data { |
31 public: | 31 public: |
32 static bool Register(JNIEnv* env); | 32 static bool Register(JNIEnv* env); |
33 | 33 |
34 explicit WebContentsAndroid(WebContents* web_contents); | 34 explicit WebContentsAndroid(WebContentsImpl* web_contents); |
35 ~WebContentsAndroid() override; | 35 ~WebContentsAndroid() override; |
36 | 36 |
37 WebContents* web_contents() const { return web_contents_; } | 37 WebContentsImpl* web_contents() const { return web_contents_; } |
38 | 38 |
39 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); | 39 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); |
40 | 40 |
41 // Methods called from Java | 41 // Methods called from Java |
42 base::android::ScopedJavaLocalRef<jstring> GetTitle( | 42 base::android::ScopedJavaLocalRef<jstring> GetTitle( |
43 JNIEnv* env, | 43 JNIEnv* env, |
44 const base::android::JavaParamRef<jobject>& obj) const; | 44 const base::android::JavaParamRef<jobject>& obj) const; |
45 base::android::ScopedJavaLocalRef<jstring> GetVisibleURL( | 45 base::android::ScopedJavaLocalRef<jstring> GetVisibleURL( |
46 JNIEnv* env, | 46 JNIEnv* env, |
47 const base::android::JavaParamRef<jobject>& obj) const; | 47 const base::android::JavaParamRef<jobject>& obj) const; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 private: | 194 private: |
195 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); | 195 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); |
196 | 196 |
197 void OnFinishGetContentBitmap( | 197 void OnFinishGetContentBitmap( |
198 base::android::ScopedJavaGlobalRef<jobject>* obj, | 198 base::android::ScopedJavaGlobalRef<jobject>* obj, |
199 base::android::ScopedJavaGlobalRef<jobject>* callback, | 199 base::android::ScopedJavaGlobalRef<jobject>* callback, |
200 const SkBitmap& bitmap, | 200 const SkBitmap& bitmap, |
201 ReadbackResponse response); | 201 ReadbackResponse response); |
202 | 202 |
203 WebContents* web_contents_; | 203 WebContentsImpl* web_contents_; |
204 NavigationControllerAndroid navigation_controller_; | 204 NavigationControllerAndroid navigation_controller_; |
205 base::android::ScopedJavaGlobalRef<jobject> obj_; | 205 base::android::ScopedJavaGlobalRef<jobject> obj_; |
206 SynchronousCompositorClient* synchronous_compositor_client_; | 206 SynchronousCompositorClient* synchronous_compositor_client_; |
207 | 207 |
208 base::WeakPtrFactory<WebContentsAndroid> weak_factory_; | 208 base::WeakPtrFactory<WebContentsAndroid> weak_factory_; |
209 | 209 |
210 DISALLOW_COPY_AND_ASSIGN(WebContentsAndroid); | 210 DISALLOW_COPY_AND_ASSIGN(WebContentsAndroid); |
211 }; | 211 }; |
212 | 212 |
213 } // namespace content | 213 } // namespace content |
214 | 214 |
215 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_ANDROID_H_ | 215 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_ANDROID_H_ |
OLD | NEW |