| 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"));
|
| + }
|
| +}
|
|
|