Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(573)

Unified Diff: blimp/client/android/blimp_view.h

Issue 1295243003: Initial commit of the blimp/ folder and target (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: blimp/client/android/blimp_view.h
diff --git a/blimp/client/android/blimp_view.h b/blimp/client/android/blimp_view.h
new file mode 100644
index 0000000000000000000000000000000000000000..0b77d565d343f743b00077a11bd03a24fa603df1
--- /dev/null
+++ b/blimp/client/android/blimp_view.h
@@ -0,0 +1,69 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BLIMP_CLIENT_ANDROID_BLIMP_VIEW_H_
+#define BLIMP_CLIENT_ANDROID_BLIMP_VIEW_H_
+
+#include "base/android/jni_android.h"
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+
+namespace gfx {
+class Size;
+}
+
+namespace blimp {
+
+class BlimpCompositorAndroid;
+
+// The native component of org.chromium.blimp.BlimpView. This builds and
+// maintains a BlimpCompositorAndroid and handles notifying the compositor of
+// SurfaceView surface changes (size, creation, destruction, etc.).
+class BlimpView {
+ public:
+ static bool RegisterJni(JNIEnv* env);
+
+ // |physical_size| is the real display area that can contain content including
+ // 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
+ // |display_size| is the display area that may contain an application window
+ // excluding system decorations (see android.view.Display#getSize()).
+ // |dp_to_pixel| is the scale factor that is required to move from dp
+ // (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
+ BlimpView(JNIEnv* env,
+ jobject jobj,
+ const gfx::Size& physical_size,
+ const gfx::Size& display_size,
+ float dp_to_pixel);
+
+ // 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.
+ void Destroy(JNIEnv* env, jobject jobj);
+ void SetNeedsComposite(JNIEnv* env, jobject jobj);
+ void OnSurfaceChanged(JNIEnv* env,
+ jobject jobj,
+ jint format,
+ jint width,
+ jint height,
+ jobject jsurface);
+ void OnSurfaceCreated(JNIEnv* env, jobject jobj);
+ void OnSurfaceDestroyed(JNIEnv* env, jobject jobj);
+ void SetVisibility(JNIEnv* env, jobject jobj, jboolean visible);
+
+ private:
+ virtual ~BlimpView();
+
+ // 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
+ base::android::ScopedJavaGlobalRef<jobject> java_obj_;
+
+ scoped_ptr<BlimpCompositorAndroid> compositor_;
+
+ // The format of the current surface owned by |compositor_|. See
+ // android.graphics.PixelFormat.java.
+ int current_surface_format_;
+
+ DISALLOW_COPY_AND_ASSIGN(BlimpView);
+};
+
+} // namespace blimp
+
+#endif // BLIMP_CLIENT_ANDROID_BLIMP_VIEW_H_

Powered by Google App Engine
This is Rietveld 408576698