cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / blimp / client / android / blimp_view.h
blobfc488edc2ed1da2f52ae3c9e5fe5d0336afc5c2c
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"
12 namespace gfx {
13 class Size;
16 namespace blimp {
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.).
23 class BlimpView {
24 public:
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
31 // pixels) to px.
32 BlimpView(JNIEnv* env,
33 jobject jobj,
34 const gfx::Size& real_size,
35 const gfx::Size& size,
36 float dp_to_px);
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,
42 jobject jobj,
43 jint format,
44 jint width,
45 jint height,
46 jobject jsurface);
47 void OnSurfaceCreated(JNIEnv* env, jobject jobj);
48 void OnSurfaceDestroyed(JNIEnv* env, jobject jobj);
49 void SetVisibility(JNIEnv* env, jobject jobj, jboolean visible);
51 private:
52 virtual ~BlimpView();
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);
66 } // namespace blimp
68 #endif // BLIMP_CLIENT_ANDROID_BLIMP_VIEW_H_