summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webframe_impl.cc
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-15 17:21:10 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-15 17:21:10 +0000
commitdaa8c58ee49795d292312bbf217999c93693919c (patch)
tree561a327f148d74b0522871f15103e25a27b841f5 /webkit/glue/webframe_impl.cc
parent0b97342d07fd3ef047432b52809d31d10432ee85 (diff)
downloadchromium_src-daa8c58ee49795d292312bbf217999c93693919c.zip
chromium_src-daa8c58ee49795d292312bbf217999c93693919c.tar.gz
chromium_src-daa8c58ee49795d292312bbf217999c93693919c.tar.bz2
Extract form related classes from the guts of WebFrameImpl.
Instead of having WebFrameImpl generate SearchableFormData, PasswordForm, and AutofillForm classes, allow the embedder (RenderView) to do so. This is done to help minimize the dependencies WebFrameImpl has on other code, which will make it easier to move WebFrame and WebDataSource into the WebKit API. Most significant change: Now, RenderView always sets a NavigationState on WebDataSource instances. We used to only do so for browser initiated navigations. This is done so that we can store things like SearchableFormData and friends on the NavigationState. To facilitate this change, it was necessary to add a way through the WebKit API to refer to a HTMLFormElement. This CL introduces WebForm, which is like a RefPtr<HTMLFormElement>, so you can just copy a WebForm around by value and the right thing happens. Some of the other changes are about moving more things into the webkit_glue namespace. On hindsight, I probably should have done that as a separate CL. BUG=10041 TEST=none R=brettw Review URL: http://codereview.chromium.org/126083 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18395 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webframe_impl.cc')
-rw-r--r--webkit/glue/webframe_impl.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc
index 0d78729..f573dcb 100644
--- a/webkit/glue/webframe_impl.cc
+++ b/webkit/glue/webframe_impl.cc
@@ -142,6 +142,7 @@ MSVC_POP_WARNING();
#include "skia/ext/platform_canvas.h"
#include "webkit/api/public/WebConsoleMessage.h"
#include "webkit/api/public/WebFindOptions.h"
+#include "webkit/api/public/WebForm.h"
#include "webkit/api/public/WebRect.h"
#include "webkit/api/public/WebScriptSource.h"
#include "webkit/api/public/WebSize.h"
@@ -185,6 +186,7 @@ using WebCore::FrameLoadType;
using WebCore::FrameTree;
using WebCore::FrameView;
using WebCore::HistoryItem;
+using WebCore::HTMLFormElement;
using WebCore::IntRect;
using WebCore::KURL;
using WebCore::Node;
@@ -204,6 +206,7 @@ using WebCore::XPathResult;
using WebKit::WebConsoleMessage;
using WebKit::WebFindOptions;
+using WebKit::WebForm;
using WebKit::WebRect;
using WebKit::WebScriptSource;
using WebKit::WebSize;
@@ -750,6 +753,22 @@ WebView* WebFrameImpl::GetView() const {
return GetWebViewImpl();
}
+void WebFrameImpl::GetForms(std::vector<WebForm>* results) const {
+ results->clear();
+ if (!frame_)
+ return;
+ RefPtr<WebCore::HTMLCollection> forms = frame_->document()->forms();
+ unsigned int form_count = forms->length();
+ for (unsigned int i = 0; i < form_count; ++i) {
+ Node* node = forms->item(i);
+ // Strange but true, sometimes item can be NULL.
+ if (node) {
+ results->push_back(webkit_glue::HTMLFormElementToWebForm(
+ static_cast<HTMLFormElement*>(node)));
+ }
+ }
+}
+
std::string WebFrameImpl::GetSecurityOrigin() const {
if (frame_) {
if (frame_->document())