Only use ChromiumHTTPDataSource if webkit was built with chromium support.

Change-Id: I9ce16f4aae35c61c9fb92fefc2a7c72537631cba
diff --git a/media/libstagefright/Android.mk b/media/libstagefright/Android.mk
index 2ed3b79..e445b74 100644
--- a/media/libstagefright/Android.mk
+++ b/media/libstagefright/Android.mk
@@ -77,11 +77,6 @@
         libcrypto        \
         libssl           \
         libgui           \
-        liblog           \
-        libicuuc         \
-        libicui18n       \
-        libz             \
-        libdl            \
 
 LOCAL_STATIC_LIBRARIES := \
         libstagefright_color_conversion \
@@ -106,6 +101,46 @@
         libstagefright_id3 \
         libstagefright_g711dec \
         libFLAC \
+
+################################################################################
+
+# The following was shamelessly copied from external/webkit/Android.mk and
+# currently must follow the same logic to determine how webkit was built and
+# if it's safe to link against libchromium.net
+
+# V8 also requires an ARMv7 CPU, and since we must use jsc, we cannot
+# use the Chrome http stack either.
+ifneq ($(strip $(ARCH_ARM_HAVE_ARMV7A)),true)
+  USE_ALT_HTTP := true
+endif
+
+# See if the user has specified a stack they want to use
+HTTP_STACK = $(HTTP)
+# We default to the Chrome HTTP stack.
+DEFAULT_HTTP = chrome
+ALT_HTTP = android
+
+ifneq ($(HTTP_STACK),chrome)
+  ifneq ($(HTTP_STACK),android)
+    # No HTTP stack is specified, pickup the one we want as default.
+    ifeq ($(USE_ALT_HTTP),true)
+      HTTP_STACK = $(ALT_HTTP)
+    else
+      HTTP_STACK = $(DEFAULT_HTTP)
+    endif
+  endif
+endif
+
+ifeq ($(HTTP_STACK),chrome)
+
+LOCAL_SHARED_LIBRARIES += \
+        liblog           \
+        libicuuc         \
+        libicui18n       \
+        libz             \
+        libdl            \
+
+LOCAL_STATIC_LIBRARIES += \
         libstagefright_chromium_http \
         libchromium_net         \
         libwebcore              \
@@ -115,6 +150,12 @@
 include external/stlport/libstlport.mk
 endif
 
+LOCAL_CPPFLAGS += -DCHROMIUM_AVAILABLE=1
+
+endif  # ifeq ($(HTTP_STACK),chrome)
+
+################################################################################
+
 LOCAL_SHARED_LIBRARIES += \
         libstagefright_amrnb_common \
         libstagefright_enc_common \
diff --git a/media/libstagefright/HTTPBase.cpp b/media/libstagefright/HTTPBase.cpp
index ff610c7..58b17a7 100644
--- a/media/libstagefright/HTTPBase.cpp
+++ b/media/libstagefright/HTTPBase.cpp
@@ -16,7 +16,10 @@
 
 #include "include/HTTPBase.h"
 
+#if CHROMIUM_AVAILABLE
 #include "include/ChromiumHTTPDataSource.h"
+#endif
+
 #include "include/NuHTTPDataSource.h"
 
 #include <cutils/properties.h>
@@ -27,11 +30,14 @@
 
 // static
 sp<HTTPBase> HTTPBase::Create(uint32_t flags) {
+#if CHROMIUM_AVAILABLE
     char value[PROPERTY_VALUE_MAX];
     if (!property_get("media.stagefright.use-chromium", value, NULL)
             || (strcasecmp("false", value) && strcmp("0", value))) {
         return new ChromiumHTTPDataSource(flags);
-    } else {
+    } else
+#endif
+    {
         return new NuHTTPDataSource(flags);
     }
 }