Index: ui/gfx/android/shared_device_display_info.h |
diff --git a/ui/gfx/android/shared_device_display_info.h b/ui/gfx/android/shared_device_display_info.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5434d2d09083520efebb58f60e45c4ff62783347 |
--- /dev/null |
+++ b/ui/gfx/android/shared_device_display_info.h |
@@ -0,0 +1,54 @@ |
+// Copyright (c) 2012 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 UI_GFX_ANDROID_SHARED_DEVICE_DISPLAY_INFO_H_ |
+#define UI_GFX_ANDROID_SHARED_DEVICE_DISPLAY_INFO_H_ |
+ |
+#include "base/android/scoped_java_ref.h" |
+#include "base/basictypes.h" |
+#include "base/lazy_instance.h" |
+#include "base/synchronization/lock.h" |
+#include "ui/gfx/gfx_export.h" |
+ |
+namespace gfx { |
+ |
+// Facilitates access to device information typically only |
+// available using the Android SDK, including Display properties. |
+class GFX_EXPORT SharedDeviceDisplayInfo { |
Yaron
2013/10/11 10:18:14
Doesn't actually need to be exported, right?
|
+ public: |
+ SharedDeviceDisplayInfo(); |
+ static SharedDeviceDisplayInfo* Instance(); |
Yaron
2013/10/11 10:18:14
No need to expose this publicly. Move g_instance i
|
+ |
+ static int GetDisplayHeight(); |
+ static int GetDisplayWidth(); |
+ static int GetBitsPerPixel(); |
+ static int GetBitsPerComponent(); |
+ static double GetDIPScale(); |
+ |
+ void UpdateDisplayInfo(JNIEnv*, jobject, jint display_height, |
+ jint display_width, jint bits_per_pixel, jint bits_per_component, |
+ jdouble dip_scale); |
+ |
+ // Registers methods with JNI and returns true if succeeded. |
+ static bool RegisterSharedDeviceDisplayInfo(JNIEnv* env); |
+ |
+ base::Lock& lock() { return lock_; } |
Yaron
2013/10/11 10:18:14
Prefer not to expose this either. Locking should b
|
+ private: |
+ static base::LazyInstance<SharedDeviceDisplayInfo> g_instance_; |
+ |
+ base::Lock lock_; |
+ base::android::ScopedJavaGlobalRef<jobject> j_device_info_; |
+ |
+ int display_height_; |
+ int display_width_; |
+ int bits_per_pixel_; |
+ int bits_per_component_; |
+ double dip_scale_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(SharedDeviceDisplayInfo); |
+}; |
+ |
+} // namespace gfx |
+ |
+#endif // UI_GFX_ANDROID_SHARED_DEVICE_DISPLAY_INFO_H_ |