| Index: ui/gfx/android/device_display_info.h
|
| diff --git a/ui/gfx/android/device_display_info.h b/ui/gfx/android/device_display_info.h
|
| index 74e0ada487507f05d3a5f8f8a9e6374eebf39654..1e589aab293ee77ee875f6c4ad8929c9a11200fb 100644
|
| --- a/ui/gfx/android/device_display_info.h
|
| +++ b/ui/gfx/android/device_display_info.h
|
| @@ -8,6 +8,7 @@
|
| #include <jni.h>
|
| #include <string>
|
|
|
| +#include "base/android/jni_android.h"
|
| #include "base/basictypes.h"
|
| #include "ui/gfx/gfx_export.h"
|
|
|
| @@ -18,43 +19,62 @@ namespace gfx {
|
| class GFX_EXPORT DeviceDisplayInfo {
|
| public:
|
| DeviceDisplayInfo();
|
| + explicit DeviceDisplayInfo(jobject context);
|
| ~DeviceDisplayInfo();
|
|
|
| // Returns display height in physical pixels.
|
| - int GetDisplayHeight();
|
| + int GetDisplayHeight() const;
|
|
|
| // Returns display width in physical pixels.
|
| - int GetDisplayWidth();
|
| + int GetDisplayWidth() const;
|
|
|
| // Returns real display height in physical pixels.
|
| // This version does not subtract window decorations etc.
|
| // WARNING: This is only supported on JB-MR1 (sdk >= 17). Either
|
| // check the SDK-level, or check for '0' being returned.
|
| - int GetPhysicalDisplayHeight();
|
| + int GetPhysicalDisplayHeight() const;
|
|
|
| // Returns real display width in physical pixels.
|
| // This version does not subtract window decorations etc.
|
| // WARNING: This is only supported on JB-MR1 (sdk >= 17). Either
|
| // check the SDK-level, or check for '0' being returned.
|
| - int GetPhysicalDisplayWidth();
|
| + int GetPhysicalDisplayWidth() const;
|
|
|
| // Returns number of bits per pixel.
|
| - int GetBitsPerPixel();
|
| + int GetBitsPerPixel() const;
|
|
|
| // Returns number of bits per component.
|
| - int GetBitsPerComponent();
|
| + int GetBitsPerComponent() const;
|
|
|
| // Returns a scaling factor for Density Independent Pixel unit
|
| // (1.0 is 160dpi, 0.75 is 120dpi, 2.0 is 320dpi).
|
| - double GetDIPScale();
|
| + double GetDIPScale() const;
|
|
|
| // Smallest possible screen size in density-independent pixels.
|
| - int GetSmallestDIPWidth();
|
| + int GetSmallestDIPWidth() const;
|
|
|
| // Returns the display rotation angle from its natural orientation. Expected
|
| // values are one of { 0, 90, 180, 270 }.
|
| // See DeviceDispayInfo.java for more information.
|
| - int GetRotationDegrees();
|
| + int GetRotationDegrees() const;
|
| +
|
| + // Registers methods with JNI and returns true if succeeded.
|
| + static bool RegisterDeviceDisplayInfo(JNIEnv* env);
|
| +
|
| + private:
|
| + void FetchDisplayInfoFromJava(JNIEnv* env);
|
| +
|
| + base::android::ScopedJavaGlobalRef<jobject> j_device_info_;
|
| +
|
| + int display_height_;
|
| + int display_width_;
|
| + int physical_display_height_;
|
| + int physical_display_width_;
|
| + int bits_per_pixel_;
|
| + int bits_per_component_;
|
| + double dip_scale_;
|
| + int smallest_dip_width_;
|
| + int rotation_degrees_;
|
|
|
| private:
|
| DISALLOW_COPY_AND_ASSIGN(DeviceDisplayInfo);
|
|
|