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

Unified Diff: ui/android/java/src/org/chromium/ui/gfx/ResourcesHelper.java

Issue 128613003: [Tracking Patch] Unified gesture detection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 6 years, 10 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/android/java/src/org/chromium/ui/gfx/ResourcesHelper.java
diff --git a/ui/android/java/src/org/chromium/ui/gfx/ResourcesHelper.java b/ui/android/java/src/org/chromium/ui/gfx/ResourcesHelper.java
new file mode 100644
index 0000000000000000000000000000000000000000..6011ecf9eb46d1c072e0245aed62340ef279b989
--- /dev/null
+++ b/ui/android/java/src/org/chromium/ui/gfx/ResourcesHelper.java
@@ -0,0 +1,37 @@
+// Copyright 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.
+
+package org.chromium.ui.gfx;
+
+import android.content.res.Resources;
+
+import org.chromium.base.CalledByNative;
+import org.chromium.base.JNINamespace;
+
+/**
+ * Helper class to access system resources.
+ */
+@JNINamespace("gfx")
+public class ResourcesHelper {
+ /**
+ * Determine the id of a system resource given a string identifier and type.
+ *
+ * @param name The resource name.
+ * @return The id of the system resoure.
+ */
+ private static int getIdentifier(String name, String defType) {
+ return Resources.getSystem().getIdentifier(name, defType, "android");
+ }
+
+ /**
+ * Determine the pixel dimension of a named system resource.
+ *
+ * @param name The dimension resource name.
+ * @return The dimension of the system resoure in pixels.
+ */
+ @CalledByNative
+ private static int getDimensionPixelSize(String name) {
+ return Resources.getSystem().getDimensionPixelSize(getIdentifier(name, "dimen"));
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698