Get the drawable directory from Java for the platform buttons.

Fix http://b/issue?id=2086818
diff --git a/WebKit/android/RenderSkinAndroid.cpp b/WebKit/android/RenderSkinAndroid.cpp
index a261b27..fda4241 100644
--- a/WebKit/android/RenderSkinAndroid.cpp
+++ b/WebKit/android/RenderSkinAndroid.cpp
@@ -41,11 +41,11 @@
     , m_width(0)
 {}
 
-void RenderSkinAndroid::Init(android::AssetManager* am)
+void RenderSkinAndroid::Init(android::AssetManager* am, String drawableDirectory)
 {
-    RenderSkinButton::Init(am);
+    RenderSkinButton::Init(am, drawableDirectory);
     RenderSkinCombo::Init(am);
-    RenderSkinRadio::Init(am);
+    RenderSkinRadio::Init(am, drawableDirectory);
 }
 
 bool RenderSkinAndroid::DecodeBitmap(android::AssetManager* am, const char* fileName, SkBitmap* bitmap)
diff --git a/WebKit/android/RenderSkinAndroid.h b/WebKit/android/RenderSkinAndroid.h
index c693dd1..475ad75 100644
--- a/WebKit/android/RenderSkinAndroid.h
+++ b/WebKit/android/RenderSkinAndroid.h
@@ -26,6 +26,8 @@
 #ifndef RenderSkinAndroid_h
 #define RenderSkinAndroid_h
 
+#include "PlatformString.h"
+
 namespace android {
     class AssetManager;
 }
@@ -58,7 +60,7 @@
      * Initialize the Android skinning system. The AssetManager may be used to find resources used
      * in rendering.
      */
-    static void Init(android::AssetManager*);
+    static void Init(android::AssetManager*, String drawableDirectory);
     
     /* DecodeBitmap determines which file to use, with the given fileName of the form 
      * "images/bitmap.png", and uses the asset manager to select the exact one.  It
diff --git a/WebKit/android/RenderSkinButton.cpp b/WebKit/android/RenderSkinButton.cpp
index 7ab2491..c28dccf 100644
--- a/WebKit/android/RenderSkinButton.cpp
+++ b/WebKit/android/RenderSkinButton.cpp
@@ -25,6 +25,7 @@
 #define LOG_TAG "WebCore"
 
 #include "config.h"
+#include "CString.h"
 #include "android_graphics.h"
 #include "Document.h"
 #include "IntRect.h"
@@ -43,10 +44,10 @@
 
 static const PatchData gFiles[] =
     {
-        { "res/drawable-mdpi/btn_default_normal_disable.9.png", 2, 7 },
-        { "res/drawable-mdpi/btn_default_normal.9.png", 2, 7 },
-        { "res/drawable-mdpi/btn_default_selected.9.png", 2, 7 },
-        { "res/drawable-mdpi/btn_default_pressed.9.png", 2, 7 }
+        { "btn_default_normal_disable.9.png", 2, 7 },
+        { "btn_default_normal.9.png", 2, 7 },
+        { "btn_default_selected.9.png", 2, 7 },
+        { "btn_default_pressed.9.png", 2, 7 }
     };
 
 static SkBitmap gButton[sizeof(gFiles)/sizeof(gFiles[0])];
@@ -54,7 +55,7 @@
 
 namespace WebCore {
 
-void RenderSkinButton::Init(android::AssetManager* am)
+void RenderSkinButton::Init(android::AssetManager* am, String drawableDirectory)
 {
     static bool gInited;
     if (gInited)
@@ -63,7 +64,8 @@
     gInited = true;
     gDecoded = true;
     for (size_t i = 0; i < sizeof(gFiles)/sizeof(gFiles[0]); i++) {
-        if (!RenderSkinAndroid::DecodeBitmap(am, gFiles[i].name, &gButton[i])) {
+        String path = drawableDirectory + gFiles[i].name;
+        if (!RenderSkinAndroid::DecodeBitmap(am, path.utf8().data(), &gButton[i])) {
             gDecoded = false;
             LOGD("RenderSkinButton::Init: button assets failed to decode\n\tBrowser buttons will not draw");
             break;
diff --git a/WebKit/android/RenderSkinButton.h b/WebKit/android/RenderSkinButton.h
index 55eb2da..247b2f5 100644
--- a/WebKit/android/RenderSkinButton.h
+++ b/WebKit/android/RenderSkinButton.h
@@ -39,7 +39,7 @@
      * Initialize the class before use. Uses the AssetManager to initialize any 
      * bitmaps the class may use.
      */
