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" | |
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.
| |
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 SharedDeviceDisplayInfo* GetInstance(); | |
21 | |
22 int GetDisplayHeight(); | |
23 int GetDisplayWidth(); | |
24 int GetBitsPerPixel(); | |
25 int GetBitsPerComponent(); | |
26 double GetDIPScale(); | |
27 int GetSmallestDIPWidth(); | |
28 | |
29 // Registers methods with JNI and returns true if succeeded. | |
30 static bool RegisterSharedDeviceDisplayInfo(JNIEnv* env); | |
31 | |
32 void InvokeUpdate(JNIEnv* env, | |
33 jobject jobj, | |
34 jint display_height, | |
35 jint display_width, | |
36 jint bits_per_pixel, | |
37 jint bits_per_component, | |
38 jdouble dip_scale, | |
39 jint smallest_dip_width); | |
40 private: | |
41 friend class DefaultSingletonTraits<SharedDeviceDisplayInfo>; | |
42 | |
43 SharedDeviceDisplayInfo(); | |
44 void UpdateDisplayInfo(JNIEnv* env, | |
45 jobject jobj, | |
46 jint display_height, | |
47 jint display_width, | |
48 jint bits_per_pixel, | |
49 jint bits_per_component, | |
50 jdouble dip_scale, | |
51 jint smallest_dip_width); | |
52 | |
53 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.
| |
54 | |
55 base::Lock lock_; | |
56 base::android::ScopedJavaGlobalRef<jobject> j_device_info_; | |
57 | |
58 int display_height_; | |
59 int display_width_; | |
60 int bits_per_pixel_; | |
61 int bits_per_component_; | |
62 double dip_scale_; | |
63 int smallest_dip_width_; | |
64 | |
65 DISALLOW_COPY_AND_ASSIGN(SharedDeviceDisplayInfo); | |
66 }; | |
67 | |
68 } // namespace gfx | |
69 | |
70 #endif // UI_GFX_ANDROID_SHARED_DEVICE_DISPLAY_INFO_H_ | |
OLD | NEW |