OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 #include "ui/gfx/android/shared_device_display_info.h" | 5 #include "ui/gfx/android/shared_device_display_info.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "jni/DeviceDisplayInfo_jni.h" | 10 #include "jni/DeviceDisplayInfo_jni.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 SharedDeviceDisplayInfo::SharedDeviceDisplayInfo() | 107 SharedDeviceDisplayInfo::SharedDeviceDisplayInfo() |
108 : display_height_(0), | 108 : display_height_(0), |
109 display_width_(0), | 109 display_width_(0), |
110 bits_per_pixel_(0), | 110 bits_per_pixel_(0), |
111 bits_per_component_(0), | 111 bits_per_component_(0), |
112 dip_scale_(0), | 112 dip_scale_(0), |
113 smallest_dip_width_(0) { | 113 smallest_dip_width_(0) { |
114 JNIEnv* env = base::android::AttachCurrentThread(); | 114 JNIEnv* env = base::android::AttachCurrentThread(); |
115 j_device_info_.Reset( | 115 j_device_info_.Reset( |
116 Java_DeviceDisplayInfo_createWithListener(env, | 116 Java_DeviceDisplayInfo_create( |
117 base::android::GetApplicationContext())); | 117 env, base::android::GetApplicationContext())); |
118 UpdateDisplayInfo(env, j_device_info_.obj(), | 118 UpdateDisplayInfo(env, j_device_info_.obj(), |
119 Java_DeviceDisplayInfo_getDisplayHeight(env, j_device_info_.obj()), | 119 Java_DeviceDisplayInfo_getDisplayHeight(env, j_device_info_.obj()), |
120 Java_DeviceDisplayInfo_getDisplayWidth(env, j_device_info_.obj()), | 120 Java_DeviceDisplayInfo_getDisplayWidth(env, j_device_info_.obj()), |
121 Java_DeviceDisplayInfo_getPhysicalDisplayHeight(env, | 121 Java_DeviceDisplayInfo_getPhysicalDisplayHeight(env, |
122 j_device_info_.obj()), | 122 j_device_info_.obj()), |
123 Java_DeviceDisplayInfo_getPhysicalDisplayWidth(env, j_device_info_.obj()), | 123 Java_DeviceDisplayInfo_getPhysicalDisplayWidth(env, j_device_info_.obj()), |
124 Java_DeviceDisplayInfo_getBitsPerPixel(env, j_device_info_.obj()), | 124 Java_DeviceDisplayInfo_getBitsPerPixel(env, j_device_info_.obj()), |
125 Java_DeviceDisplayInfo_getBitsPerComponent(env, j_device_info_.obj()), | 125 Java_DeviceDisplayInfo_getBitsPerComponent(env, j_device_info_.obj()), |
126 Java_DeviceDisplayInfo_getDIPScale(env, j_device_info_.obj()), | 126 Java_DeviceDisplayInfo_getDIPScale(env, j_device_info_.obj()), |
127 Java_DeviceDisplayInfo_getSmallestDIPWidth(env, j_device_info_.obj())); | 127 Java_DeviceDisplayInfo_getSmallestDIPWidth(env, j_device_info_.obj())); |
(...skipping 16 matching lines...) Expand all Loading... |
144 display_width_ = static_cast<int>(display_width); | 144 display_width_ = static_cast<int>(display_width); |
145 physical_display_height_ = static_cast<int>(physical_display_height); | 145 physical_display_height_ = static_cast<int>(physical_display_height); |
146 physical_display_width_ = static_cast<int>(physical_display_width); | 146 physical_display_width_ = static_cast<int>(physical_display_width); |
147 bits_per_pixel_ = static_cast<int>(bits_per_pixel); | 147 bits_per_pixel_ = static_cast<int>(bits_per_pixel); |
148 bits_per_component_ = static_cast<int>(bits_per_component); | 148 bits_per_component_ = static_cast<int>(bits_per_component); |
149 dip_scale_ = static_cast<double>(dip_scale); | 149 dip_scale_ = static_cast<double>(dip_scale); |
150 smallest_dip_width_ = static_cast<int>(smallest_dip_width); | 150 smallest_dip_width_ = static_cast<int>(smallest_dip_width); |
151 } | 151 } |
152 | 152 |
153 } // namespace gfx | 153 } // namespace gfx |
OLD | NEW |