summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk54
-rw-r--r--CleanSpec.mk2
-rw-r--r--Source/JavaScriptCore/wtf/Platform.h4
-rw-r--r--Source/WebCore/platform/network/android/ResourceRequestAndroid.cpp7
-rw-r--r--Source/WebKit/Android.mk10
-rw-r--r--Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp1
-rw-r--r--Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp28
-rw-r--r--Source/WebKit/android/WebCoreSupport/ResourceLoaderAndroid.cpp9
-rw-r--r--Source/WebKit/android/jni/CacheManager.cpp4
-rw-r--r--Source/WebKit/android/jni/CookieManager.cpp41
-rw-r--r--Source/WebKit/android/jni/JavaBridge.cpp2
-rw-r--r--Source/WebKit/android/jni/JniUtil.cpp58
-rw-r--r--Source/WebKit/android/jni/WebCoreFrameBridge.cpp133
-rw-r--r--Source/WebKit/android/jni/WebCoreFrameBridge.h6
-rw-r--r--Source/WebKit/android/jni/WebCoreJni.cpp4
-rw-r--r--Source/WebKit/android/jni/WebCoreJni.h2
-rw-r--r--Source/WebKit/android/jni/WebCoreJniOnLoad.cpp7
-rw-r--r--Source/WebKit/android/jni/WebCoreResourceLoader.cpp327
-rw-r--r--Source/WebKit/android/jni/WebCoreResourceLoader.h78
-rw-r--r--Source/WebKit/android/jni/WebSettings.cpp6
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp8
-rw-r--r--Source/WebKit/android/jni/WebViewCore.h5
22 files changed, 20 insertions, 776 deletions
diff --git a/Android.mk b/Android.mk
index fd01fbb..1320fa8 100644
--- a/Android.mk
+++ b/Android.mk
@@ -35,32 +35,12 @@ ifneq ($(SUPPORT_COMPLEX_SCRIPTS),false)
SUPPORT_COMPLEX_SCRIPTS = true
endif
-# See if the desired HTTP stack has been specified.
-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
-
# Read the environment variable to determine if Autofill is compiled.
-# The default is on. Chrome HTTP stack must be used when Autofill
+# The default is on.
# is turned on.
ifneq ($(ENABLE_AUTOFILL),false)
ENABLE_AUTOFILL = true
endif
-ifneq ($(HTTP_STACK),chrome)
- ENABLE_AUTOFILL = false
-endif
BASE_PATH := $(call my-dir)
include $(CLEAR_VARS)
@@ -252,10 +232,7 @@ LOCAL_CFLAGS += -fvisibility=hidden
LOCAL_CFLAGS += -DALWAYS_INLINE=inline
# Make sure assert.h is included before assert is defined
LOCAL_CFLAGS += -include "assert.h"
-ifeq ($(HTTP_STACK),chrome)
LOCAL_CFLAGS += -DGOOGLEURL
-LOCAL_CFLAGS += -DWTF_USE_CHROME_NETWORK_STACK
-endif # HTTP_STACK == chrome
LOCAL_CPPFLAGS := -Wno-sign-promo
LOCAL_CPPFLAGS := -Wno-c++0x-compat
@@ -291,25 +268,30 @@ endif
LOCAL_LDLIBS += -lpthread -ldl
# Build the list of shared libraries
+# We have to use the android version of libdl
LOCAL_SHARED_LIBRARIES := \
+ libEGL \
+ libGLESv2 \
libandroid \
libandroidfw \
libandroid_runtime \
- libnativehelper \
- libsqlite \
- libskia \
- libutils \
- libui \
+ libchromium_net \
+ libcrypto \
libcutils \
+ libdl \
+ libgui \
libicuuc \
libicui18n \
libmedia \
- libEGL \
- libGLESv2 \
- libgui
+ libnativehelper \
+ libskia \
+ libsqlite \
+ libssl \
+ libstlport \
+ libutils \
+ libui \
+ libz
-# We have to use the android version of libdl
-LOCAL_SHARED_LIBRARIES += libdl libstlport
# We have to fake out some headers when using stlport.
LOCAL_C_INCLUDES += \
external/chromium/android
@@ -327,10 +309,6 @@ endif
# Build the list of static libraries
LOCAL_STATIC_LIBRARIES := libxml2 libxslt libhyphenation libskiagpu libv8
-ifeq ($(HTTP_STACK),chrome)
-LOCAL_SHARED_LIBRARIES += libcrypto libssl libz libchromium_net
-endif # HTTP_STACK == chrome
-
ifeq ($(ENABLE_AUTOFILL),true)
LOCAL_SHARED_LIBRARIES += libexpat
endif
diff --git a/CleanSpec.mk b/CleanSpec.mk
index a910d37..fda2cf9 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -79,6 +79,8 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libwebcore_int
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libwebcore_intermediates)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libwebcore_intermediates)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libwebcore_intermediates)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libwebcore_intermediates)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libwebcore_intermediates)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
diff --git a/Source/JavaScriptCore/wtf/Platform.h b/Source/JavaScriptCore/wtf/Platform.h
index 3043e56..fcd93c2 100644
--- a/Source/JavaScriptCore/wtf/Platform.h
+++ b/Source/JavaScriptCore/wtf/Platform.h
@@ -782,10 +782,6 @@
// track changes to the style that may change what is drawn
#define ANDROID_STYLE_VERSION
-#if !defined(WTF_USE_CHROME_NETWORK_STACK)
-#define WTF_USE_CHROME_NETWORK_STACK 0
-#endif /* !defined(WTF_USE_CHROME_NETWORK_STACK) */
-
// This is present in JavaScriptCore/config.h, which Android does not use.
#define WTF_CHANGES 1
#endif /* PLATFORM(ANDROID) */
diff --git a/Source/WebCore/platform/network/android/ResourceRequestAndroid.cpp b/Source/WebCore/platform/network/android/ResourceRequestAndroid.cpp
index 00735f3..1519e9c 100644
--- a/Source/WebCore/platform/network/android/ResourceRequestAndroid.cpp
+++ b/Source/WebCore/platform/network/android/ResourceRequestAndroid.cpp
@@ -30,17 +30,10 @@ namespace WebCore {
unsigned initializeMaximumHTTPConnectionCountPerHost()
{
-#if USE(CHROME_NETWORK_STACK)
// The chromium network stack already handles limiting the number of
// parallel requests per host, so there's no need to do it here. Therefore,
// this is set to a high value that should never be hit in practice.
return 10000;
-#else
- // This is used by the loader to control the number of parallel load
- // requests. Our java framework has 4 threads that can each pipeline up to
- // 5 requests. Use 20 as a maximum number.
- return 20;
-#endif
}
} // namespace WebCore
diff --git a/Source/WebKit/Android.mk b/Source/WebKit/Android.mk
index 36664dd..8ec48da 100644
--- a/Source/WebKit/Android.mk
+++ b/Source/WebKit/Android.mk
@@ -16,8 +16,10 @@
##
LOCAL_SRC_FILES := \
+ android/WebCoreSupport/CacheResult.cpp \
android/WebCoreSupport/CachedFramePlatformDataAndroid.cpp \
android/WebCoreSupport/ChromeClientAndroid.cpp \
+ android/WebCoreSupport/ChromiumInit.cpp \
android/WebCoreSupport/ContextMenuClientAndroid.cpp \
android/WebCoreSupport/DeviceMotionClientAndroid.cpp \
android/WebCoreSupport/DeviceOrientationClientAndroid.cpp \
@@ -31,11 +33,6 @@ LOCAL_SRC_FILES := \
android/WebCoreSupport/PlatformBridge.cpp \
android/WebCoreSupport/ResourceLoaderAndroid.cpp \
android/WebCoreSupport/UrlInterceptResponse.cpp \
-
-ifeq ($(HTTP_STACK),chrome)
-LOCAL_SRC_FILES += \
- android/WebCoreSupport/ChromiumInit.cpp \
- android/WebCoreSupport/CacheResult.cpp \
android/WebCoreSupport/WebCache.cpp \
android/WebCoreSupport/WebCookieJar.cpp \
android/WebCoreSupport/WebUrlLoader.cpp \
@@ -45,7 +42,6 @@ LOCAL_SRC_FILES += \
android/WebCoreSupport/WebResourceRequest.cpp \
android/WebCoreSupport/WebResponse.cpp \
android/WebCoreSupport/WebViewClientError.cpp
-endif # HTTP_STACK == chrome
LOCAL_SRC_FILES += \
android/RenderSkinAndroid.cpp \
@@ -63,13 +59,11 @@ LOCAL_SRC_FILES += \
android/jni/GeolocationPermissionsBridge.cpp \
android/jni/JavaBridge.cpp \
android/jni/JavaSharedClient.cpp \
- android/jni/JniUtil.cpp \
android/jni/MIMETypeRegistry.cpp \
android/jni/MockGeolocation.cpp \
android/jni/PictureSet.cpp \
android/jni/WebCoreFrameBridge.cpp \
android/jni/WebCoreJni.cpp \
- android/jni/WebCoreResourceLoader.cpp \
android/jni/WebFrameView.cpp \
android/jni/WebHistory.cpp \
android/jni/WebIconDatabase.cpp \
diff --git a/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp b/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
index 64799a8..c573b4e 100644
--- a/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
+++ b/Source/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
@@ -70,7 +70,6 @@
#include "SkRect.h"
#include "TextEncoding.h"
#include "WebCoreFrameBridge.h"
-#include "WebCoreResourceLoader.h"
#include "WebHistory.h"
#include "WebIconDatabase.h"
#include "WebFrameView.h"
diff --git a/Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp b/Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp
index 41c0222..8eb379a 100644
--- a/Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp
+++ b/Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp
@@ -71,49 +71,25 @@ String PlatformBridge::getSignedPublicKeyAndChallengeString(unsigned index, cons
void PlatformBridge::setCookies(const Document* document, const KURL& url, const String& value)
{
-#if USE(CHROME_NETWORK_STACK)
std::string cookieValue(value.utf8().data());
GURL cookieGurl(url.string().utf8().data());
bool isPrivateBrowsing = document->settings() && document->settings()->privateBrowsingEnabled();
WebCookieJar::get(isPrivateBrowsing)->cookieStore()->SetCookie(cookieGurl, cookieValue);
-#else
- CookieClient* client = JavaSharedClient::GetCookieClient();
- if (!client)
- return;
-
- client->setCookies(url, value);
-#endif
}
String PlatformBridge::cookies(const Document* document, const KURL& url)
{
-#if USE(CHROME_NETWORK_STACK)
GURL cookieGurl(url.string().utf8().data());
bool isPrivateBrowsing = document->settings() && document->settings()->privateBrowsingEnabled();
std::string cookies = WebCookieJar::get(isPrivateBrowsing)->cookieStore()->GetCookies(cookieGurl);
String cookieString(cookies.c_str());
return cookieString;
-#else
- CookieClient* client = JavaSharedClient::GetCookieClient();
- if (!client)
- return String();
-
- return client->cookies(url);
-#endif
}
bool PlatformBridge::cookiesEnabled(const Document* document)
{
-#if USE(CHROME_NETWORK_STACK)
bool isPrivateBrowsing = document->settings() && document->settings()->privateBrowsingEnabled();
return WebCookieJar::get(isPrivateBrowsing)->allowCookies();
-#else
- CookieClient* client = JavaSharedClient::GetCookieClient();
- if (!client)
- return false;
-
- return client->cookiesEnabled();
-#endif
}
NPObject* PlatformBridge::pluginScriptableObject(Widget* widget)
@@ -171,15 +147,11 @@ int PlatformBridge::screenHeightInDocCoord(const WebCore::FrameView* frameView)
String PlatformBridge::computeDefaultLanguage()
{
-#if USE(CHROME_NETWORK_STACK)
String acceptLanguages = WebRequestContext::acceptLanguage();
size_t length = acceptLanguages.find(',');
if (length == std::string::npos)
length = acceptLanguages.length();
return acceptLanguages.substring(0, length);
-#else
- return "en";
-#endif
}
void PlatformBridge::updateViewport(FrameView* frameView)
diff --git a/Source/WebKit/android/WebCoreSupport/ResourceLoaderAndroid.cpp b/Source/WebKit/android/WebCoreSupport/ResourceLoaderAndroid.cpp
index 7f54810..92c39b8 100644
--- a/Source/WebKit/android/WebCoreSupport/ResourceLoaderAndroid.cpp
+++ b/Source/WebKit/android/WebCoreSupport/ResourceLoaderAndroid.cpp
@@ -29,7 +29,6 @@
#include "Frame.h"
#include "FrameLoaderClientAndroid.h"
#include "WebCoreFrameBridge.h"
-#include "WebCoreResourceLoader.h"
#include "WebUrlLoader.h"
#include "WebViewCore.h"
@@ -42,18 +41,13 @@ PassRefPtr<ResourceLoaderAndroid> ResourceLoaderAndroid::start(
{
// Called on main thread
FrameLoaderClientAndroid* clientAndroid = static_cast<FrameLoaderClientAndroid*>(client);
-#if USE(CHROME_NETWORK_STACK)
WebViewCore* webViewCore = WebViewCore::getWebViewCore(clientAndroid->getFrame()->view());
bool isMainFrame = !(clientAndroid->getFrame()->tree() && clientAndroid->getFrame()->tree()->parent());
return WebUrlLoader::start(client, handle, request, isMainResource, isMainFrame, isSync, webViewCore->webRequestContext());
-#else
- return clientAndroid->webFrame()->startLoadingResource(handle, request, isMainResource, isSync);
-#endif
}
bool ResourceLoaderAndroid::willLoadFromCache(const WebCore::KURL& url, int64_t identifier)
{
-#if USE(CHROME_NETWORK_STACK)
// This method is used to determine if a POST request can be repeated from
// cache, but you cannot really know until you actually try to read from the
// cache. Even if we checked now, something else could come along and wipe
@@ -63,9 +57,6 @@ bool ResourceLoaderAndroid::willLoadFromCache(const WebCore::KURL& url, int64_t
// reload. Then in FrameLoaderClientImpl::dispatchWillSendRequest, we
// fix-up the cache policy of the request to force a load from the cache.
return true;
-#else
- return WebCoreResourceLoader::willLoadFromCache(url, identifier);
-#endif
}
}
diff --git a/Source/WebKit/android/jni/CacheManager.cpp b/Source/WebKit/android/jni/CacheManager.cpp
index d319054..b34776d 100644
--- a/Source/WebKit/android/jni/CacheManager.cpp
+++ b/Source/WebKit/android/jni/CacheManager.cpp
@@ -25,8 +25,6 @@
#include "config.h"
-#if USE(CHROME_NETWORK_STACK)
-
#include "ChromiumIncludes.h"
#include "WebCache.h"
#include "WebCoreJni.h"
@@ -140,5 +138,3 @@ int registerCacheManager(JNIEnv* env)
}
} // namespace android
-
-#endif // USE(CHROME_NETWORK_STACK)
diff --git a/Source/WebKit/android/jni/CookieManager.cpp b/Source/WebKit/android/jni/CookieManager.cpp
index 357d158..fca612f 100644
--- a/Source/WebKit/android/jni/CookieManager.cpp
+++ b/Source/WebKit/android/jni/CookieManager.cpp
@@ -40,49 +40,30 @@ static const char* javaCookieManagerClass = "android/webkit/CookieManager";
static bool acceptCookie(JNIEnv*, jobject)
{
-#if USE(CHROME_NETWORK_STACK)
// This is a static method which gets the cookie policy for all WebViews. We
// always apply the same configuration to the contexts for both regular and
// private browsing, so expect the same result here.
bool regularAcceptCookies = WebCookieJar::get(false)->allowCookies();
ASSERT(regularAcceptCookies == WebCookieJar::get(true)->allowCookies());
return regularAcceptCookies;
-#else
- // The Android HTTP stack is implemented Java-side.
- ASSERT_NOT_REACHED();
- return false;
-#endif
}
static jstring getCookie(JNIEnv* env, jobject, jstring url, jboolean privateBrowsing)
{
-#if USE(CHROME_NETWORK_STACK)
GURL gurl(jstringToStdString(env, url));
CookieOptions options;
options.set_include_httponly();
std::string cookies = WebCookieJar::get(privateBrowsing)->cookieStore()->GetCookieMonster()->GetCookiesWithOptions(gurl, options);
return stdStringToJstring(env, cookies);
-#else
- // The Android HTTP stack is implemented Java-side.
- ASSERT_NOT_REACHED();
- return jstring();
-#endif
}
static bool hasCookies(JNIEnv*, jobject, jboolean privateBrowsing)
{
-#if USE(CHROME_NETWORK_STACK)
return WebCookieJar::get(privateBrowsing)->getNumCookiesInDatabase() > 0;
-#else
- // The Android HTTP stack is implemented Java-side.
- ASSERT_NOT_REACHED();
- return false;
-#endif
}
static void removeAllCookie(JNIEnv*, jobject)
{
-#if USE(CHROME_NETWORK_STACK)
WebCookieJar::get(false)->cookieStore()->GetCookieMonster()->DeleteAll(true);
// This will lazily create a new private browsing context. However, if the
// context doesn't already exist, there's no need to create it, as cookies
@@ -94,84 +75,62 @@ static void removeAllCookie(JNIEnv*, jobject)
// The Java code removes cookies directly from the backing database, so we do the same,
// but with a NULL callback so it's asynchronous.
WebCookieJar::get(true)->cookieStore()->GetCookieMonster()->FlushStore(NULL);
-#endif
}
static void removeExpiredCookie(JNIEnv*, jobject)
{
-#if USE(CHROME_NETWORK_STACK)
// This simply forces a GC. The getters delete expired cookies so won't return expired cookies anyway.
WebCookieJar::get(false)->cookieStore()->GetCookieMonster()->GetAllCookies();
WebCookieJar::get(true)->cookieStore()->GetCookieMonster()->GetAllCookies();
-#endif
}
static void removeSessionCookies(WebCookieJar* cookieJar)
{
-#if USE(CHROME_NETWORK_STACK)
CookieMonster* cookieMonster = cookieJar->cookieStore()->GetCookieMonster();
CookieList cookies = cookieMonster->GetAllCookies();
for (CookieList::const_iterator iter = cookies.begin(); iter != cookies.end(); ++iter) {
if (iter->IsSessionCookie())
cookieMonster->DeleteCanonicalCookie(*iter);
}
-#endif
}
static void removeSessionCookie(JNIEnv*, jobject)
{
-#if USE(CHROME_NETWORK_STACK)
removeSessionCookies(WebCookieJar::get(false));
removeSessionCookies(WebCookieJar::get(true));
-#endif
}
static void setAcceptCookie(JNIEnv*, jobject, jboolean accept)
{
-#if USE(CHROME_NETWORK_STACK)
// This is a static method which configures the cookie policy for all
// WebViews, so we configure the contexts for both regular and private
// browsing.
WebCookieJar::get(false)->setAllowCookies(accept);
WebCookieJar::get(true)->setAllowCookies(accept);
-#endif
}
static void setCookie(JNIEnv* env, jobject, jstring url, jstring value, jboolean privateBrowsing)
{
-#if USE(CHROME_NETWORK_STACK)
GURL gurl(jstringToStdString(env, url));
std::string line(jstringToStdString(env, value));
CookieOptions options;
options.set_include_httponly();
WebCookieJar::get(privateBrowsing)->cookieStore()->GetCookieMonster()->SetCookieWithOptions(gurl, line, options);
-#endif
}
static void flushCookieStore(JNIEnv*, jobject)
{
-#if USE(CHROME_NETWORK_STACK)
WebCookieJar::flush();
-#endif
}
static bool acceptFileSchemeCookies(JNIEnv*, jobject)
{
-#if USE(CHROME_NETWORK_STACK)
return WebCookieJar::acceptFileSchemeCookies();
-#else
- // File scheme cookies are always accepted with the Android HTTP stack.
- return true;
-#endif
}
static void setAcceptFileSchemeCookies(JNIEnv*, jobject, jboolean accept)
{
-#if USE(CHROME_NETWORK_STACK)
WebCookieJar::setAcceptFileSchemeCookies(accept);
-#else
- // File scheme cookies are always accepted with the Android HTTP stack.
-#endif
}
static JNINativeMethod gCookieManagerMethods[] = {
diff --git a/Source/WebKit/android/jni/JavaBridge.cpp b/Source/WebKit/android/jni/JavaBridge.cpp
index 204ac4e..4c8234b 100644
--- a/Source/WebKit/android/jni/JavaBridge.cpp
+++ b/Source/WebKit/android/jni/JavaBridge.cpp
@@ -472,12 +472,10 @@ void JavaBridge::RemovePackageName(JNIEnv* env, jobject obj, jstring packageName
void JavaBridge::UpdateProxy(JNIEnv* env, jobject obj, jstring newProxy, jstring newExList)
{
-#if USE(CHROME_NETWORK_STACK)
std::string proxy = jstringToStdString(env, newProxy);
std::string exList = jstringToStdString(env, newExList);
WebCache::get(false)->proxy()->UpdateProxySettings(proxy, exList);
WebCache::get(true)->proxy()->UpdateProxySettings(proxy, exList);
-#endif
}
diff --git a/Source/WebKit/android/jni/JniUtil.cpp b/Source/WebKit/android/jni/JniUtil.cpp
deleted file mode 100644
index 651016e..0000000
--- a/Source/WebKit/android/jni/JniUtil.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2010, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include "ChromiumIncludes.h"
-#include <JNIHelp.h>
-
-namespace android {
-
-static const char* javaJniUtilClass = "android/webkit/JniUtil";
-
-static bool useChromiumHttpStack(JNIEnv*, jobject)
-{
-#if USE(CHROME_NETWORK_STACK)
- return true;
-#else
- return false;
-#endif
-}
-
-static JNINativeMethod gJniUtilMethods[] = {
- { "nativeUseChromiumHttpStack", "()Z", (void*) useChromiumHttpStack },
-};
-
-int registerJniUtil(JNIEnv* env)
-{
-#ifndef NDEBUG
- jclass jniUtil = env->FindClass(javaJniUtilClass);
- ALOG_ASSERT(jniUtil, "Unable to find class");
- env->DeleteLocalRef(jniUtil);
-#endif
- return jniRegisterNativeMethods(env, javaJniUtilClass, gJniUtilMethods, NELEM(gJniUtilMethods));
-}
-
-} // namespace android
diff --git a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp
index 2724d6b..d0f3830 100644
--- a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -83,7 +83,6 @@
#include "WebArchiveAndroid.h"
#include "WebCache.h"
#include "WebCoreJni.h"
-#include "WebCoreResourceLoader.h"
#include "WebHistory.h"
#include "WebIconDatabase.h"
#include "WebFrameView.h"
@@ -229,8 +228,6 @@ WebFrame::WebFrame(JNIEnv* env, jobject obj, jobject historyList, WebCore::Page*
mJavaFrame = new JavaBrowserFrame;
mJavaFrame->mObj = env->NewWeakGlobalRef(obj);
mJavaFrame->mHistoryList = env->NewWeakGlobalRef(historyList);
- mJavaFrame->mStartLoadingResource = env->GetMethodID(clazz, "startLoadingResource",
- "(ILjava/lang/String;Ljava/lang/String;Ljava/util/HashMap;[BJIZZZLjava/lang/String;Ljava/lang/String;)Landroid/webkit/LoadListener;");
mJavaFrame->mMaybeSavePassword = env->GetMethodID(clazz, "maybeSavePassword",
"([BLjava/lang/String;Ljava/lang/String;)V");
mJavaFrame->mShouldInterceptRequest =
@@ -286,7 +283,6 @@ WebFrame::WebFrame(JNIEnv* env, jobject obj, jobject historyList, WebCore::Page*
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
env->DeleteLocalRef(clazz);
- ALOG_ASSERT(mJavaFrame->mStartLoadingResource, "Could not find method startLoadingResource");
ALOG_ASSERT(mJavaFrame->mMaybeSavePassword, "Could not find method maybeSavePassword");
ALOG_ASSERT(mJavaFrame->mShouldInterceptRequest, "Could not find method shouldInterceptRequest");
ALOG_ASSERT(mJavaFrame->mLoadStarted, "Could not find method loadStarted");
@@ -401,94 +397,6 @@ private:
int m_size;
};
-PassRefPtr<WebCore::ResourceLoaderAndroid>
-WebFrame::startLoadingResource(WebCore::ResourceHandle* loader,
- const WebCore::ResourceRequest& request,
- bool mainResource,
- bool synchronous)
-{
- ALOGV("::WebCore:: startLoadingResource(%p, %s)",
- loader, request.url().string().latin1().data());
-
- JNIEnv* env = getJNIEnv();
- AutoJObject javaFrame = mJavaFrame->frame(env);
- if (!javaFrame.get())
- return 0;
-
- WTF::String method = request.httpMethod();
- WebCore::HTTPHeaderMap headers = request.httpHeaderFields();
-
- WTF::String urlStr = request.url().string();
- int colon = urlStr.find(':');
- bool allLower = true;
- for (int index = 0; index < colon; index++) {
- UChar ch = urlStr[index];
- if (!WTF::isASCIIAlpha(ch))
- break;
- allLower &= WTF::isASCIILower(ch);
- if (index == colon - 1 && !allLower) {
- urlStr = urlStr.substring(0, colon).lower()
- + urlStr.substring(colon);
- }
- }
- ALOGV("%s lower=%s", __FUNCTION__, urlStr.latin1().data());
- jstring jUrlStr = wtfStringToJstring(env, urlStr);
- jstring jMethodStr = NULL;
- if (!method.isEmpty())
- jMethodStr = wtfStringToJstring(env, method);
- WebCore::FormData* formdata = request.httpBody();
- jbyteArray jPostDataStr = getPostData(request);
- jobject jHeaderMap = createJavaMapFromHTTPHeaders(env, headers);
-
- // Convert the WebCore Cache Policy to a WebView Cache Policy.
- int cacheMode = 0; // WebSettings.LOAD_NORMAL
- switch (request.cachePolicy()) {
- case WebCore::ReloadIgnoringCacheData:
- cacheMode = 2; // WebSettings.LOAD_NO_CACHE
- break;
- case WebCore::ReturnCacheDataDontLoad:
- cacheMode = 3; // WebSettings.LOAD_CACHE_ONLY
- break;
- case WebCore::ReturnCacheDataElseLoad:
- cacheMode = 1; // WebSettings.LOAD_CACHE_ELSE_NETWORK
- break;
- case WebCore::UseProtocolCachePolicy:
- default:
- break;
- }
-
- ALOGV("::WebCore:: startLoadingResource %s with cacheMode %d", urlStr.ascii().data(), cacheMode);
-
- ResourceHandleInternal* loaderInternal = loader->getInternal();
- jstring jUsernameString = loaderInternal->m_user.isEmpty() ?
- NULL : wtfStringToJstring(env, loaderInternal->m_user);
- jstring jPasswordString = loaderInternal->m_pass.isEmpty() ?
- NULL : wtfStringToJstring(env, loaderInternal->m_pass);
-
- bool isUserGesture = UserGestureIndicator::processingUserGesture();
- jobject jLoadListener =
- env->CallObjectMethod(javaFrame.get(), mJavaFrame->mStartLoadingResource,
- (int)loader, jUrlStr, jMethodStr, jHeaderMap,
- jPostDataStr, formdata ? formdata->identifier(): 0,
- cacheMode, mainResource, isUserGesture,
- synchronous, jUsernameString, jPasswordString);
-
- env->DeleteLocalRef(jUrlStr);
- env->DeleteLocalRef(jMethodStr);
- env->DeleteLocalRef(jPostDataStr);
- env->DeleteLocalRef(jHeaderMap);
- env->DeleteLocalRef(jUsernameString);
- env->DeleteLocalRef(jPasswordString);
- if (checkException(env))
- return 0;
-
- RefPtr<WebCore::ResourceLoaderAndroid> h;
- if (jLoadListener)
- h = WebCoreResourceLoader::create(env, jLoadListener);
- env->DeleteLocalRef(jLoadListener);
- return h;
-}
-
UrlInterceptResponse*
WebFrame::shouldInterceptRequest(const WTF::String& url)
{
@@ -529,7 +437,6 @@ WebFrame::reportError(int errorCode, const WTF::String& description,
WTF::String
WebFrame::convertIDNToUnicode(const WebCore::KURL& url) {
WTF::String converted = url.string();
-#if USE(CHROME_NETWORK_STACK)
const WTF::String host = url.host();
if (host.find("xn--") == notFound) // no punycode IDN found.
return converted;
@@ -542,7 +449,6 @@ WebFrame::convertIDNToUnicode(const WebCore::KURL& url) {
newUrl.setHost(convertedHost);
converted = newUrl.string();
}
-#endif
return converted;
}
@@ -886,7 +792,6 @@ WebFrame::density() const
return dpi;
}
-#if USE(CHROME_NETWORK_STACK)
void
WebFrame::didReceiveAuthenticationChallenge(WebUrlLoaderClient* client, const std::string& host, const std::string& realm, bool useCachedCredentials, bool suppressDialog)
{
@@ -998,7 +903,6 @@ void WebFrame::setCertificate(const std::string& cert)
checkException(env);
}
-#endif // USE(CHROME_NETWORK_STACK)
void WebFrame::autoLogin(const std::string& loginHeader)
{
@@ -1188,10 +1092,8 @@ static void CreateFrame(JNIEnv* env, jobject obj, jobject javaview, jobject jAss
{
ScriptController::initializeThreading();
-#if USE(CHROME_NETWORK_STACK)
// needs to be called before any other chromium code
initChromium();
-#endif
// Create a new page
ChromeClientAndroid* chromeC = new ChromeClientAndroid;
@@ -1722,12 +1624,7 @@ static void ClearWebCoreCache()
static void ClearWebViewCache()
{
-#if USE(CHROME_NETWORK_STACK)
WebCache::get(false /*privateBrowsing*/)->clear();
-#else
- // The Android network stack provides a WebView cache in CacheManager.java.
- // Clearing this is handled entirely Java-side.
-#endif
}
static void ClearCache(JNIEnv *env, jobject obj)
@@ -1902,8 +1799,6 @@ static jboolean GetShouldStartScrolledRight(JNIEnv *env, jobject obj,
return startScrolledRight;
}
-#if USE(CHROME_NETWORK_STACK)
-
static void AuthenticationProceed(JNIEnv *env, jobject obj, int handle, jstring jUsername, jstring jPassword)
{
WebUrlLoaderClient* client = reinterpret_cast<WebUrlLoaderClient*>(handle);
@@ -2008,34 +1903,6 @@ static void SslClientCert(JNIEnv *env, jobject obj, int handle, jbyteArray pkey,
client->sslClientCert(privateKey.release(), certificate);
}
-#else
-
-static void AuthenticationProceed(JNIEnv *env, jobject obj, int handle, jstring jUsername, jstring jPassword)
-{
- ALOGW("Chromium authentication API called, but libchromium is not available");
-}
-
-static void AuthenticationCancel(JNIEnv *env, jobject obj, int handle)
-{
- ALOGW("Chromium authentication API called, but libchromium is not available");
-}
-
-static void SslCertErrorProceed(JNIEnv *env, jobject obj, int handle)
-{
- ALOGW("Chromium SSL API called, but libchromium is not available");
-}
-
-static void SslCertErrorCancel(JNIEnv *env, jobject obj, int handle, int cert_error)
-{
- ALOGW("Chromium SSL API called, but libchromium is not available");
-}
-
-static void SslClientCert(JNIEnv *env, jobject obj, int handle, jbyteArray privateKey, jobjectArray chain)
-{
- ALOGW("Chromium SSL API called, but libchromium is not available");
-}
-#endif // USE(CHROME_NETWORK_STACK)
-
// ----------------------------------------------------------------------------
/*
diff --git a/Source/WebKit/android/jni/WebCoreFrameBridge.h b/Source/WebKit/android/jni/WebCoreFrameBridge.h
index eaee63c..13f99af 100644
--- a/Source/WebKit/android/jni/WebCoreFrameBridge.h
+++ b/Source/WebKit/android/jni/WebCoreFrameBridge.h
@@ -64,10 +64,6 @@ class WebFrame : public WebCoreRefObject {
// helper function
static WebFrame* getWebFrame(const WebCore::Frame* frame);
- virtual PassRefPtr<WebCore::ResourceLoaderAndroid> startLoadingResource(WebCore::ResourceHandle*,
- const WebCore::ResourceRequest& request, bool mainResource,
- bool synchronous);
-
UrlInterceptResponse* shouldInterceptRequest(const WTF::String& url);
void reportError(int errorCode, const WTF::String& description,
@@ -117,7 +113,6 @@ class WebFrame : public WebCoreRefObject {
float density() const;
-#if USE(CHROME_NETWORK_STACK)
void didReceiveAuthenticationChallenge(WebUrlLoaderClient*, const std::string& host, const std::string& realm, bool useCachedCredentials, bool suppressDialog);
void reportSslCertError(WebUrlLoaderClient* client, int cert_error, const std::string& cert, const std::string& url);
void requestClientCert(WebUrlLoaderClient* client, const std::string& hostAndPort);
@@ -125,7 +120,6 @@ class WebFrame : public WebCoreRefObject {
void didReceiveData(const char* data, int size);
void didFinishLoading();
void setCertificate(const std::string& cert);
-#endif
void maybeSavePassword(WebCore::Frame* frame, const WebCore::ResourceRequest& request);
diff --git a/Source/WebKit/android/jni/WebCoreJni.cpp b/Source/WebKit/android/jni/WebCoreJni.cpp
index 65b6d20..5a142c8 100644
--- a/Source/WebKit/android/jni/WebCoreJni.cpp
+++ b/Source/WebKit/android/jni/WebCoreJni.cpp
@@ -79,8 +79,6 @@ jstring wtfStringToJstring(JNIEnv* env, const WTF::String& str, bool validOnZero
return length || validOnZeroLength ? env->NewString(str.characters(), length) : 0;
}
-
-#if USE(CHROME_NETWORK_STACK)
string16 jstringToString16(JNIEnv* env, jstring jstr)
{
if (!jstr || !env)
@@ -114,8 +112,6 @@ jstring stdStringToJstring(JNIEnv* env, const std::string& str, bool validOnZero
return !str.empty() || validOnZeroLength ? env->NewStringUTF(str.c_str()) : 0;
}
-#endif
-
jobjectArray intRectVectorToRectArray(JNIEnv* env, Vector<WebCore::IntRect>& rects)
{
jclass rectClass = env->FindClass("android/graphics/Rect");
diff --git a/Source/WebKit/android/jni/WebCoreJni.h b/Source/WebKit/android/jni/WebCoreJni.h
index 7a46f7b..25aa986 100644
--- a/Source/WebKit/android/jni/WebCoreJni.h
+++ b/Source/WebKit/android/jni/WebCoreJni.h
@@ -82,7 +82,6 @@ WTF::String jstringToWtfString(JNIEnv*, jstring);
// an empty WTF String returns 0.
jstring wtfStringToJstring(JNIEnv*, const WTF::String&, bool validOnZeroLength = false);
-#if USE(CHROME_NETWORK_STACK)
string16 jstringToString16(JNIEnv*, jstring);
std::string jstringToStdString(JNIEnv*, jstring);
@@ -90,7 +89,6 @@ std::string jstringToStdString(JNIEnv*, jstring);
// passing in an empty std::string will result in an empty jstring. Otherwise
// an empty std::string returns 0.
jstring stdStringToJstring(JNIEnv*, const std::string&, bool validOnZeroLength = false);
-#endif
jobjectArray intRectVectorToRectArray(JNIEnv*, Vector<WebCore::IntRect>&);
diff --git a/Source/WebKit/android/jni/WebCoreJniOnLoad.cpp b/Source/WebKit/android/jni/WebCoreJniOnLoad.cpp
index 64aeb7e..2644dab 100644
--- a/Source/WebKit/android/jni/WebCoreJniOnLoad.cpp
+++ b/Source/WebKit/android/jni/WebCoreJniOnLoad.cpp
@@ -73,7 +73,6 @@ namespace android {
extern int registerWebFrame(JNIEnv*);
extern int registerJavaBridge(JNIEnv*);
-extern int registerJniUtil(JNIEnv*);
extern int registerResourceLoader(JNIEnv*);
extern int registerWebViewCore(JNIEnv*);
extern int registerWebHistory(JNIEnv*);
@@ -92,9 +91,7 @@ extern int registerMediaPlayerVideo(JNIEnv*);
#endif
extern int registerDeviceMotionAndOrientationManager(JNIEnv*);
extern int registerCookieManager(JNIEnv*);
-#if USE(CHROME_NETWORK_STACK)
extern int registerCacheManager(JNIEnv*);
-#endif
}
@@ -105,9 +102,7 @@ struct RegistrationMethod {
static RegistrationMethod gWebCoreRegMethods[] = {
{ "JavaBridge", android::registerJavaBridge },
- { "JniUtil", android::registerJniUtil },
{ "WebFrame", android::registerWebFrame },
- { "WebCoreResourceLoader", android::registerResourceLoader },
{ "WebViewCore", android::registerWebViewCore },
{ "WebHistory", android::registerWebHistory },
{ "WebIconDatabase", android::registerWebIconDatabase },
@@ -125,9 +120,7 @@ static RegistrationMethod gWebCoreRegMethods[] = {
#endif
{ "DeviceMotionAndOrientationManager", android::registerDeviceMotionAndOrientationManager },
{ "CookieManager", android::registerCookieManager },
-#if USE(CHROME_NETWORK_STACK)
{ "CacheManager", android::registerCacheManager },
-#endif
};
EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved)
diff --git a/Source/WebKit/android/jni/WebCoreResourceLoader.cpp b/Source/WebKit/android/jni/WebCoreResourceLoader.cpp
deleted file mode 100644
index f0861ff..0000000
--- a/Source/WebKit/android/jni/WebCoreResourceLoader.cpp
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * Copyright 2006, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define LOG_TAG "webcoreglue"
-
-#include "config.h"
-#include "WebCoreResourceLoader.h"
-
-#include "ResourceError.h"
-#include "ResourceHandle.h"
-#include "ResourceHandleClient.h"
-#include "ResourceHandleInternal.h"
-#include "ResourceResponse.h"
-#include "SkUtils.h"
-#include "WebCoreJni.h"
-
-#include <JNIHelp.h>
-#include <JNIUtility.h>
-#include <SkTypes.h>
-#include <stdlib.h>
-#include <utils/misc.h>
-#include <wtf/Platform.h>
-#include <wtf/text/CString.h>
-
-namespace android {
-
-// ----------------------------------------------------------------------------
-
-static struct resourceloader_t {
- jfieldID mObject;
- jmethodID mCancelMethodID;
- jmethodID mDownloadFileMethodID;
- jmethodID mWillLoadFromCacheMethodID;
- jmethodID mPauseLoadMethodID;
-} gResourceLoader;
-
-// ----------------------------------------------------------------------------
-
-#define GET_NATIVE_HANDLE(env, obj) ((WebCore::ResourceHandle*)env->GetIntField(obj, gResourceLoader.mObject))
-#define SET_NATIVE_HANDLE(env, obj, handle) (env->SetIntField(obj, gResourceLoader.mObject, handle))
-
-//-----------------------------------------------------------------------------
-// ResourceLoadHandler
-
-PassRefPtr<WebCore::ResourceLoaderAndroid> WebCoreResourceLoader::create(JNIEnv *env, jobject jLoadListener)
-{
- return adoptRef<WebCore::ResourceLoaderAndroid>(new WebCoreResourceLoader(env, jLoadListener));
-}
-
-WebCoreResourceLoader::WebCoreResourceLoader(JNIEnv *env, jobject jLoadListener)
- : mPausedLoad(false)
-{
- mJLoader = env->NewGlobalRef(jLoadListener);
-}
-
-WebCoreResourceLoader::~WebCoreResourceLoader()
-{
- JNIEnv* env = JSC::Bindings::getJNIEnv();
- SET_NATIVE_HANDLE(env, mJLoader, 0);
- env->DeleteGlobalRef(mJLoader);
- mJLoader = 0;
-}
-
-void WebCoreResourceLoader::cancel()
-{
- JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(mJLoader, gResourceLoader.mCancelMethodID);
- checkException(env);
-}
-
-void WebCoreResourceLoader::downloadFile()
-{
- JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(mJLoader, gResourceLoader.mDownloadFileMethodID);
- checkException(env);
-}
-
-void WebCoreResourceLoader::pauseLoad(bool pause)
-{
- if (mPausedLoad == pause)
- return;
-
- mPausedLoad = pause;
- JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(mJLoader, gResourceLoader.mPauseLoadMethodID, pause);
- checkException(env);
-}
-
-/*
-* This static method is called to check to see if a POST response is in
-* the cache. This may be slow, but is only used during a navigation to
-* a POST response.
-*/
-bool WebCoreResourceLoader::willLoadFromCache(const WebCore::KURL& url, int64_t identifier)
-{
- JNIEnv* env = JSC::Bindings::getJNIEnv();
- WTF::String urlStr = url.string();
- jstring jUrlStr = wtfStringToJstring(env, urlStr);
- jclass resourceLoader = env->FindClass("android/webkit/LoadListener");
- bool val = env->CallStaticBooleanMethod(resourceLoader, gResourceLoader.mWillLoadFromCacheMethodID, jUrlStr, identifier);
- checkException(env);
- env->DeleteLocalRef(resourceLoader);
- env->DeleteLocalRef(jUrlStr);
-
- return val;
-}
-
-// ----------------------------------------------------------------------------
-void WebCoreResourceLoader::SetResponseHeader(JNIEnv* env, jobject obj, jint nativeResponse, jstring key, jstring val)
-{
- WebCore::ResourceResponse* response = (WebCore::ResourceResponse*)nativeResponse;
- ALOG_ASSERT(response, "nativeSetResponseHeader must take a valid response pointer!");
-
- ALOG_ASSERT(key, "How did a null value become a key?");
- if (val)
- response->setHTTPHeaderField(jstringToWtfString(env, key), jstringToWtfString(env, val));
-}
-
-jint WebCoreResourceLoader::CreateResponse(JNIEnv* env, jobject obj, jstring url, jint statusCode,
- jstring statusText, jstring mimeType, jlong expectedLength,
- jstring encoding)
-{
- ALOG_ASSERT(url, "Must have a url in the response!");
- WebCore::KURL kurl(WebCore::ParsedURLString, jstringToWtfString(env, url));
- WTF::String encodingStr;
- WTF::String mimeTypeStr;
- if (mimeType) {
- mimeTypeStr = jstringToWtfString(env, mimeType);
- ALOGV("Response setMIMEType: %s", mimeTypeStr.latin1().data());
- }
- if (encoding) {
- encodingStr = jstringToWtfString(env, encoding);
- ALOGV("Response setTextEncodingName: %s", encodingStr.latin1().data());
- }
- WebCore::ResourceResponse* response = new WebCore::ResourceResponse(
- kurl, mimeTypeStr, (long long)expectedLength,
- encodingStr, WTF::String());
- response->setHTTPStatusCode(statusCode);
- if (statusText) {
- WTF::String status = jstringToWtfString(env, statusText);
- response->setHTTPStatusText(status);
- ALOGV("Response setStatusText: %s", status.latin1().data());
- }
- return (int)response;
-}
-
-void WebCoreResourceLoader::ReceivedResponse(JNIEnv* env, jobject obj, jint nativeResponse)
-{
- WebCore::ResourceHandle* handle = GET_NATIVE_HANDLE(env, obj);
- ALOG_ASSERT(handle, "nativeReceivedResponse must take a valid handle!");
- // ResourceLoader::didFail() can set handle to be NULL, we need to check
- if (!handle)
- return;
-
- WebCore::ResourceResponse* response = (WebCore::ResourceResponse*)nativeResponse;
- ALOG_ASSERT(response, "nativeReceivedResponse must take a valid resource pointer!");
- handle->client()->didReceiveResponse(handle, *response);
- // As the client makes a copy of the response, delete it here.
- delete response;
-}
-
-void WebCoreResourceLoader::AddData(JNIEnv* env, jobject obj, jbyteArray dataArray, jint length)
-{
- ALOGV("webcore_resourceloader data(%d)", length);
-
- WebCore::ResourceHandle* handle = GET_NATIVE_HANDLE(env, obj);
- ALOG_ASSERT(handle, "nativeAddData must take a valid handle!");
- // ResourceLoader::didFail() can set handle to be NULL, we need to check
- if (!handle)
- return;
-
- SkAutoMemoryUsageProbe mup("android_webcore_resourceloader_nativeAddData");
-
- bool result = false;
- jbyte * data = env->GetByteArrayElements(dataArray, NULL);
-
- ALOG_ASSERT(handle->client(), "Why do we not have a client?");
- handle->client()->didReceiveData(handle, (const char *)data, length, length);
- env->ReleaseByteArrayElements(dataArray, data, JNI_ABORT);
-}
-
-void WebCoreResourceLoader::Finished(JNIEnv* env, jobject obj)
-{
- ALOGV("webcore_resourceloader finished");
- WebCore::ResourceHandle* handle = GET_NATIVE_HANDLE(env, obj);
- ALOG_ASSERT(handle, "nativeFinished must take a valid handle!");
- // ResourceLoader::didFail() can set handle to be NULL, we need to check
- if (!handle)
- return;
-
- ALOG_ASSERT(handle->client(), "Why do we not have a client?");
- handle->client()->didFinishLoading(handle, 0);
-}
-
-jstring WebCoreResourceLoader::RedirectedToUrl(JNIEnv* env, jobject obj,
- jstring baseUrl, jstring redirectTo, jint nativeResponse)
-{
- ALOGV("webcore_resourceloader redirectedToUrl");
- WebCore::ResourceHandle* handle = GET_NATIVE_HANDLE(env, obj);
- ALOG_ASSERT(handle, "nativeRedirectedToUrl must take a valid handle!");
- // ResourceLoader::didFail() can set handle to be NULL, we need to check
- if (!handle)
- return NULL;
-
- ALOG_ASSERT(handle->client(), "Why do we not have a client?");
- WebCore::ResourceRequest r = handle->firstRequest();
- WebCore::KURL url(WebCore::KURL(WebCore::ParsedURLString, jstringToWtfString(env, baseUrl)),
- jstringToWtfString(env, redirectTo));
- WebCore::ResourceResponse* response = (WebCore::ResourceResponse*)nativeResponse;
- // If the url fails to resolve the relative path, return null.
- if (url.protocol().isEmpty()) {
- delete response;
- return NULL;
- } else {
- // Ensure the protocol is lowercase.
- url.setProtocol(url.protocol().lower());
- }
- // Set the url after updating the protocol.
- r.setURL(url);
- if (r.httpMethod() == "POST") {
- r.setHTTPMethod("GET");
- r.clearHTTPReferrer();
- r.setHTTPBody(0);
- r.setHTTPContentType("");
- }
- handle->client()->willSendRequest(handle, r, *response);
- delete response;
- return wtfStringToJstring(env, url.string());
-}
-
-void WebCoreResourceLoader::Error(JNIEnv* env, jobject obj, jint id, jstring description,
- jstring failingUrl)
-{
- ALOGV("webcore_resourceloader error");
- WebCore::ResourceHandle* handle = GET_NATIVE_HANDLE(env, obj);
- ALOG_ASSERT(handle, "nativeError must take a valid handle!");
- // ResourceLoader::didFail() can set handle to be NULL, we need to check
- if (!handle)
- return;
-
- handle->client()->didFail(handle, WebCore::ResourceError("", id,
- jstringToWtfString(env, failingUrl), jstringToWtfString(env, description)));
-}
-
-// ----------------------------------------------------------------------------
-
-/*
- * JNI registration.
- */
-static JNINativeMethod gResourceloaderMethods[] = {
- /* name, signature, funcPtr */
- { "nativeSetResponseHeader", "(ILjava/lang/String;Ljava/lang/String;)V",
- (void*) WebCoreResourceLoader::SetResponseHeader },
- { "nativeCreateResponse", "(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;JLjava/lang/String;)I",
- (void*) WebCoreResourceLoader::CreateResponse },
- { "nativeReceivedResponse", "(I)V",
- (void*) WebCoreResourceLoader::ReceivedResponse },
- { "nativeAddData", "([BI)V",
- (void*) WebCoreResourceLoader::AddData },
- { "nativeFinished", "()V",
- (void*) WebCoreResourceLoader::Finished },
- { "nativeRedirectedToUrl", "(Ljava/lang/String;Ljava/lang/String;I)Ljava/lang/String;",
- (void*) WebCoreResourceLoader::RedirectedToUrl },
- { "nativeError", "(ILjava/lang/String;Ljava/lang/String;)V",
- (void*) WebCoreResourceLoader::Error }
-};
-
-int registerResourceLoader(JNIEnv* env)
-{
- jclass resourceLoader = env->FindClass("android/webkit/LoadListener");
- LOG_FATAL_IF(resourceLoader == NULL,
- "Unable to find class android/webkit/LoadListener");
-
- gResourceLoader.mObject =
- env->GetFieldID(resourceLoader, "mNativeLoader", "I");
- LOG_FATAL_IF(gResourceLoader.mObject == NULL,
- "Unable to find android/webkit/LoadListener.mNativeLoader");
-
- gResourceLoader.mCancelMethodID =
- env->GetMethodID(resourceLoader, "cancel", "()V");
- LOG_FATAL_IF(gResourceLoader.mCancelMethodID == NULL,
- "Could not find method cancel on LoadListener");
-
- gResourceLoader.mDownloadFileMethodID =
- env->GetMethodID(resourceLoader, "downloadFile", "()V");
- LOG_FATAL_IF(gResourceLoader.mDownloadFileMethodID == NULL,
- "Could not find method downloadFile on LoadListener");
-
- gResourceLoader.mPauseLoadMethodID =
- env->GetMethodID(resourceLoader, "pauseLoad", "(Z)V");
- LOG_FATAL_IF(gResourceLoader.mPauseLoadMethodID == NULL,
- "Could not find method pauseLoad on LoadListener");
-
- gResourceLoader.mWillLoadFromCacheMethodID =
- env->GetStaticMethodID(resourceLoader, "willLoadFromCache", "(Ljava/lang/String;J)Z");
- LOG_FATAL_IF(gResourceLoader.mWillLoadFromCacheMethodID == NULL,
- "Could not find static method willLoadFromCache on LoadListener");
-
- env->DeleteLocalRef(resourceLoader);
-
- return jniRegisterNativeMethods(env, "android/webkit/LoadListener",
- gResourceloaderMethods, NELEM(gResourceloaderMethods));
-}
-
-} /* namespace android */
diff --git a/Source/WebKit/android/jni/WebCoreResourceLoader.h b/Source/WebKit/android/jni/WebCoreResourceLoader.h
deleted file mode 100644
index 0e34a5b..0000000
--- a/Source/WebKit/android/jni/WebCoreResourceLoader.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2006, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WebCoreResourceLoader_h
-#define WebCoreResourceLoader_h
-
-#include <KURL.h>
-#include <ResourceLoaderAndroid.h>
-#include <jni.h>
-
-namespace android {
-
-class WebCoreResourceLoader : public WebCore::ResourceLoaderAndroid
-{
-public:
- static PassRefPtr<WebCore::ResourceLoaderAndroid> create(JNIEnv *env, jobject jLoadListener);
- virtual ~WebCoreResourceLoader();
-
- /**
- * Call to java to cancel the current load.
- */
- virtual void cancel();
-
- /**
- * Call to java to download the current load rather than feed it
- * back to WebCore
- */
- virtual void downloadFile();
-
- virtual void pauseLoad(bool);
-
- /**
- * Call to java to find out if this URL is in the cache
- */
- static bool willLoadFromCache(const WebCore::KURL& url, int64_t identifier);
-
- // Native jni functions
- static void SetResponseHeader(JNIEnv*, jobject, jint, jstring, jstring);
- static jint CreateResponse(JNIEnv*, jobject, jstring, jint, jstring,
- jstring, jlong, jstring);
- static void ReceivedResponse(JNIEnv*, jobject, jint);
- static void AddData(JNIEnv*, jobject, jbyteArray, jint);
- static void Finished(JNIEnv*, jobject);
- static jstring RedirectedToUrl(JNIEnv*, jobject, jstring, jstring, jint);
- static void Error(JNIEnv*, jobject, jint, jstring, jstring);
-
-protected:
- WebCoreResourceLoader(JNIEnv *env, jobject jLoadListener);
-private:
- jobject mJLoader;
- bool mPausedLoad;
-};
-
-} // end namespace android
-
-#endif
diff --git a/Source/WebKit/android/jni/WebSettings.cpp b/Source/WebKit/android/jni/WebSettings.cpp
index 9f7c2fa..281e8ed 100644
--- a/Source/WebKit/android/jni/WebSettings.cpp
+++ b/Source/WebKit/android/jni/WebSettings.cpp
@@ -144,9 +144,7 @@ struct FieldIds {
mAutoFillProfilePhoneNumber = env->GetFieldID(autoFillProfileClass, "mPhoneNumber", "Ljava/lang/String;");
env->DeleteLocalRef(autoFillProfileClass);
#endif
-#if USE(CHROME_NETWORK_STACK)
mOverrideCacheMode = env->GetFieldID(clazz, "mOverrideCacheMode", "I");
-#endif
ALOG_ASSERT(mLayoutAlgorithm, "Could not find field mLayoutAlgorithm");
ALOG_ASSERT(mTextSize, "Could not find field mTextSize");
@@ -265,9 +263,7 @@ struct FieldIds {
jfieldID mAutoFillProfileCountry;
jfieldID mAutoFillProfilePhoneNumber;
#endif
-#if USE(CHROME_NETWORK_STACK)
jfieldID mOverrideCacheMode;
-#endif
};
static struct FieldIds* gFieldIds;
@@ -367,7 +363,6 @@ public:
str = (jstring)env->GetObjectField(obj, gFieldIds->mUserAgent);
WebFrame::getWebFrame(pFrame)->setUserAgent(jstringToWtfString(env, str));
-#if USE(CHROME_NETWORK_STACK)
WebViewCore::getWebViewCore(pFrame->view())->setWebRequestContextUserAgent();
jint cacheMode = env->GetIntField(obj, gFieldIds->mOverrideCacheMode);
@@ -375,7 +370,6 @@ public:
str = (jstring)env->GetObjectField(obj, gFieldIds->mAcceptLanguage);
WebRequestContext::setAcceptLanguage(jstringToWtfString(env, str));
-#endif
jint size = env->GetIntField(obj, gFieldIds->mMinimumFontSize);
s->setMinimumFontSize(size);
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp
index 4efe0d5..1c8d0d0 100644
--- a/Source/WebKit/android/jni/WebViewCore.cpp
+++ b/Source/WebKit/android/jni/WebViewCore.cpp
@@ -385,9 +385,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m
#if ENABLE(TOUCH_EVENTS)
, m_forwardingTouchEvents(false)
#endif
-#if USE(CHROME_NETWORK_STACK)
, m_webRequestContext(0)
-#endif
{
ALOG_ASSERT(m_mainFrame, "Uh oh, somehow a frameview was made without an initial frame!");
@@ -459,9 +457,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m
WebViewCore::addInstance(this);
-#if USE(CHROME_NETWORK_STACK)
AndroidNetworkLibraryImpl::InitWithApplicationContext(env, 0);
-#endif
// Static initialisation of certain important V8 static data gets performed at system startup when
// libwebcore gets loaded. We now need to associate the WebCore thread with V8 to complete
@@ -4153,7 +4149,6 @@ bool WebViewCore::drawIsPaused() const
return false;
}
-#if USE(CHROME_NETWORK_STACK)
void WebViewCore::setWebRequestContextUserAgent()
{
// We cannot create a WebRequestContext, because we might not know it this is a private tab or not yet
@@ -4181,7 +4176,6 @@ WebRequestContext* WebViewCore::webRequestContext()
}
return m_webRequestContext.get();
}
-#endif
void WebViewCore::scrollRenderLayer(int layer, const SkRect& rect)
{
@@ -5010,10 +5004,8 @@ static void AutoFillForm(JNIEnv* env, jobject obj, jint nativeClass,
static void CloseIdleConnections(JNIEnv* env, jobject obj, jint nativeClass)
{
-#if USE(CHROME_NETWORK_STACK)
WebCache::get(true)->closeIdleConnections();
WebCache::get(false)->closeIdleConnections();
-#endif
}
static void nativeCertTrustChanged(JNIEnv *env, jobject obj)
diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h
index 315b024..0532742 100644
--- a/Source/WebKit/android/jni/WebViewCore.h
+++ b/Source/WebKit/android/jni/WebViewCore.h
@@ -584,11 +584,9 @@ namespace android {
// The actual content (without title bar) size in doc coordinate
int screenWidth() const { return m_screenWidth; }
int screenHeight() const { return m_screenHeight; }
-#if USE(CHROME_NETWORK_STACK)
void setWebRequestContextUserAgent();
void setWebRequestContextCacheMode(int mode);
WebRequestContext* webRequestContext();
-#endif
// Attempts to scroll the layer to the x,y coordinates of rect. The
// layer is the id of the LayerAndroid.
void scrollRenderLayer(int layer, const SkRect& rect);
@@ -783,10 +781,7 @@ namespace android {
bool m_forwardingTouchEvents;
#endif
-#if USE(CHROME_NETWORK_STACK)
scoped_refptr<WebRequestContext> m_webRequestContext;
-#endif
-
};
} // namespace android