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

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: Some cleanup nits. 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..5642fcd40fc91d57523ddd869b06b3ba2c9116ef
--- /dev/null
+++ b/blimp/client/android/blimp_view.h
@@ -0,0 +1,59 @@
+// 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);
+
+ BlimpView(JNIEnv* env,
+ jobject jobj,
+ const gfx::Size& physical_size,
+ const gfx::Size& display_size,
+ 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.
+
+ // 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.
+ 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
+ void SetNeedsComposite(JNIEnv* env, jobject jobj);
+ 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.
+ jobject jobj,
+ jint format,
+ jint width,
+ jint height,
+ jobject jsurface);
+ void SurfaceCreated(JNIEnv* env, jobject jobj);
+ void SurfaceDestroyed(JNIEnv* env, jobject jobj);
+ void SetVisibility(JNIEnv* env, jobject jobj, jboolean visible);
+
+ private:
+ virtual ~BlimpView();
+
+ 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.
+
+ scoped_ptr<BlimpCompositorAndroid> compositor_;
+ 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
+
+ DISALLOW_COPY_AND_ASSIGN(BlimpView);
+};
+
+} // namespace blimp
+
+#endif // BLIMP_CLIENT_ANDROID_BLIMP_VIEW_H_

Powered by Google App Engine
This is Rietveld 408576698