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/memory/singleton.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 static int GetDisplayHeight(); | |
21 static int GetDisplayWidth(); | |
22 static int GetBitsPerPixel(); | |
23 static int GetBitsPerComponent(); | |
24 static double GetDIPScale(); | |
25 | |
26 // Registers methods with JNI and returns true if succeeded. | |
27 static bool RegisterSharedDeviceDisplayInfo(JNIEnv* env); | |
28 | |
29 static void InvokeUpdate(JNIEnv* env, | |
30 jobject jobj, | |
31 jint display_height, | |
32 jint display_width, | |
33 jint bits_per_pixel, | |
34 jint bits_per_component, | |
35 jdouble dip_scale); | |
36 private: | |
37 SharedDeviceDisplayInfo(); | |
38 void UpdateDisplayInfo(JNIEnv* env, | |
39 jobject jobj, | |
40 jint display_height, | |
41 jint display_width, | |
42 jint bits_per_pixel, | |
43 jint bits_per_component, | |
44 jdouble dip_scale); | |
45 | |
46 base::Lock& lock() { return lock_; } | |
47 static SharedDeviceDisplayInfo* GetInstance(); | |
48 | |
49 base::Lock lock_; | |
50 base::android::ScopedJavaGlobalRef<jobject> j_device_info_; | |
51 | |
52 int display_height_; | |
53 int display_width_; | |
54 int bits_per_pixel_; | |
55 int bits_per_component_; | |
56 double dip_scale_; | |
57 | |
58 friend class DefaultSingletonTraits<SharedDeviceDisplayInfo>; | |
Alexei Svitkine (slow)
2013/10/15 15:13:07
This should go right after the private: line.
| |
59 friend class Singleton<SharedDeviceDisplayInfo>; | |
Alexei Svitkine (slow)
2013/10/15 15:13:07
Is this needed? I don't see other singletons using
ostap
2013/10/15 18:41:24
Yes it is needed because it Singleton refers to Ge
| |
60 DISALLOW_COPY_AND_ASSIGN(SharedDeviceDisplayInfo); | |
61 }; | |
62 | |
63 } // namespace gfx | |
64 | |
65 #endif // UI_GFX_ANDROID_SHARED_DEVICE_DISPLAY_INFO_H_ | |
OLD | NEW |