| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_ANDROID_CONTENT_READBACK_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_CONTENT_READBACK_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_CONTENT_READBACK_HANDLER_H_ | 6 #define CONTENT_BROWSER_ANDROID_CONTENT_READBACK_HANDLER_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/android/jni_weak_ref.h" | 10 #include "base/android/jni_weak_ref.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 | 13 |
| 14 class SkBitmap; | 14 class SkBitmap; |
| 15 | 15 |
| 16 namespace cc { |
| 17 class CopyOutputResult; |
| 18 } |
| 19 |
| 16 namespace content { | 20 namespace content { |
| 17 | 21 |
| 18 // Native side of the ContentReadbackHandler.java, which issues content | 22 // Native side of the ContentReadbackHandler.java, which issues content |
| 19 // readbacks from the Java side. | 23 // readbacks from the Java side. |
| 20 class ContentReadbackHandler { | 24 class ContentReadbackHandler { |
| 21 public: | 25 public: |
| 22 // Registers the JNI methods for ContentViewRender. | 26 // Registers the JNI methods for ContentViewRender. |
| 23 static bool RegisterContentReadbackHandler(JNIEnv* env); | 27 static bool RegisterContentReadbackHandler(JNIEnv* env); |
| 24 | 28 |
| 25 // Methods called from Java via JNI ----------------------------------------- | 29 // Methods called from Java via JNI ----------------------------------------- |
| 26 ContentReadbackHandler(JNIEnv* env, jobject obj); | 30 ContentReadbackHandler(JNIEnv* env, jobject obj); |
| 27 void Destroy(JNIEnv* env, jobject obj); | 31 void Destroy(JNIEnv* env, jobject obj); |
| 28 void GetContentBitmap(JNIEnv* env, | 32 void GetContentBitmap(JNIEnv* env, |
| 29 jobject obj, | 33 jobject obj, |
| 30 jint readback_id, | 34 jint readback_id, |
| 31 jfloat scale, | 35 jfloat scale, |
| 32 jobject config, | 36 jobject config, |
| 33 jfloat x, | 37 jfloat x, |
| 34 jfloat y, | 38 jfloat y, |
| 35 jfloat width, | 39 jfloat width, |
| 36 jfloat height, | 40 jfloat height, |
| 37 jobject content_view_core); | 41 jobject content_view_core); |
| 42 void GetCompositorBitmap(JNIEnv* env, |
| 43 jobject obj, |
| 44 jint readback_id, |
| 45 jlong native_window_android); |
| 38 | 46 |
| 39 private: | 47 private: |
| 40 virtual ~ContentReadbackHandler(); | 48 virtual ~ContentReadbackHandler(); |
| 41 | 49 |
| 42 void OnFinishContentReadback(int readback_id, | 50 void OnFinishReadback(int readback_id, |
| 43 bool success, | 51 bool success, |
| 44 const SkBitmap& bitmap); | 52 const SkBitmap& bitmap); |
| 45 | 53 |
| 46 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | 54 base::android::ScopedJavaGlobalRef<jobject> java_obj_; |
| 47 base::WeakPtrFactory<ContentReadbackHandler> weak_factory_; | 55 base::WeakPtrFactory<ContentReadbackHandler> weak_factory_; |
| 48 | 56 |
| 49 DISALLOW_COPY_AND_ASSIGN(ContentReadbackHandler); | 57 DISALLOW_COPY_AND_ASSIGN(ContentReadbackHandler); |
| 50 }; | 58 }; |
| 51 | 59 |
| 52 } // namespace content | 60 } // namespace content |
| 53 | 61 |
| 54 #endif // CONTENT_BROWSER_ANDROID_CONTENT_READBACK_HANDLER_H_ | 62 #endif // CONTENT_BROWSER_ANDROID_CONTENT_READBACK_HANDLER_H_ |
| OLD | NEW |