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 SharedDeviceDisplayInfo { | |
19 public: | |
20 SharedDeviceDisplayInfo(); | |
21 | |
22 static int GetDisplayHeight(); | |
23 static int GetDisplayWidth(); | |
24 static int GetBitsPerPixel(); | |
25 static int GetBitsPerComponent(); | |
26 static double GetDIPScale(); | |
27 | |
28 // Registers methods with JNI and returns true if succeeded. | |
29 static bool RegisterSharedDeviceDisplayInfo(JNIEnv* env); | |
30 | |
31 static void InvokeUpdate(JNIEnv*, | |
Alexei Svitkine (slow)
2013/10/11 14:13:06
Nit: don't omit parameter names
| |
32 jobject, | |
33 jint display_height, | |
34 jint display_width, | |
35 jint bits_per_pixel, | |
36 jint bits_per_component, | |
37 jdouble dip_scale); | |
38 private: | |
39 void UpdateDisplayInfo(JNIEnv*, | |
40 jobject, | |
41 jint display_height, | |
42 jint display_width, | |
43 jint bits_per_pixel, | |
44 jint bits_per_component, | |
45 jdouble dip_scale); | |
46 | |
47 base::Lock& lock() { return lock_; } | |
48 static SharedDeviceDisplayInfo* Instance(); | |
Alexei Svitkine (slow)
2013/10/11 14:13:06
Any reason this doesn't use base/memory/singleton.
| |
49 | |
50 base::Lock lock_; | |
51 base::android::ScopedJavaGlobalRef<jobject> j_device_info_; | |
52 | |
53 int display_height_; | |
54 int display_width_; | |
55 int bits_per_pixel_; | |
56 int bits_per_component_; | |
57 double dip_scale_; | |
58 | |
59 DISALLOW_COPY_AND_ASSIGN(SharedDeviceDisplayInfo); | |
60 }; | |
61 | |
62 } // namespace gfx | |
63 | |
64 #endif // UI_GFX_ANDROID_SHARED_DEVICE_DISPLAY_INFO_H_ | |
OLD | NEW |