OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #ifndef BLIMP_CLIENT_ANDROID_BLIMP_VIEW_H_ | |
6 #define BLIMP_CLIENT_ANDROID_BLIMP_VIEW_H_ | |
7 | |
8 #include "base/android/jni_android.h" | |
9 #include "base/macros.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 | |
12 namespace gfx { | |
13 class Size; | |
14 } | |
15 | |
16 namespace blimp { | |
17 | |
18 class BlimpCompositorAndroid; | |
19 | |
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); | |
26 | |
27 BlimpView(JNIEnv* env, | |
28 jobject jobj, | |
29 const gfx::Size& physical_size, | |
30 const gfx::Size& display_size, | |
31 float dp_to_pixel); | |
Wez
2015/08/27 02:01:50
nit: Document parameters.
David Trainor- moved to gerrit
2015/08/28 01:23:45
Done.
| |
32 | |
33 // JNI Methods | |
Wez
2015/08/27 02:01:51
nit: Suggest "Handlers for calls from Java." or si
David Trainor- moved to gerrit
2015/08/28 01:23:45
Updated to "Methods called from Java via JNI"
Gen
Wez
2015/09/03 00:49:26
Acknowledged.
| |
34 void Destroy(JNIEnv* env, jobject jobj); | |
Wez
2015/08/27 02:01:50
nit: OnDestroy?
David Trainor- moved to gerrit
2015/08/28 01:23:45
I don't know if I agree. This actually destroys t
Wez
2015/09/03 00:49:26
SGTM
| |
35 void SetNeedsComposite(JNIEnv* env, jobject jobj); | |
36 void SurfaceChanged(JNIEnv* env, | |
Wez
2015/08/27 02:01:51
nit: OnSurfaceChanged, and similarly below?
David Trainor- moved to gerrit
2015/08/28 01:23:45
Done.
| |
37 jobject jobj, | |
38 jint format, | |
39 jint width, | |
40 jint height, | |
41 jobject jsurface); | |
42 void SurfaceCreated(JNIEnv* env, jobject jobj); | |
43 void SurfaceDestroyed(JNIEnv* env, jobject jobj); | |
44 void SetVisibility(JNIEnv* env, jobject jobj, jboolean visible); | |
45 | |
46 private: | |
47 virtual ~BlimpView(); | |
48 | |
49 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | |
Wez
2015/08/27 02:01:50
nit: Document this and |current_surface_format_|
David Trainor- moved to gerrit
2015/08/28 01:23:45
Done. You'll see java_obj_ everywhere there's a n
Wez
2015/09/03 00:49:26
Acknowledged.
| |
50 | |
51 scoped_ptr<BlimpCompositorAndroid> compositor_; | |
52 int current_surface_format_; | |
Wez
2015/08/27 02:01:50
nit: You can initialize this in-line.
David Trainor- moved to gerrit
2015/08/28 01:23:45
Oh I forgot about that! Is it required? IIRC the
Wez
2015/09/03 00:49:26
No, it's not required; it's mainly helpful if you
David Trainor- moved to gerrit
2015/09/03 06:33:21
Good point. I'll move towards this in the future
| |
53 | |
54 DISALLOW_COPY_AND_ASSIGN(BlimpView); | |
55 }; | |
56 | |
57 } // namespace blimp | |
58 | |
59 #endif // BLIMP_CLIENT_ANDROID_BLIMP_VIEW_H_ | |
OLD | NEW |