Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / browser / android / content_readback_handler.h
blob403bdd0a7af20e7661f2aa13224a9c66d3607343
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_
8 #include <jni.h>
10 #include "base/android/jni_weak_ref.h"
11 #include "base/callback.h"
12 #include "base/memory/weak_ptr.h"
14 class SkBitmap;
16 namespace cc {
17 class CopyOutputResult;
20 namespace content {
22 // Native side of the ContentReadbackHandler.java, which issues content
23 // readbacks from the Java side.
24 class ContentReadbackHandler {
25 public:
26 // Registers the JNI methods for ContentViewRender.
27 static bool RegisterContentReadbackHandler(JNIEnv* env);
29 // Methods called from Java via JNI -----------------------------------------
30 ContentReadbackHandler(JNIEnv* env, jobject obj);
31 void Destroy(JNIEnv* env, jobject obj);
32 void GetContentBitmap(JNIEnv* env,
33 jobject obj,
34 jint readback_id,
35 jfloat scale,
36 jobject config,
37 jfloat x,
38 jfloat y,
39 jfloat width,
40 jfloat height,
41 jobject content_view_core);
42 void GetCompositorBitmap(JNIEnv* env,
43 jobject obj,
44 jint readback_id,
45 jlong native_window_android);
47 private:
48 virtual ~ContentReadbackHandler();
50 void OnFinishReadback(int readback_id,
51 bool success,
52 const SkBitmap& bitmap);
54 base::android::ScopedJavaGlobalRef<jobject> java_obj_;
55 base::WeakPtrFactory<ContentReadbackHandler> weak_factory_;
57 DISALLOW_COPY_AND_ASSIGN(ContentReadbackHandler);
60 } // namespace content
62 #endif // CONTENT_BROWSER_ANDROID_CONTENT_READBACK_HANDLER_H_