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 // |physical_size| is the real display area that can contain content including | |
28 // system decorations (See android.view.Display#getRealSize()). | |
Wez
2015/09/03 00:49:27
nit: You mean that this is the total display area,
David Trainor- moved to gerrit
2015/09/03 06:33:21
I think Android calls it system decoration, but I
| |
29 // |display_size| is the display area that may contain an application window | |
30 // excluding system decorations (see android.view.Display#getSize()). | |
31 // |dp_to_pixel| is the scale factor that is required to move from dp | |
32 // (device independent pixels) to pixels. | |
Wez
2015/09/03 00:49:27
nit: Aren't Device Independent Pixels called DIPs?
David Trainor- moved to gerrit
2015/09/03 06:33:21
Yeah but Android changed the unit of measurement f
Wez
2015/09/03 18:26:10
According to http://developer.android.com/guide/to
| |
33 BlimpView(JNIEnv* env, | |
34 jobject jobj, | |
35 const gfx::Size& physical_size, | |
36 const gfx::Size& display_size, | |
37 float dp_to_pixel); | |
38 | |
39 // Methods called from Java via JNI | |
Wez
2015/09/03 00:49:27
nit: Missing .
David Trainor- moved to gerrit
2015/09/03 06:33:21
Done.
| |
40 void Destroy(JNIEnv* env, jobject jobj); | |
41 void SetNeedsComposite(JNIEnv* env, jobject jobj); | |
42 void OnSurfaceChanged(JNIEnv* env, | |
43 jobject jobj, | |
44 jint format, | |
45 jint width, | |
46 jint height, | |
47 jobject jsurface); | |
48 void OnSurfaceCreated(JNIEnv* env, jobject jobj); | |
49 void OnSurfaceDestroyed(JNIEnv* env, jobject jobj); | |
50 void SetVisibility(JNIEnv* env, jobject jobj, jboolean visible); | |
51 | |
52 private: | |
53 virtual ~BlimpView(); | |
54 | |
55 // A reference to the Java object which owns this class. | |
Wez
2015/09/03 00:49:27
nit: No need for "A" here.
So this reference has
David Trainor- moved to gerrit
2015/09/03 06:33:21
We are. That's on purpose though.
Wez
2015/09/03 18:26:10
OK - sounds like the ownership graph needs clarify
| |
56 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | |
57 | |
58 scoped_ptr<BlimpCompositorAndroid> compositor_; | |
59 | |
60 // The format of the current surface owned by |compositor_|. See | |
61 // android.graphics.PixelFormat.java. | |
62 int current_surface_format_; | |
63 | |
64 DISALLOW_COPY_AND_ASSIGN(BlimpView); | |
65 }; | |
66 | |
67 } // namespace blimp | |
68 | |
69 #endif // BLIMP_CLIENT_ANDROID_BLIMP_VIEW_H_ | |
OLD | NEW |