Chromium Code Reviews| 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..7735864a812e8fb446acb347cca4908a7efed2dd |
| --- /dev/null |
| +++ b/ui/gfx/android/shared_device_display_info.h |
| @@ -0,0 +1,70 @@ |
| +// 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/memory/singleton.h" |
| +#include "base/synchronization/lock.h" |
| +#include "ui/gfx/gfx_export.h" |
|
Alexei Svitkine (slow)
2013/10/22 19:15:24
You're importing this but not using GFX_EXPORT.
E
ostap
2013/10/22 20:48:03
Removed.
|
| + |
| +namespace gfx { |
| + |
| +// Facilitates access to device information typically only |
| +// available using the Android SDK, including Display properties. |
| +class SharedDeviceDisplayInfo { |
| + public: |
| + static SharedDeviceDisplayInfo* GetInstance(); |
| + |
| + int GetDisplayHeight(); |
| + int GetDisplayWidth(); |
| + int GetBitsPerPixel(); |
| + int GetBitsPerComponent(); |
| + double GetDIPScale(); |
| + int GetSmallestDIPWidth(); |
| + |
| + // Registers methods with JNI and returns true if succeeded. |
| + static bool RegisterSharedDeviceDisplayInfo(JNIEnv* env); |
| + |
| + void InvokeUpdate(JNIEnv* env, |
| + jobject jobj, |
| + jint display_height, |
| + jint display_width, |
| + jint bits_per_pixel, |
| + jint bits_per_component, |
| + jdouble dip_scale, |
| + jint smallest_dip_width); |
| + private: |
| + friend class DefaultSingletonTraits<SharedDeviceDisplayInfo>; |
| + |
| + SharedDeviceDisplayInfo(); |
| + void UpdateDisplayInfo(JNIEnv* env, |
| + jobject jobj, |
| + jint display_height, |
| + jint display_width, |
| + jint bits_per_pixel, |
| + jint bits_per_component, |
| + jdouble dip_scale, |
| + jint smallest_dip_width); |
| + |
| + base::Lock& lock() { return lock_; } |
|
Alexei Svitkine (slow)
2013/10/22 19:15:24
No need for this private accessor, just use |lock_
ostap
2013/10/22 20:48:03
Done.
|
| + |
| + 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_; |
| + int smallest_dip_width_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SharedDeviceDisplayInfo); |
| +}; |
| + |
| +} // namespace gfx |
| + |
| +#endif // UI_GFX_ANDROID_SHARED_DEVICE_DISPLAY_INFO_H_ |