Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(550)

Unified Diff: ui/gfx/android/device_display_info.cc

Issue 11886074: Use correct favicon scale factor on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Split DeviceTelephonyInfo from DeviceDisplayInfo; added SCALE_FACTOR_150P and 300P. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/gfx/android/device_display_info.cc
diff --git a/ui/gfx/android/device_display_info.cc b/ui/gfx/android/device_display_info.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b6866a9732e7f6a0b57d140fd6f713519fba77eb
--- /dev/null
+++ b/ui/gfx/android/device_display_info.cc
@@ -0,0 +1,73 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/gfx/android/device_display_info.h"
+
+#include "base/android/jni_android.h"
+#include "base/android/jni_string.h"
+#include "base/logging.h"
+#include "jni/DeviceDisplayInfo_jni.h"
+
+using base::android::AttachCurrentThread;
+using base::android::ScopedJavaLocalRef;
+
+namespace gfx {
+
+DeviceDisplayInfo::DeviceDisplayInfo() {
+ JNIEnv* env = AttachCurrentThread();
+ j_device_info_.Reset(Java_DeviceDisplayInfo_create(env,
+ base::android::GetApplicationContext()));
+}
+
+DeviceDisplayInfo::~DeviceDisplayInfo() {
+}
+
+int DeviceDisplayInfo::GetDisplayHeight() {
+ JNIEnv* env = AttachCurrentThread();
+ jint result =
+ Java_DeviceDisplayInfo_getDisplayHeight(env, j_device_info_.obj());
+ return static_cast<int>(result);
+}
+
+int DeviceDisplayInfo::GetDisplayWidth() {
+ JNIEnv* env = AttachCurrentThread();
+ jint result =
+ Java_DeviceDisplayInfo_getDisplayWidth(env, j_device_info_.obj());
+ return static_cast<int>(result);
+}
+
+int DeviceDisplayInfo::GetBitsPerPixel() {
+ JNIEnv* env = AttachCurrentThread();
+ jint result =
+ Java_DeviceDisplayInfo_getBitsPerPixel(env, j_device_info_.obj());
+ return static_cast<int>(result);
+}
+
+int DeviceDisplayInfo::GetBitsPerComponent() {
+ JNIEnv* env = AttachCurrentThread();
+ jint result =
+ Java_DeviceDisplayInfo_getBitsPerComponent(env, j_device_info_.obj());
+ return static_cast<int>(result);
+}
+
+double DeviceDisplayInfo::GetDIPScale() {
+ JNIEnv* env = AttachCurrentThread();
+ jdouble result =
+ Java_DeviceDisplayInfo_getDIPScale(env, j_device_info_.obj());
+ return static_cast<double>(result);
+}
+
+double DeviceDisplayInfo::GetRefreshRate() {
+ JNIEnv* env = AttachCurrentThread();
+ jdouble result =
+ Java_DeviceDisplayInfo_getRefreshRate(env, j_device_info_.obj());
+ return static_cast<double>(result);
+}
+
+// static
+bool DeviceDisplayInfo::RegisterDeviceDisplayInfo(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+} // namespace gfx

Powered by Google App Engine
This is Rietveld 408576698