device_display_info.h revision 8bcbed890bc3ce4d7a057a8f32cab53fa534672e
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_DEVICE_DISPLAY_INFO_H_ 6#define UI_GFX_ANDROID_DEVICE_DISPLAY_INFO_H_ 7 8#include <jni.h> 9#include <string> 10 11#include "base/android/scoped_java_ref.h" 12#include "base/basictypes.h" 13#include "ui/gfx/gfx_export.h" 14 15namespace gfx { 16 17// Facilitates access to device information typically only 18// available using the Android SDK, including Display properties. 19class GFX_EXPORT DeviceDisplayInfo { 20 public: 21 DeviceDisplayInfo(); 22 ~DeviceDisplayInfo(); 23 24 // Returns display height in physical pixels. 25 int GetDisplayHeight(); 26 27 // Returns display width in physical pixels. 28 int GetDisplayWidth(); 29 30 // Returns number of bits per pixel. 31 int GetBitsPerPixel(); 32 33 // Returns number of bits per component. 34 int GetBitsPerComponent(); 35 36 // Returns a scaling factor for Density Independent Pixel unit 37 // (1.0 is 160dpi, 0.75 is 120dpi, 2.0 is 320dpi). 38 double GetDIPScale(); 39 40 // Smallest possible screen size in density-independent pixels. 41 int GetSmallestDIPWidth(); 42 43 // Registers methods with JNI and returns true if succeeded. 44 static bool RegisterDeviceDisplayInfo(JNIEnv* env); 45 46 private: 47 base::android::ScopedJavaGlobalRef<jobject> j_device_info_; 48 49 DISALLOW_COPY_AND_ASSIGN(DeviceDisplayInfo); 50}; 51 52} // namespace gfx 53 54#endif // UI_GFX_ANDROID_DEVICE_DISPLAY_INFO_H_ 55