import java.util.NoSuchElementException;
import java.util.Scanner;
+/**
+ * A class that defines a set of resource IDs and functionality to resolve
+ * those IDs to concrete resources.
+ */
@JNINamespace("android_webview::AwResource")
public class AwResource {
// The following resource ID's must be initialized by the embedder.
// Raw resource ID for an HTML page to be displayed in the case of
// a specific load error.
- public static int RAW_LOAD_ERROR;
+ private static int RAW_LOAD_ERROR;
// Raw resource ID for an HTML page to be displayed in the case of
// a generic load error. (It's called NO_DOMAIN for legacy reasons).
- public static int RAW_NO_DOMAIN;
+ private static int RAW_NO_DOMAIN;
// String resource ID for the default text encoding to use.
- public static int STRING_DEFAULT_TEXT_ENCODING;
+ private static int STRING_DEFAULT_TEXT_ENCODING;
// The embedder should inject a Resources object that will be used
// to resolve Resource IDs into the actual resources.
sResourceCache = new HashMap<Integer, SoftReference<String> >();
}
+ public static void setErrorPageResources(int loaderror, int nodomain) {
+ RAW_LOAD_ERROR = loaderror;
+ RAW_NO_DOMAIN = nodomain;
+ }
+
+ public static void setDefaultTextEncoding(int encoding) {
+ STRING_DEFAULT_TEXT_ENCODING = encoding;
+ }
+
@CalledByNative
public static String getDefaultTextEncoding() {
return getResource(STRING_DEFAULT_TEXT_ENCODING, TYPE_STRING);
isr.close();
}
} catch (IOException e) {
+ // Nothing to do if close() fails.
}
}
return result;