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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_ANDROID_CONTENT_READBACK_HANDLER_H_
6 #define CONTENT_BROWSER_ANDROID_CONTENT_READBACK_HANDLER_H_
10 #include "base/android/jni_weak_ref.h"
11 #include "base/callback.h"
12 #include "base/memory/weak_ptr.h"
13 #include "content/public/browser/readback_types.h"
18 class CopyOutputResult
;
23 // Native side of the ContentReadbackHandler.java, which issues content
24 // readbacks from the Java side.
25 class ContentReadbackHandler
{
27 // Registers the JNI methods for ContentViewRender.
28 static bool RegisterContentReadbackHandler(JNIEnv
* env
);
30 // Methods called from Java via JNI -----------------------------------------
31 ContentReadbackHandler(JNIEnv
* env
, jobject obj
);
32 void Destroy(JNIEnv
* env
, jobject obj
);
33 void GetContentBitmap(JNIEnv
* env
,
42 jobject content_view_core
);
43 void GetCompositorBitmap(JNIEnv
* env
,
46 jlong native_window_android
);
49 virtual ~ContentReadbackHandler();
51 void OnFinishReadback(int readback_id
,
52 const SkBitmap
& bitmap
,
53 ReadbackResponse response
);
55 base::android::ScopedJavaGlobalRef
<jobject
> java_obj_
;
56 base::WeakPtrFactory
<ContentReadbackHandler
> weak_factory_
;
58 DISALLOW_COPY_AND_ASSIGN(ContentReadbackHandler
);
61 } // namespace content
63 #endif // CONTENT_BROWSER_ANDROID_CONTENT_READBACK_HANDLER_H_