1 // Copyright 2015 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 BLIMP_CLIENT_ANDROID_BLIMP_VIEW_H_
6 #define BLIMP_CLIENT_ANDROID_BLIMP_VIEW_H_
8 #include "base/android/jni_android.h"
9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
18 class BlimpCompositorAndroid
;
20 // The native component of org.chromium.blimp.BlimpView. This builds and
21 // maintains a BlimpCompositorAndroid and handles notifying the compositor of
22 // SurfaceView surface changes (size, creation, destruction, etc.).
25 static bool RegisterJni(JNIEnv
* env
);
27 // |real_size| is the total display area including system decorations (see
28 // android.view.Display.getRealSize()). |size| is the total display
29 // area not including system decorations (see android.view.Display.getSize()).
30 // |dp_to_px| is the scale factor that is required to convert dp (device
32 BlimpView(JNIEnv
* env
,
34 const gfx::Size
& real_size
,
35 const gfx::Size
& size
,
38 // Methods called from Java via JNI.
39 void Destroy(JNIEnv
* env
, jobject jobj
);
40 void SetNeedsComposite(JNIEnv
* env
, jobject jobj
);
41 void OnSurfaceChanged(JNIEnv
* env
,
47 void OnSurfaceCreated(JNIEnv
* env
, jobject jobj
);
48 void OnSurfaceDestroyed(JNIEnv
* env
, jobject jobj
);
49 void SetVisibility(JNIEnv
* env
, jobject jobj
, jboolean visible
);
54 // Reference to the Java object which owns this class.
55 base::android::ScopedJavaGlobalRef
<jobject
> java_obj_
;
57 scoped_ptr
<BlimpCompositorAndroid
> compositor_
;
59 // The format of the current surface owned by |compositor_|. See
60 // android.graphics.PixelFormat.java.
61 int current_surface_format_
;
63 DISALLOW_COPY_AND_ASSIGN(BlimpView
);
68 #endif // BLIMP_CLIENT_ANDROID_BLIMP_VIEW_H_