Index: blimp/client/compositor/blimp_compositor_android.h |
diff --git a/blimp/client/compositor/blimp_compositor_android.h b/blimp/client/compositor/blimp_compositor_android.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ce52244afce23de96ffa60a5245a373cf442a9c2 |
--- /dev/null |
+++ b/blimp/client/compositor/blimp_compositor_android.h |
@@ -0,0 +1,80 @@ |
+// 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_COMPOSITOR_BLIMP_COMPOSITOR_ANDROID_H_ |
+#define BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_ANDROID_H_ |
+ |
+#include "base/android/jni_android.h" |
+#include "base/macros.h" |
+#include "blimp/client/compositor/blimp_compositor.h" |
+#include "ui/gfx/geometry/size.h" |
+#include "ui/gfx/native_widget_types.h" |
+ |
+namespace base { |
+class SingleThreadTaskRunner; |
+class Thread; |
+} |
+ |
+namespace cc { |
+class LayerTreeHost; |
+} |
+ |
+namespace blimp { |
+ |
+// An Android specific version of the BlimpCompositor. This class builds a |
+// gfx::AcceleratedWidget out of an Android SurfaceView's surface. |
+class BlimpCompositorAndroid : public BlimpCompositor { |
+ public: |
+ // |physical_size| is the real display area that can contain content including |
+ // system decorations (See android.view.Display#getRealSize()). |display_size| |
+ // is the display area that may contain an application window excluding |
+ // system decorations (see android.view.Display#getSize()). |
+ // |device_scale_factor| is the scale factor that is required to move from dp |
+ // (device independent pixels) to pixels. |
+ static scoped_ptr<BlimpCompositorAndroid> Create( |
+ const gfx::Size& physical_size, |
+ const gfx::Size& display_size, |
+ float device_scale_factor); |
+ |
+ ~BlimpCompositorAndroid() override; |
+ |
+ // A strong reference to the ANativeWindow backing |jsurface| will be taken |
+ // here. It will be released when the surface is replaced via another call |
+ // to SetSurface or when this class dies. |
Wez
2015/09/03 00:49:28
nit: This comment should be of the form:
Takes a
David Trainor- moved to gerrit
2015/09/03 06:33:22
Done.
|
+ void SetSurface(JNIEnv* env, jobject jsurface); |
+ |
+ protected: |
+ // |device_size| is the best representation of the real display area (some |
+ // devices do not support it). |real_size_supported| represents whether or |
+ // not |device_size| represents the real physical size or just the content |
+ // area. |device_scale_factor| is the scale factor that is required to move |
+ // from dp (device independent pixels) to pixels. |
Wez
2015/09/03 00:49:28
nit: to device pixels.
David Trainor- moved to gerrit
2015/09/03 06:33:22
Done.
|
+ BlimpCompositorAndroid(const gfx::Size& device_size, |
+ bool real_size_supported, |
+ float device_scale_factor); |
+ |
+ // BlimpCompositor implementation |
+ gfx::AcceleratedWidget GetWindow() override; |
+ void GenerateLayerTreeSettings(cc::LayerTreeSettings* settings, |
+ const base::CommandLine& cmd) override; |
+ |
+ private: |
+ // These are used to determine tile size for the compositor's rastered tiles. |
Wez
2015/09/03 00:49:28
nit: Drop "These are"
David Trainor- moved to gerrit
2015/09/03 06:33:22
Done.
|
+ // For a device of width X height |portrait_width_| will be min(width, height) |
+ // and |landscape_width_| will be max(width, height). |
+ int portrait_width_; |
+ int landscape_width_; |
+ |
+ // Whether or not |portrait_width_| and |landscape_width_| represent the real |
+ // size of the device (includes the system decorations) or not. |
Wez
2015/09/03 00:49:28
nit: Suggest "True if the |portrait_width_| and |l
David Trainor- moved to gerrit
2015/09/03 06:33:22
Done.
|
+ bool real_size_supported_; |
+ |
+ gfx::AcceleratedWidget window_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BlimpCompositorAndroid); |
+}; |
+ |
+} // namespace blimp |
+ |
+#endif // BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_ANDROID_H_ |