Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_GFX_ANDROID_SHARED_DEVICE_DISPLAY_INFO_H_ | |
| 6 #define UI_GFX_ANDROID_SHARED_DEVICE_DISPLAY_INFO_H_ | |
| 7 | |
| 8 #include "base/android/scoped_java_ref.h" | |
| 9 #include "base/basictypes.h" | |
| 10 #include "base/lazy_instance.h" | |
| 11 #include "base/synchronization/lock.h" | |
| 12 #include "ui/gfx/gfx_export.h" | |
| 13 | |
| 14 namespace gfx { | |
| 15 | |
| 16 // Facilitates access to device information typically only | |
| 17 // available using the Android SDK, including Display properties. | |
| 18 class GFX_EXPORT SharedDeviceDisplayInfo { | |
|
Yaron
2013/10/11 10:18:14
Doesn't actually need to be exported, right?
| |
| 19 public: | |
| 20 SharedDeviceDisplayInfo(); | |
| 21 static SharedDeviceDisplayInfo* Instance(); | |
|
Yaron
2013/10/11 10:18:14
No need to expose this publicly. Move g_instance i
| |
| 22 | |
| 23 static int GetDisplayHeight(); | |
| 24 static int GetDisplayWidth(); | |
| 25 static int GetBitsPerPixel(); | |
| 26 static int GetBitsPerComponent(); | |
| 27 static double GetDIPScale(); | |
| 28 | |
| 29 void UpdateDisplayInfo(JNIEnv*, jobject, jint display_height, | |
| 30 jint display_width, jint bits_per_pixel, jint bits_per_component, | |
| 31 jdouble dip_scale); | |
| 32 | |
| 33 // Registers methods with JNI and returns true if succeeded. | |
| 34 static bool RegisterSharedDeviceDisplayInfo(JNIEnv* env); | |
| 35 | |
| 36 base::Lock& lock() { return lock_; } | |
|
Yaron
2013/10/11 10:18:14
Prefer not to expose this either. Locking should b
| |
| 37 private: | |
| 38 static base::LazyInstance<SharedDeviceDisplayInfo> g_instance_; | |
| 39 | |
| 40 base::Lock lock_; | |
| 41 base::android::ScopedJavaGlobalRef<jobject> j_device_info_; | |
| 42 | |
| 43 int display_height_; | |
| 44 int display_width_; | |
| 45 int bits_per_pixel_; | |
| 46 int bits_per_component_; | |
| 47 double dip_scale_; | |
| 48 | |
| 49 DISALLOW_COPY_AND_ASSIGN(SharedDeviceDisplayInfo); | |
| 50 }; | |
| 51 | |
| 52 } // namespace gfx | |
| 53 | |
| 54 #endif // UI_GFX_ANDROID_SHARED_DEVICE_DISPLAY_INFO_H_ | |
| OLD | NEW |