Chromium Code Reviews| Index: ui/gfx/android/shared_device_display_info.cc |
| diff --git a/ui/gfx/android/shared_device_display_info.cc b/ui/gfx/android/shared_device_display_info.cc |
| index 9ac18d0218da6a024ed42031112a64a1e38b0d89..1d199b476001fb6d9494115cac7c7a3698daf495 100644 |
| --- a/ui/gfx/android/shared_device_display_info.cc |
| +++ b/ui/gfx/android/shared_device_display_info.cc |
| @@ -16,12 +16,16 @@ static void UpdateSharedDeviceDisplayInfo(JNIEnv* env, |
| jobject obj, |
| jint display_height, |
| jint display_width, |
| + jint real_display_height, |
| + jint real_display_width, |
| jint bits_per_pixel, |
| jint bits_per_component, |
| jdouble dip_scale, |
| jint smallest_dip_width) { |
| SharedDeviceDisplayInfo::GetInstance()->InvokeUpdate(env, obj, |
| - display_height, display_width, bits_per_pixel, bits_per_component, |
| + display_height, display_width, |
| + real_display_height, real_display_width, |
| + bits_per_pixel, bits_per_component, |
| dip_scale, smallest_dip_width); |
| } |
| @@ -42,6 +46,18 @@ int SharedDeviceDisplayInfo::GetDisplayWidth() { |
| return display_width_; |
| } |
| +int SharedDeviceDisplayInfo::GetRealDisplayHeight() { |
| + base::AutoLock autolock(lock_); |
| + DCHECK_NE(0, real_display_height_); |
|
no sievers
2013/12/20 19:32:45
I think if you throw an exception in Java instead,
epennerAtGoogle
2013/12/20 19:42:55
Are you thinking we should just never call the fun
no sievers
2013/12/20 19:51:19
I think you can actually do the same/similar check
|
| + return real_display_height_; |
| +} |
| + |
| +int SharedDeviceDisplayInfo::GetRealDisplayWidth() { |
| + base::AutoLock autolock(lock_); |
| + DCHECK_NE(0, real_display_width_); |
| + return real_display_width_; |
| +} |
| + |
| int SharedDeviceDisplayInfo::GetBitsPerPixel() { |
| base::AutoLock autolock(lock_); |
| DCHECK_NE(0, bits_per_pixel_); |
| @@ -75,14 +91,18 @@ void SharedDeviceDisplayInfo::InvokeUpdate(JNIEnv* env, |
| jobject obj, |
| jint display_height, |
| jint display_width, |
| + jint real_display_height, |
| + jint real_display_width, |
| jint bits_per_pixel, |
| jint bits_per_component, |
| jdouble dip_scale, |
| jint smallest_dip_width) { |
| base::AutoLock autolock(lock_); |
| - UpdateDisplayInfo(env, obj, display_height, |
| - display_width, bits_per_pixel, bits_per_component, dip_scale, |
| + UpdateDisplayInfo(env, obj, |
| + display_height, display_width, |
| + real_display_height, real_display_width, |
| + bits_per_pixel, bits_per_component, dip_scale, |
| smallest_dip_width); |
| } |
| @@ -100,6 +120,8 @@ SharedDeviceDisplayInfo::SharedDeviceDisplayInfo() |
| UpdateDisplayInfo(env, j_device_info_.obj(), |
| Java_DeviceDisplayInfo_getDisplayHeight(env, j_device_info_.obj()), |
| Java_DeviceDisplayInfo_getDisplayWidth(env, j_device_info_.obj()), |
| + Java_DeviceDisplayInfo_getRealDisplayHeight(env, j_device_info_.obj()), |
| + Java_DeviceDisplayInfo_getRealDisplayWidth(env, j_device_info_.obj()), |
| Java_DeviceDisplayInfo_getBitsPerPixel(env, j_device_info_.obj()), |
| Java_DeviceDisplayInfo_getBitsPerComponent(env, j_device_info_.obj()), |
| Java_DeviceDisplayInfo_getDIPScale(env, j_device_info_.obj()), |
| @@ -113,12 +135,16 @@ void SharedDeviceDisplayInfo::UpdateDisplayInfo(JNIEnv* env, |
| jobject jobj, |
| jint display_height, |
| jint display_width, |
| + jint real_display_height, |
| + jint real_display_width, |
| jint bits_per_pixel, |
| jint bits_per_component, |
| jdouble dip_scale, |
| jint smallest_dip_width) { |
| display_height_ = static_cast<int>(display_height); |
| display_width_ = static_cast<int>(display_width); |
| + real_display_height_ = static_cast<int>(real_display_height); |
| + real_display_width_ = static_cast<int>(real_display_width); |
| bits_per_pixel_ = static_cast<int>(bits_per_pixel); |
| bits_per_component_ = static_cast<int>(bits_per_component); |
| dip_scale_ = static_cast<double>(dip_scale); |