1 // Copyright 2013 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.
5 #ifndef UI_GFX_ANDROID_SHARED_DEVICE_DISPLAY_INFO_H_
6 #define UI_GFX_ANDROID_SHARED_DEVICE_DISPLAY_INFO_H_
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"
15 // Facilitates access to device information typically only
16 // available using the Android SDK, including Display properties.
17 class SharedDeviceDisplayInfo
{
19 static SharedDeviceDisplayInfo
* GetInstance();
21 int GetDisplayHeight();
22 int GetDisplayWidth();
23 int GetBitsPerPixel();
24 int GetBitsPerComponent();
26 int GetSmallestDIPWidth();
28 // Registers methods with JNI and returns true if succeeded.
29 static bool RegisterSharedDeviceDisplayInfo(JNIEnv
* env
);
31 void InvokeUpdate(JNIEnv
* env
,
36 jint bits_per_component
,
38 jint smallest_dip_width
);
40 friend struct DefaultSingletonTraits
<SharedDeviceDisplayInfo
>;
42 SharedDeviceDisplayInfo();
43 ~SharedDeviceDisplayInfo();
44 void UpdateDisplayInfo(JNIEnv
* env
,
49 jint bits_per_component
,
51 jint smallest_dip_width
);
54 base::android::ScopedJavaGlobalRef
<jobject
> j_device_info_
;
59 int bits_per_component_
;
61 int smallest_dip_width_
;
63 DISALLOW_COPY_AND_ASSIGN(SharedDeviceDisplayInfo
);
68 #endif // UI_GFX_ANDROID_SHARED_DEVICE_DISPLAY_INFO_H_