summaryrefslogtreecommitdiffstats
path: root/WebKit/android/jni/WebSettings.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-09-10 22:00:37 +0100
committerSteve Block <steveblock@google.com>2010-09-28 19:09:59 +0100
commit3978ee5f7771518f1c2650dfe39033c2fecc09fe (patch)
treefe7f375b1a3f3ae651670d289740c2e5257e0da3 /WebKit/android/jni/WebSettings.cpp
parentcd0967466be49b8ea06b49a79f790e267e1adb66 (diff)
downloadexternal_webkit-3978ee5f7771518f1c2650dfe39033c2fecc09fe.zip
external_webkit-3978ee5f7771518f1c2650dfe39033c2fecc09fe.tar.gz
external_webkit-3978ee5f7771518f1c2650dfe39033c2fecc09fe.tar.bz2
Turn autofill on by default at compile time and make it a browser setting.
Make autofill a runtime option configured through the browser. Required a corresponding change in frameworks/base - https://android-git.corp.google.com/g/65573 and packages/apps/browser - https://android-git.corp.google.com/g/65579 Change-Id: I905b464a6338ff27b02f16d0b9a718154c3c98c1
Diffstat (limited to 'WebKit/android/jni/WebSettings.cpp')
-rw-r--r--WebKit/android/jni/WebSettings.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/WebKit/android/jni/WebSettings.cpp b/WebKit/android/jni/WebSettings.cpp
index 29d72e4..ff6a482 100644
--- a/WebKit/android/jni/WebSettings.cpp
+++ b/WebKit/android/jni/WebSettings.cpp
@@ -34,6 +34,7 @@
#include "DatabaseTracker.h"
#include "Database.h"
#include "Document.h"
+#include "EditorClientAndroid.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameView.h"
@@ -122,6 +123,9 @@ struct FieldIds {
mSyntheticLinksEnabled = env->GetFieldID(clazz, "mSyntheticLinksEnabled", "Z");
mUseDoubleTree = env->GetFieldID(clazz, "mUseDoubleTree", "Z");
mPageCacheCapacity = env->GetFieldID(clazz, "mPageCacheCapacity", "I");
+#if ENABLE(WEB_AUTOFILL)
+ mAutoFillEnabled = env->GetFieldID(clazz, "mAutoFillEnabled", "Z");
+#endif
LOG_ASSERT(mLayoutAlgorithm, "Could not find field mLayoutAlgorithm");
LOG_ASSERT(mTextSize, "Could not find field mTextSize");
@@ -226,6 +230,9 @@ struct FieldIds {
jfieldID mDatabasePath;
jfieldID mDatabasePathHasBeenSet;
#endif
+#if ENABLE(WEB_AUTOFILL)
+ jfieldID mAutoFillEnabled;
+#endif
};
static struct FieldIds* gFieldIds;
@@ -426,6 +433,26 @@ public:
WebCore::pageCache()->setCapacity(size);
} else
s->setUsesPageCache(false);
+
+#if ENABLE(WEB_AUTOFILL)
+ flag = env->GetBooleanField(obj, gFieldIds->mAutoFillEnabled);
+ // TODO: This updates the Settings WebCore side with the user's
+ // preference for autofill and will stop WebCore making requests
+ // into the chromium autofill code. That code in Chromium also has
+ // a notion of being enabled/disabled that gets read from the users
+ // preferences. At the moment, it's hardcoded to true on Android
+ // (see chrome/browser/autofill/autofill_manager.cc:405). This
+ // setting should probably be synced into Chromium also.
+
+ // If we toggle from disabled to enabled, then re search the document
+ // for forms.
+ bool oldAutoFillSetting = s->autoFillEnabled();
+ s->setAutoFillEnabled(flag);
+ if (!oldAutoFillSetting && flag) {
+ EditorClientAndroid* editorC = static_cast<EditorClientAndroid*>(pFrame->page()->editorClient());
+ editorC->getAutoFill()->searchDocument(pFrame->document());
+ }
+#endif
}
};