| 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 <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/android/jni_android.h" | 12 #include "base/android/jni_android.h" |
| 13 #include "base/android/scoped_java_ref.h" | 13 #include "base/android/scoped_java_ref.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/supports_user_data.h" | 17 #include "base/supports_user_data.h" |
| 18 #include "content/browser/frame_host/navigation_controller_android.h" | 18 #include "content/browser/frame_host/navigation_controller_android.h" |
| 19 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 19 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| 20 #include "content/common/content_export.h" | 20 #include "content/common/content_export.h" |
| 21 | 21 |
| 22 namespace content { | 22 namespace content { |
| 23 | 23 |
| 24 class DownloadDelegate; |
| 24 class SynchronousCompositorClient; | 25 class SynchronousCompositorClient; |
| 25 class WebContentsImpl; | 26 class WebContentsImpl; |
| 26 | 27 |
| 27 // Android wrapper around WebContents that provides safer passage from java and | 28 // Android wrapper around WebContents that provides safer passage from java and |
| 28 // back to native and provides java with a means of communicating with its | 29 // back to native and provides java with a means of communicating with its |
| 29 // native counterpart. | 30 // native counterpart. |
| 30 class CONTENT_EXPORT WebContentsAndroid | 31 class CONTENT_EXPORT WebContentsAndroid |
| 31 : public base::SupportsUserData::Data { | 32 : public base::SupportsUserData::Data { |
| 32 public: | 33 public: |
| 33 static bool Register(JNIEnv* env); | 34 static bool Register(JNIEnv* env); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 void ReloadLoFiImages(JNIEnv* env, | 184 void ReloadLoFiImages(JNIEnv* env, |
| 184 const base::android::JavaParamRef<jobject>& obj); | 185 const base::android::JavaParamRef<jobject>& obj); |
| 185 | 186 |
| 186 void set_synchronous_compositor_client(SynchronousCompositorClient* client) { | 187 void set_synchronous_compositor_client(SynchronousCompositorClient* client) { |
| 187 synchronous_compositor_client_ = client; | 188 synchronous_compositor_client_ = client; |
| 188 } | 189 } |
| 189 SynchronousCompositorClient* synchronous_compositor_client() const { | 190 SynchronousCompositorClient* synchronous_compositor_client() const { |
| 190 return synchronous_compositor_client_; | 191 return synchronous_compositor_client_; |
| 191 } | 192 } |
| 192 | 193 |
| 194 void SetDownloadDelegate(DownloadDelegate* delegate); |
| 195 |
| 196 DownloadDelegate* GetDownloadDelegate(); |
| 197 |
| 193 private: | 198 private: |
| 194 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); | 199 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); |
| 195 | 200 |
| 196 void OnFinishGetContentBitmap( | 201 void OnFinishGetContentBitmap( |
| 197 base::android::ScopedJavaGlobalRef<jobject>* obj, | 202 base::android::ScopedJavaGlobalRef<jobject>* obj, |
| 198 base::android::ScopedJavaGlobalRef<jobject>* callback, | 203 base::android::ScopedJavaGlobalRef<jobject>* callback, |
| 199 const SkBitmap& bitmap, | 204 const SkBitmap& bitmap, |
| 200 ReadbackResponse response); | 205 ReadbackResponse response); |
| 201 | 206 |
| 202 WebContentsImpl* web_contents_; | 207 WebContentsImpl* web_contents_; |
| 203 NavigationControllerAndroid navigation_controller_; | 208 NavigationControllerAndroid navigation_controller_; |
| 204 base::android::ScopedJavaGlobalRef<jobject> obj_; | 209 base::android::ScopedJavaGlobalRef<jobject> obj_; |
| 205 SynchronousCompositorClient* synchronous_compositor_client_; | 210 SynchronousCompositorClient* synchronous_compositor_client_; |
| 211 DownloadDelegate* download_delegate_; |
| 206 | 212 |
| 207 base::WeakPtrFactory<WebContentsAndroid> weak_factory_; | 213 base::WeakPtrFactory<WebContentsAndroid> weak_factory_; |
| 208 | 214 |
| 209 DISALLOW_COPY_AND_ASSIGN(WebContentsAndroid); | 215 DISALLOW_COPY_AND_ASSIGN(WebContentsAndroid); |
| 210 }; | 216 }; |
| 211 | 217 |
| 212 } // namespace content | 218 } // namespace content |
| 213 | 219 |
| 214 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_ANDROID_H_ | 220 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_ANDROID_H_ |
| OLD | NEW |