Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_GFX_ANDROID_DEVICE_DISPLAY_INFO_H_ | 5 #ifndef UI_GFX_ANDROID_DEVICE_DISPLAY_INFO_H_ |
| 6 #define UI_GFX_ANDROID_DEVICE_DISPLAY_INFO_H_ | 6 #define UI_GFX_ANDROID_DEVICE_DISPLAY_INFO_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/android/jni_android.h" | |
| 11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 12 #include "ui/gfx/gfx_export.h" | 13 #include "ui/gfx/gfx_export.h" |
| 13 | 14 |
| 14 namespace gfx { | 15 namespace gfx { |
| 15 | 16 |
| 16 // Facilitates access to device information typically only | 17 // Facilitates access to device information typically only |
| 17 // available using the Android SDK, including Display properties. | 18 // available using the Android SDK, including Display properties. |
| 18 class GFX_EXPORT DeviceDisplayInfo { | 19 class GFX_EXPORT DeviceDisplayInfo { |
| 19 public: | 20 public: |
| 20 DeviceDisplayInfo(); | 21 DeviceDisplayInfo(); |
| 22 explicit DeviceDisplayInfo(jobject windowAndroid); | |
|
boliu
2015/06/01 15:30:18
Can this be the native WindowAndroid type instead?
gsennton
2015/06/04 14:10:29
I get a presubmit error if I try to include ui/and
boliu
2015/06/05 04:57:51
Right, I have to internalize that ui/gfx is actual
| |
| 21 ~DeviceDisplayInfo(); | 23 ~DeviceDisplayInfo(); |
| 22 | 24 |
| 23 // Returns display height in physical pixels. | 25 // Returns display height in physical pixels. |
| 24 int GetDisplayHeight(); | 26 int GetDisplayHeight(); |
| 25 | 27 |
| 26 // Returns display width in physical pixels. | 28 // Returns display width in physical pixels. |
| 27 int GetDisplayWidth(); | 29 int GetDisplayWidth(); |
| 28 | 30 |
| 29 // Returns real display height in physical pixels. | 31 // Returns real display height in physical pixels. |
| 30 // This version does not subtract window decorations etc. | 32 // This version does not subtract window decorations etc. |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 49 double GetDIPScale(); | 51 double GetDIPScale(); |
| 50 | 52 |
| 51 // Smallest possible screen size in density-independent pixels. | 53 // Smallest possible screen size in density-independent pixels. |
| 52 int GetSmallestDIPWidth(); | 54 int GetSmallestDIPWidth(); |
| 53 | 55 |
| 54 // Returns the display rotation angle from its natural orientation. Expected | 56 // Returns the display rotation angle from its natural orientation. Expected |
| 55 // values are one of { 0, 90, 180, 270 }. | 57 // values are one of { 0, 90, 180, 270 }. |
| 56 // See DeviceDispayInfo.java for more information. | 58 // See DeviceDispayInfo.java for more information. |
| 57 int GetRotationDegrees(); | 59 int GetRotationDegrees(); |
| 58 | 60 |
| 61 // Registers methods with JNI and returns true if succeeded. | |
| 62 static bool RegisterDeviceDisplayInfo(JNIEnv* env); | |
| 63 | |
| 64 private: | |
| 65 void UpdateDisplayInfo(jint display_height, | |
| 66 jint display_width, | |
| 67 jint physical_display_height, | |
| 68 jint physical_display_width, | |
| 69 jint bits_per_pixel, | |
| 70 jint bits_per_component, | |
| 71 jdouble dip_scale, | |
| 72 jint smallest_dip_width, | |
| 73 jint rotation_degrees); | |
| 74 | |
| 75 base::android::ScopedJavaGlobalRef<jobject> j_device_info_; | |
| 76 | |
| 77 int display_height_; | |
| 78 int display_width_; | |
| 79 int physical_display_height_; | |
| 80 int physical_display_width_; | |
| 81 int bits_per_pixel_; | |
| 82 int bits_per_component_; | |
| 83 double dip_scale_; | |
| 84 int smallest_dip_width_; | |
| 85 int rotation_degrees_; | |
| 86 | |
| 59 private: | 87 private: |
| 60 DISALLOW_COPY_AND_ASSIGN(DeviceDisplayInfo); | 88 DISALLOW_COPY_AND_ASSIGN(DeviceDisplayInfo); |
| 61 }; | 89 }; |
| 62 | 90 |
| 63 } // namespace gfx | 91 } // namespace gfx |
| 64 | 92 |
| 65 #endif // UI_GFX_ANDROID_DEVICE_DISPLAY_INFO_H_ | 93 #endif // UI_GFX_ANDROID_DEVICE_DISPLAY_INFO_H_ |
| OLD | NEW |