summaryrefslogtreecommitdiffstats
path: root/chrome/browser
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 /chrome/browser
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 'chrome/browser')
-rw-r--r--chrome/browser/autofill_manager.cc4
-rw-r--r--chrome/browser/autofill_manager.h7
-rw-r--r--chrome/browser/password_manager/password_manager.cc11
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc2
-rw-r--r--chrome/browser/renderer_host/render_view_host.h7
-rw-r--r--chrome/browser/renderer_host/render_view_host_delegate.h4
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc2
-rw-r--r--chrome/browser/tab_contents/tab_contents.h8
-rw-r--r--chrome/browser/webdata/web_data_service.cc1
-rw-r--r--chrome/browser/webdata/web_data_service.h4
-rw-r--r--chrome/browser/webdata/web_database.cc1
-rw-r--r--chrome/browser/webdata/web_database.h16
-rw-r--r--chrome/browser/webdata/web_database_unittest.cc1
13 files changed, 43 insertions, 25 deletions
diff --git a/chrome/browser/autofill_manager.cc b/chrome/browser/autofill_manager.cc
index 441d708..3e87674 100644
--- a/chrome/browser/autofill_manager.cc
+++ b/chrome/browser/autofill_manager.cc
@@ -46,7 +46,7 @@ Profile* AutofillManager::profile() {
return tab_contents_->profile();
}
-void AutofillManager::AutofillFormSubmitted(const AutofillForm& form) {
+void AutofillManager::AutofillFormSubmitted(const webkit_glue::AutofillForm& form) {
StoreFormEntriesInWebDatabase(form);
}
@@ -117,7 +117,7 @@ void AutofillManager::OnWebDataServiceRequestDone(WebDataService::Handle h,
}
void AutofillManager::StoreFormEntriesInWebDatabase(
- const AutofillForm& form) {
+ const webkit_glue::AutofillForm& form) {
if (!*form_autofill_enabled_)
return;
diff --git a/chrome/browser/autofill_manager.h b/chrome/browser/autofill_manager.h
index 020c2ce..06320fc 100644
--- a/chrome/browser/autofill_manager.h
+++ b/chrome/browser/autofill_manager.h
@@ -10,7 +10,10 @@
#include "chrome/browser/webdata/web_data_service.h"
#include "chrome/common/pref_member.h"
+namespace webkit_glue {
class AutofillForm;
+}
+
class Profile;
class TabContents;
@@ -27,7 +30,7 @@ class AutofillManager : public WebDataServiceConsumer {
// Called when a form is submitted (i.e. when the user hits the submit button)
// to store the form entries in the profile's sql database.
- void AutofillFormSubmitted(const AutofillForm& form);
+ void AutofillFormSubmitted(const webkit_glue::AutofillForm& form);
// Starts a query into the database for the values corresponding to name.
// OnWebDataServiceRequestDone gets called when the query completes.
@@ -47,7 +50,7 @@ class AutofillManager : public WebDataServiceConsumer {
static void RegisterUserPrefs(PrefService* prefs);
private:
- void StoreFormEntriesInWebDatabase(const AutofillForm& form);
+ void StoreFormEntriesInWebDatabase(const webkit_glue::AutofillForm& form);
TabContents* tab_contents_;
diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc
index e09aa08..5566e99 100644
--- a/chrome/browser/password_manager/password_manager.cc
+++ b/chrome/browser/password_manager/password_manager.cc
@@ -226,11 +226,12 @@ void PasswordManager::Autofill(
// schemed password form may have been freed, so we need to distinguish.
bool action_mismatch = form_for_autofill.action.GetWithEmptyPath() !=
preferred_match->action.GetWithEmptyPath();
- PasswordFormDomManager::FillData fill_data;
- PasswordFormDomManager::InitFillData(form_for_autofill,
- best_matches, preferred_match,
- action_mismatch,
- &fill_data);
+ webkit_glue::PasswordFormDomManager::FillData fill_data;
+ webkit_glue::PasswordFormDomManager::InitFillData(form_for_autofill,
+ best_matches,
+ preferred_match,
+ action_mismatch,
+ &fill_data);
tab_contents_->render_view_host()->FillPasswordForm(fill_data);
return;
}
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index dff92be..fff947a 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -48,6 +48,8 @@
#endif
using base::TimeDelta;
+using webkit_glue::AutofillForm;
+using webkit_glue::PasswordFormDomManager;
using WebKit::WebConsoleMessage;
using WebKit::WebFindOptions;
using WebKit::WebInputEvent;
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index 8759231..8773323 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -19,7 +19,6 @@
#include "webkit/glue/password_form_dom_manager.h"
#include "webkit/glue/window_open_disposition.h"
-class AutofillForm;
class NavigationEntry;
class RenderViewHostDelegate;
class SiteInstance;
@@ -44,6 +43,7 @@ enum LoadState;
}
namespace webkit_glue {
+class AutofillForm;
struct WebApplicationInfo;
}
@@ -213,7 +213,8 @@ class RenderViewHost : public RenderWidgetHost {
// Fill out a password form and trigger DOM autocomplete in the case
// of multiple matching logins.
- void FillPasswordForm(const PasswordFormDomManager::FillData& form_data);
+ void FillPasswordForm(
+ const webkit_glue::PasswordFormDomManager::FillData& form_data);
// D&d drop target messages that get sent to WebKit.
void DragTargetDragEnter(const WebDropData& drop_data,
@@ -518,7 +519,7 @@ class RenderViewHost : public RenderWidgetHost {
const std::string& json_arguments,
IPC::Message* reply_msg);
void OnMsgPasswordFormsSeen(const std::vector<PasswordForm>& forms);
- void OnMsgAutofillFormSubmitted(const AutofillForm& forms);
+ void OnMsgAutofillFormSubmitted(const webkit_glue::AutofillForm& forms);
void OnMsgStartDragging(const WebDropData& drop_data);
void OnUpdateDragCursor(bool is_drop_target);
void OnTakeFocus(bool reverse);
diff --git a/chrome/browser/renderer_host/render_view_host_delegate.h b/chrome/browser/renderer_host/render_view_host_delegate.h
index 0626b5e..52a72c7 100644
--- a/chrome/browser/renderer_host/render_view_host_delegate.h
+++ b/chrome/browser/renderer_host/render_view_host_delegate.h
@@ -21,7 +21,6 @@
#include "chrome/browser/extensions/extension_function_dispatcher.h"
-class AutofillForm;
class ExtensionFunctionDispatcher;
class NavigationEntry;
class Profile;
@@ -45,6 +44,7 @@ class Message;
}
namespace webkit_glue {
+class AutofillForm;
struct WebApplicationInfo;
}
@@ -329,7 +329,7 @@ class RenderViewHostDelegate {
virtual void PasswordFormsSeen(const std::vector<PasswordForm>& forms) { }
// Forms fillable by autofill have been detected in the page.
- virtual void AutofillFormSubmitted(const AutofillForm& form) { }
+ virtual void AutofillFormSubmitted(const webkit_glue::AutofillForm& form) { }
// Called to retrieve a list of suggestions from the web database given
// the name of the field |field_name| and what the user has already typed in
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 06ffba6..0ccd724 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -1960,7 +1960,7 @@ void TabContents::PasswordFormsSeen(
}
void TabContents::AutofillFormSubmitted(
- const AutofillForm& form) {
+ const webkit_glue::AutofillForm& form) {
GetAutofillManager()->AutofillFormSubmitted(form);
}
diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h
index c496b51..d57f221 100644
--- a/chrome/browser/tab_contents/tab_contents.h
+++ b/chrome/browser/tab_contents/tab_contents.h
@@ -48,20 +48,24 @@ namespace gfx {
class Rect;
class Size;
}
+
namespace views {
class WindowDelegate;
}
+
namespace base {
class WaitableEvent;
}
+
namespace webkit_glue {
+class AutofillForm;
struct WebApplicationInfo;
}
+
namespace IPC {
class Message;
}
-class AutofillForm;
class AutofillManager;
class BlockedPopupContainer;
class DOMUI;
@@ -801,7 +805,7 @@ class TabContents : public PageNavigator,
const std::string& json_arguments,
IPC::Message* reply_msg);
virtual void PasswordFormsSeen(const std::vector<PasswordForm>& forms);
- virtual void AutofillFormSubmitted(const AutofillForm& form);
+ virtual void AutofillFormSubmitted(const webkit_glue::AutofillForm& form);
virtual void GetAutofillSuggestions(const std::wstring& field_name,
const std::wstring& user_text, int64 node_id, int request_id);
virtual void RemoveAutofillEntry(const std::wstring& field_name,
diff --git a/chrome/browser/webdata/web_data_service.cc b/chrome/browser/webdata/web_data_service.cc
index e514847..7dbf1eb 100644
--- a/chrome/browser/webdata/web_data_service.cc
+++ b/chrome/browser/webdata/web_data_service.cc
@@ -19,6 +19,7 @@
////////////////////////////////////////////////////////////////////////////////
using base::Time;
+using webkit_glue::AutofillForm;
WebDataService::WebDataService() : thread_(NULL),
db_(NULL),
diff --git a/chrome/browser/webdata/web_data_service.h b/chrome/browser/webdata/web_data_service.h
index 4c38e1b..212e958 100644
--- a/chrome/browser/webdata/web_data_service.h
+++ b/chrome/browser/webdata/web_data_service.h
@@ -368,7 +368,7 @@ class WebDataService : public base::RefCountedThreadSafe<WebDataService> {
// Schedules a task to add form elements to the web database.
void AddAutofillFormElements(
- const std::vector<AutofillForm::Element>& elements);
+ const std::vector<webkit_glue::AutofillForm::Element>& elements);
// Initiates the request for a vector of values which have been entered in
// form input fields named |name|. The method OnWebDataServiceRequestDone of
@@ -457,7 +457,7 @@ class WebDataService : public base::RefCountedThreadSafe<WebDataService> {
//
//////////////////////////////////////////////////////////////////////////////
void AddAutofillFormElementsImpl(
- GenericRequest<std::vector<AutofillForm::Element> >* request);
+ GenericRequest<std::vector<webkit_glue::AutofillForm::Element> >* request);
void GetFormValuesForElementNameImpl(WebDataRequest* request,
const std::wstring& name, const std::wstring& prefix, int limit);
void RemoveFormElementsAddedBetweenImpl(
diff --git a/chrome/browser/webdata/web_database.cc b/chrome/browser/webdata/web_database.cc
index e6a1731..8914906 100644
--- a/chrome/browser/webdata/web_database.cc
+++ b/chrome/browser/webdata/web_database.cc
@@ -94,6 +94,7 @@
////////////////////////////////////////////////////////////////////////////////
using base::Time;
+using webkit_glue::AutofillForm;
// Current version number.
static const int kCurrentVersionNumber = 22;
diff --git a/chrome/browser/webdata/web_database.h b/chrome/browser/webdata/web_database.h
index 3b5197b..c4d0d23 100644
--- a/chrome/browser/webdata/web_database.h
+++ b/chrome/browser/webdata/web_database.h
@@ -127,10 +127,11 @@ class WebDatabase {
// Records the form elements in |elements| in the database in the autofill
// table.
bool AddAutofillFormElements(
- const std::vector<AutofillForm::Element>& elements);
+ const std::vector<webkit_glue::AutofillForm::Element>& elements);
// Records a single form element in in the database in the autofill table.
- bool AddAutofillFormElement(const AutofillForm::Element& element);
+ bool AddAutofillFormElement(
+ const webkit_glue::AutofillForm::Element& element);
// Retrieves a vector of all values which have been recorded in the autofill
// table as the value in a form element with name |name| and which start with
@@ -160,9 +161,10 @@ class WebDatabase {
// Gets the pair_id and count entries from name and value specified in
// |element|. Sets *count to 0 if there is no such row in the table.
- bool GetIDAndCountOfFormElement(const AutofillForm::Element& element,
- int64* pair_id,
- int* count) const;
+ bool GetIDAndCountOfFormElement(
+ const webkit_glue::AutofillForm::Element& element,
+ int64* pair_id,
+ int* count) const;
// Gets the count only given the pair_id.
bool GetCountOfFormElement(int64 pair_id,
@@ -173,7 +175,9 @@ class WebDatabase {
// Adds a new row to the autofill table with name and value given in
// |element|. Sets *pair_id to the pair_id of the new row.
- bool InsertFormElement(const AutofillForm::Element& element, int64* pair_id);
+ bool InsertFormElement(
+ const webkit_glue::AutofillForm::Element& element,
+ int64* pair_id);
// Adds a new row to the autofill_dates table.
bool InsertPairIDAndDate(int64 pair_id, const base::Time date_created);
diff --git a/chrome/browser/webdata/web_database_unittest.cc b/chrome/browser/webdata/web_database_unittest.cc
index 4c27b1e..a456f91 100644
--- a/chrome/browser/webdata/web_database_unittest.cc
+++ b/chrome/browser/webdata/web_database_unittest.cc
@@ -18,6 +18,7 @@
using base::Time;
using base::TimeDelta;
+using webkit_glue::AutofillForm;
class WebDatabaseTest : public testing::Test {
protected: