[Mac] Implement Ambient Light API
[chromium-blink-merge.git] / content / browser / android / content_readback_handler.h
blob66b2c8588d4fcaea36e4fb19d9a4892bd07ac662
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"
13 #include "content/public/browser/readback_types.h"
15 class SkBitmap;
17 namespace cc {
18 class CopyOutputResult;
21 namespace content {
23 // Native side of the ContentReadbackHandler.java, which issues content
24 // readbacks from the Java side.
25 class ContentReadbackHandler {
26 public:
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,
34 jobject obj,
35 jint readback_id,
36 jfloat scale,
37 jobject config,
38 jfloat x,
39 jfloat y,
40 jfloat width,
41 jfloat height,
42 jobject content_view_core);
43 void GetCompositorBitmap(JNIEnv* env,
44 jobject obj,
45 jint readback_id,
46 jlong native_window_android);
48 private:
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_