-    static void Init(android::AssetManager*);
+    static void Init(android::AssetManager*, String drawableDirectory);
     /**
      * Draw the skin to the canvas, using the rectangle for its bounds and the 
      * State to determine which skin to use, i.e. focused or not focused.
diff --git a/WebKit/android/RenderSkinRadio.cpp b/WebKit/android/RenderSkinRadio.cpp
index b9b67f5..0207a28 100644
--- a/WebKit/android/RenderSkinRadio.cpp
+++ b/WebKit/android/RenderSkinRadio.cpp
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "RenderSkinRadio.h"
 
+#include "CString.h"
 #include "android_graphics.h"
 #include "Document.h"
 #include "Element.h"
@@ -37,10 +38,10 @@
 #include "SkCanvas.h"
 #include "SkRect.h"
 
-static const char* checks[] = { "res/drawable-mdpi/btn_check_off.png",
-                                "res/drawable-mdpi/btn_check_on.png",
-                                "res/drawable-mdpi/btn_radio_off.png",
-                                "res/drawable-mdpi/btn_radio_on.png"};
+static const char* checks[] = { "btn_check_off.png",
+                                "btn_check_on.png",
+                                "btn_radio_off.png",
+                                "btn_radio_on.png"};
 // Matches the width of the bitmap
 static SkScalar SIZE;
 
@@ -49,14 +50,18 @@
 static SkBitmap s_bitmap[4];
 static bool     s_decoded;
 
-void RenderSkinRadio::Init(android::AssetManager* am)
+void RenderSkinRadio::Init(android::AssetManager* am, String drawableDirectory)
 {
     if (s_decoded)
         return;
-    s_decoded = RenderSkinAndroid::DecodeBitmap(am, checks[0], &s_bitmap[0]);
-    s_decoded = RenderSkinAndroid::DecodeBitmap(am, checks[1], &s_bitmap[1]) && s_decoded;
-    s_decoded = RenderSkinAndroid::DecodeBitmap(am, checks[2], &s_bitmap[2]) && s_decoded;
-    s_decoded = RenderSkinAndroid::DecodeBitmap(am, checks[3], &s_bitmap[3]) && s_decoded;
+    String path = drawableDirectory + checks[0];
+    s_decoded = RenderSkinAndroid::DecodeBitmap(am, path.utf8().data(), &s_bitmap[0]);
+    path = drawableDirectory + checks[1];
+    s_decoded = RenderSkinAndroid::DecodeBitmap(am, path.utf8().data(), &s_bitmap[1]) && s_decoded;
+    path = drawableDirectory + checks[2];
+    s_decoded = RenderSkinAndroid::DecodeBitmap(am, path.utf8().data(), &s_bitmap[2]) && s_decoded;
+    path = drawableDirectory + checks[3];
+    s_decoded = RenderSkinAndroid::DecodeBitmap(am, path.utf8().data(), &s_bitmap[3]) && s_decoded;
     SIZE = SkIntToScalar(s_bitmap[0].width());
 }
 
diff --git a/WebKit/android/RenderSkinRadio.h b/WebKit/android/RenderSkinRadio.h
index f70098f..e196194 100644
--- a/WebKit/android/RenderSkinRadio.h
+++ b/WebKit/android/RenderSkinRadio.h
@@ -26,6 +26,8 @@
 #ifndef RenderSkinRadio_h
 #define RenderSkinRadio_h
 
+#include "PlatformString.h"
+
 class SkCanvas;
 
 namespace android {
@@ -45,7 +47,7 @@
     /**
      * Initialize the class before use. Uses the AssetManager to initialize any bitmaps the class may use.
      */
-    static void Init(android::AssetManager*);
+    static void Init(android::AssetManager*, String drawableDirectory);
 
     /**
      * Draw the element to the canvas at the specified size and location.
diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp
index 5145a85..418af49 100644
--- a/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -788,10 +788,15 @@
     // Set the mNativeFrame field in Frame
     SET_NATIVE_FRAME(env, obj, (int)frame);
 
-    // Setup the asset manager.
-    AssetManager* am = assetManagerForJavaObject(env, jAssetManager);
-    // Initialize our skinning classes
-    WebCore::RenderSkinAndroid::Init(am);
+    String directory = webFrame->getRawResourceFilename(WebFrame::DRAWABLEDIR);
+    if (directory.isEmpty())
+        LOGE("Can't find the drawable directory");
+    else {
+        // Setup the asset manager.
+        AssetManager* am = assetManagerForJavaObject(env, jAssetManager);
+        // Initialize our skinning classes
+        WebCore::RenderSkinAndroid::Init(am, directory);
+    }
 }
 
 static void DestroyFrame(JNIEnv* env, jobject obj)
diff --git a/WebKit/android/jni/WebCoreFrameBridge.h b/WebKit/android/jni/WebCoreFrameBridge.h
index 6b5c90c..353545e 100644
--- a/WebKit/android/jni/WebCoreFrameBridge.h
+++ b/WebKit/android/jni/WebCoreFrameBridge.h
@@ -54,6 +54,7 @@
     enum RAW_RES_ID {
         NODOMAIN = 1,
         LOADERROR,
+        DRAWABLEDIR,
     };
     WebFrame(JNIEnv* env, jobject obj, jobject historyList, WebCore::Page* page);
     ~WebFrame();