Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / android_webview / java / src / org / chromium / android_webview / AwResource.java
index 829f243..a4fddcb 100644 (file)
@@ -17,20 +17,24 @@ import java.util.Map;
 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.
@@ -47,6 +51,15 @@ public class AwResource {
         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);
@@ -109,6 +122,7 @@ public class AwResource {
                     isr.close();
                 }
             } catch (IOException e) {
+                // Nothing to do if close() fails.
             }
         }
         return result;