diff options
Diffstat (limited to 'Source/WebKit/android/jni/WebSettings.cpp')
-rw-r--r-- | Source/WebKit/android/jni/WebSettings.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/Source/WebKit/android/jni/WebSettings.cpp b/Source/WebKit/android/jni/WebSettings.cpp index 1bd3e36..6aff63e 100644 --- a/Source/WebKit/android/jni/WebSettings.cpp +++ b/Source/WebKit/android/jni/WebSettings.cpp @@ -1,5 +1,7 @@ /* * Copyright 2007, The Android Open Source Project + * Copyright (c) 2011, 2012 Code Aurora Forum. All rights reserved. + * Copyright (C) 2011, Sony Ericsson Mobile Communications AB * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -133,6 +135,9 @@ struct FieldIds { mSyntheticLinksEnabled = env->GetFieldID(clazz, "mSyntheticLinksEnabled", "Z"); mUseDoubleTree = env->GetFieldID(clazz, "mUseDoubleTree", "Z"); mPageCacheCapacity = env->GetFieldID(clazz, "mPageCacheCapacity", "I"); +#if ENABLE(WEBGL) + mWebGLEnabled = env->GetFieldID(clazz, "mWebGLEnabled", "Z"); +#endif #if ENABLE(WEB_AUTOFILL) mAutoFillEnabled = env->GetFieldID(clazz, "mAutoFillEnabled", "Z"); mAutoFillProfile = env->GetFieldID(clazz, "mAutoFillProfile", "Landroid/webkit/WebSettingsClassic$AutoFillProfile;"); @@ -197,6 +202,9 @@ struct FieldIds { ALOG_ASSERT(mPageCacheCapacity, "Could not find field mPageCacheCapacity"); ALOG_ASSERT(mPasswordEchoEnabled, "Could not find field mPasswordEchoEnabled"); ALOG_ASSERT(mMediaPlaybackRequiresUserGesture, "Could not find field mMediaPlaybackRequiresUserGesture"); +#if ENABLE(WEBGL) + ALOG_ASSERT(mWebGLEnabled, "Could not find field mWebGLEnabled"); +#endif jclass enumClass = env->FindClass("java/lang/Enum"); ALOG_ASSERT(enumClass, "Could not find Enum class!"); @@ -247,6 +255,9 @@ struct FieldIds { jfieldID mSyntheticLinksEnabled; jfieldID mUseDoubleTree; jfieldID mPageCacheCapacity; +#if ENABLE(WEBGL) + jfieldID mWebGLEnabled; +#endif // Ordinal() method and value field for enums jmethodID mOrdinal; jfieldID mTextSizeValue; @@ -584,6 +595,11 @@ public: } else s->setUsesPageCache(false); +#if ENABLE(WEBGL) + flag = env->GetBooleanField(obj, gFieldIds->mWebGLEnabled); + s->setWebGLEnabled(flag); +#endif + #if ENABLE(WEB_AUTOFILL) flag = env->GetBooleanField(obj, gFieldIds->mAutoFillEnabled); // TODO: This updates the Settings WebCore side with the user's @@ -623,8 +639,16 @@ public: flag = env->GetBooleanField(obj, gFieldIds->mMediaPlaybackRequiresUserGesture); s->setMediaPlaybackRequiresUserGesture(flag); } -}; + static bool IsWebGLAvailable(JNIEnv* env, jobject obj) + { +#if !ENABLE(WEBGL) + return false; +#else + return true; +#endif + } +}; //------------------------------------------------------------- // JNI registration @@ -632,7 +656,9 @@ public: static JNINativeMethod gWebSettingsMethods[] = { { "nativeSync", "(I)V", - (void*) WebSettings::Sync } + (void*) WebSettings::Sync }, + { "nativeIsWebGLAvailable", "()Z", + (void*) WebSettings::IsWebGLAvailable } }; int registerWebSettings(JNIEnv* env) |