diff options
198 files changed, 1295 insertions, 1541 deletions
@@ -39,18 +39,24 @@ 'filepath': 'ui/aura/|'\ 'ash/', }, + # TODO(blundell): Add any new paths to this file after applying jam's + # comments. 'autofill': { 'filepath': 'chrome/browser/autofill/|'\ 'chrome/browser/resources/options/autofill_|'\ 'chrome/browser/sync/glue/autofill_|'\ 'chrome/browser/ui/webui/options/autofill_|'\ + 'chrome/common/form_|'\ + 'chrome/common/password_|'\ 'chrome/renderer/autofill/|'\ 'chrome/test/data/autofill/|'\ 'chrome/test/data/autofill/heuristics/input/|'\ 'chrome/test/data/autofill/heuristics/output/|'\ 'chrome/test/data/autofill/merge/input/|'\ 'chrome/test/data/autofill/merge/output/|'\ - 'webkit/forms/', + 'content/public/common/password_|'\ + 'content/public/renderer/password_'\ + 'content/renderer/password_', }, 'automation': { 'filepath': 'chrome/browser/automation/|chrome/test/automation/', diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index b57c3f5..a680115 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS @@ -37,7 +37,6 @@ include_rules = [ "+webkit/database", "+webkit/dom_storage", "+webkit/fileapi", - "+webkit/forms", # Defines some types that are marshalled over IPC. "+webkit/plugins", # Defines some types that are marshalled over IPC. "+webkit/quota", "+webkit/user_agent", diff --git a/chrome/browser/api/webdata/autofill_web_data.h b/chrome/browser/api/webdata/autofill_web_data.h index d509dde..35838b4 100644 --- a/chrome/browser/api/webdata/autofill_web_data.h +++ b/chrome/browser/api/webdata/autofill_web_data.h @@ -12,16 +12,11 @@ #include "base/string16.h" #include "chrome/browser/api/webdata/web_data_service_base.h" -namespace webkit { -namespace forms { -struct FormField; -} -} - class AutofillProfile; class CreditCard; class Profile; class WebDataServiceConsumer; +struct FormFieldData; // Pure virtual interface for retrieving Autofill data. API users // should use AutofillWebDataService. @@ -31,7 +26,7 @@ class AutofillWebData { // Schedules a task to add form fields to the web database. virtual void AddFormFields( - const std::vector<webkit::forms::FormField>& fields) = 0; + const std::vector<FormFieldData>& fields) = 0; // Initiates the request for a vector of values which have been entered in // form input fields named |name|. The method OnWebDataServiceRequestDone of diff --git a/chrome/browser/autofill/address_field_unittest.cc b/chrome/browser/autofill/address_field_unittest.cc index 0bc6567..1f3330d 100644 --- a/chrome/browser/autofill/address_field_unittest.cc +++ b/chrome/browser/autofill/address_field_unittest.cc @@ -9,8 +9,8 @@ #include "chrome/browser/autofill/address_field.h" #include "chrome/browser/autofill/autofill_field.h" #include "chrome/browser/autofill/autofill_scanner.h" +#include "chrome/common/form_field_data.h" #include "testing/gtest/include/gtest/gtest.h" -#include "webkit/forms/form_field.h" class AddressFieldTest : public testing::Test { public: @@ -44,7 +44,7 @@ TEST_F(AddressFieldTest, NonParse) { } TEST_F(AddressFieldTest, ParseOneLineAddress) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Address"); @@ -62,7 +62,7 @@ TEST_F(AddressFieldTest, ParseOneLineAddress) { } TEST_F(AddressFieldTest, ParseOneLineAddressBilling) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Address"); @@ -80,7 +80,7 @@ TEST_F(AddressFieldTest, ParseOneLineAddressBilling) { } TEST_F(AddressFieldTest, ParseOneLineAddressShipping) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Address"); @@ -98,7 +98,7 @@ TEST_F(AddressFieldTest, ParseOneLineAddressShipping) { } TEST_F(AddressFieldTest, ParseTwoLineAddress) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Address"); @@ -123,7 +123,7 @@ TEST_F(AddressFieldTest, ParseTwoLineAddress) { } TEST_F(AddressFieldTest, ParseThreeLineAddress) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Address Line1"); @@ -154,7 +154,7 @@ TEST_F(AddressFieldTest, ParseThreeLineAddress) { } TEST_F(AddressFieldTest, ParseCity) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("City"); @@ -172,7 +172,7 @@ TEST_F(AddressFieldTest, ParseCity) { } TEST_F(AddressFieldTest, ParseState) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("State"); @@ -190,7 +190,7 @@ TEST_F(AddressFieldTest, ParseState) { } TEST_F(AddressFieldTest, ParseZip) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Zip"); @@ -208,7 +208,7 @@ TEST_F(AddressFieldTest, ParseZip) { } TEST_F(AddressFieldTest, ParseStateAndZipOneLabel) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("State/Province, Zip/Postal Code"); @@ -233,7 +233,7 @@ TEST_F(AddressFieldTest, ParseStateAndZipOneLabel) { } TEST_F(AddressFieldTest, ParseCountry) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Country"); @@ -251,7 +251,7 @@ TEST_F(AddressFieldTest, ParseCountry) { } TEST_F(AddressFieldTest, ParseTwoLineAddressMissingLabel) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Address"); @@ -276,7 +276,7 @@ TEST_F(AddressFieldTest, ParseTwoLineAddressMissingLabel) { } TEST_F(AddressFieldTest, ParseCompany) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Company"); diff --git a/chrome/browser/autofill/autocomplete_history_manager.cc b/chrome/browser/autofill/autocomplete_history_manager.cc index de2cf6d..4cee493 100644 --- a/chrome/browser/autofill/autocomplete_history_manager.cc +++ b/chrome/browser/autofill/autocomplete_history_manager.cc @@ -13,17 +13,15 @@ #include "chrome/browser/autofill/autofill_external_delegate.h" #include "chrome/browser/autofill/credit_card.h" #include "chrome/common/autofill_messages.h" +#include "chrome/common/form_data.h" #include "chrome/common/pref_names.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" -#include "webkit/forms/form_data.h" using base::StringPiece16; using content::BrowserContext; using content::WebContents; -using webkit::forms::FormData; -using webkit::forms::FormField; DEFINE_WEB_CONTENTS_USER_DATA_KEY(AutocompleteHistoryManager) @@ -98,7 +96,7 @@ bool IsSSN(const string16& text) { return true; } -bool IsTextField(const FormField& field) { +bool IsTextField(const FormFieldData& field) { return field.form_control_type == ASCIIToUTF16("text") || field.form_control_type == ASCIIToUTF16("search") || @@ -209,8 +207,8 @@ void AutocompleteHistoryManager::OnFormSubmitted(const FormData& form) { // - text field // - value is not a credit card number // - value is not a SSN - std::vector<FormField> values; - for (std::vector<FormField>::const_iterator iter = + std::vector<FormFieldData> values; + for (std::vector<FormFieldData>::const_iterator iter = form.fields.begin(); iter != form.fields.end(); ++iter) { if (!iter->value.empty() && diff --git a/chrome/browser/autofill/autocomplete_history_manager.h b/chrome/browser/autofill/autocomplete_history_manager.h index a6a7f5b..a8f39f3 100644 --- a/chrome/browser/autofill/autocomplete_history_manager.h +++ b/chrome/browser/autofill/autocomplete_history_manager.h @@ -14,16 +14,12 @@ #include "chrome/browser/common/web_contents_user_data.h" #include "content/public/browser/web_contents_observer.h" +struct FormData; + namespace content { class BrowserContext; } -namespace webkit { -namespace forms { -struct FormData; -} -} - class AutofillExternalDelegate; // Per-tab Autocomplete history manager. Handles receiving form data @@ -54,7 +50,7 @@ class AutocompleteHistoryManager const std::vector<string16>& autofill_labels, const std::vector<string16>& autofill_icons, const std::vector<int>& autofill_unique_ids); - void OnFormSubmitted(const webkit::forms::FormData& form); + void OnFormSubmitted(const FormData& form); // Must be public for the external delegate to use. void OnRemoveAutocompleteEntry(const string16& name, const string16& value); diff --git a/chrome/browser/autofill/autocomplete_history_manager_unittest.cc b/chrome/browser/autofill/autocomplete_history_manager_unittest.cc index 16799f9..9cc9ade 100644 --- a/chrome/browser/autofill/autocomplete_history_manager_unittest.cc +++ b/chrome/browser/autofill/autocomplete_history_manager_unittest.cc @@ -12,6 +12,7 @@ #include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/webdata/autofill_web_data_service_impl.h" #include "chrome/browser/webdata/web_data_service.h" +#include "chrome/common/form_data.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile.h" @@ -19,17 +20,15 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/rect.h" -#include "webkit/forms/form_data.h" using content::BrowserThread; using content::WebContents; using testing::_; -using webkit::forms::FormData; class MockWebDataService : public WebDataService { public: MOCK_METHOD1(AddFormFields, - void(const std::vector<webkit::forms::FormField>&)); // NOLINT + void(const std::vector<FormFieldData>&)); // NOLINT protected: virtual ~MockWebDataService() {} @@ -71,7 +70,7 @@ TEST_F(AutocompleteHistoryManagerTest, CreditCardNumberValue) { form.user_submitted = true; // Valid Visa credit card number pulled from the paypal help site. - webkit::forms::FormField valid_cc; + FormFieldData valid_cc; valid_cc.label = ASCIIToUTF16("Credit Card"); valid_cc.name = ASCIIToUTF16("ccnum"); valid_cc.value = ASCIIToUTF16("4012888888881881"); @@ -94,7 +93,7 @@ TEST_F(AutocompleteHistoryManagerTest, NonCreditCardNumberValue) { form.user_submitted = true; // Invalid credit card number. - webkit::forms::FormField invalid_cc; + FormFieldData invalid_cc; invalid_cc.label = ASCIIToUTF16("Credit Card"); invalid_cc.name = ASCIIToUTF16("ccnum"); invalid_cc.value = ASCIIToUTF16("4580123456789012"); @@ -114,7 +113,7 @@ TEST_F(AutocompleteHistoryManagerTest, SSNValue) { form.action = GURL("http://myform.com/submit.html"); form.user_submitted = true; - webkit::forms::FormField ssn; + FormFieldData ssn; ssn.label = ASCIIToUTF16("Social Security Number"); ssn.name = ASCIIToUTF16("ssn"); ssn.value = ASCIIToUTF16("078-05-1120"); @@ -135,7 +134,7 @@ TEST_F(AutocompleteHistoryManagerTest, SearchField) { form.user_submitted = true; // Search field. - webkit::forms::FormField search_field; + FormFieldData search_field; search_field.label = ASCIIToUTF16("Search"); search_field.name = ASCIIToUTF16("search"); search_field.value = ASCIIToUTF16("my favorite query"); diff --git a/chrome/browser/autofill/autofill_common_test.cc b/chrome/browser/autofill/autofill_common_test.cc index 194cd02..5c12a58 100644 --- a/chrome/browser/autofill/autofill_common_test.cc +++ b/chrome/browser/autofill/autofill_common_test.cc @@ -10,8 +10,8 @@ #include "chrome/browser/autofill/credit_card.h" #include "chrome/browser/password_manager/encryptor.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/form_field_data.h" #include "chrome/common/pref_names.h" -#include "webkit/forms/form_field.h" namespace autofill_test { @@ -19,7 +19,7 @@ void CreateTestFormField(const char* label, const char* name, const char* value, const char* type, - webkit::forms::FormField* field) { + FormFieldData* field) { field->label = ASCIIToUTF16(label); field->name = ASCIIToUTF16(name); field->value = ASCIIToUTF16(value); diff --git a/chrome/browser/autofill/autofill_common_test.h b/chrome/browser/autofill/autofill_common_test.h index 1207084..8ad2085 100644 --- a/chrome/browser/autofill/autofill_common_test.h +++ b/chrome/browser/autofill/autofill_common_test.h @@ -9,11 +9,7 @@ class AutofillProfile; class CreditCard; class Profile; -namespace webkit { -namespace forms { -struct FormField; -} -} +struct FormFieldData; // Common utilities shared amongst Autofill tests. namespace autofill_test { @@ -23,7 +19,7 @@ void CreateTestFormField(const char* label, const char* name, const char* value, const char* type, - webkit::forms::FormField* field); + FormFieldData* field); // A unit testing utility that is common to a number of the Autofill unit // tests. |SetProfileInfo| provides a quick way to populate a profile with diff --git a/chrome/browser/autofill/autofill_download_unittest.cc b/chrome/browser/autofill/autofill_download_unittest.cc index 1b2169d..51f3740 100644 --- a/chrome/browser/autofill/autofill_download_unittest.cc +++ b/chrome/browser/autofill/autofill_download_unittest.cc @@ -13,6 +13,7 @@ #include "chrome/browser/autofill/autofill_metrics.h" #include "chrome/browser/autofill/autofill_type.h" #include "chrome/browser/autofill/form_structure.h" +#include "chrome/common/form_data.h" #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_browser_thread.h" @@ -21,11 +22,8 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" -#include "webkit/forms/form_data.h" using content::BrowserThread; -using webkit::forms::FormData; -using webkit::forms::FormField; using WebKit::WebInputElement; namespace { @@ -145,7 +143,7 @@ TEST_F(AutofillDownloadTest, QueryAndUploadTest) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.label = ASCIIToUTF16("username"); field.name = ASCIIToUTF16("username"); field.form_control_type = ASCIIToUTF16("text"); @@ -357,7 +355,7 @@ TEST_F(AutofillDownloadTest, CacheQueryTest) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("username"); diff --git a/chrome/browser/autofill/autofill_external_delegate.cc b/chrome/browser/autofill/autofill_external_delegate.cc index b5c9bd2..e762da7 100644 --- a/chrome/browser/autofill/autofill_external_delegate.cc +++ b/chrome/browser/autofill/autofill_external_delegate.cc @@ -42,8 +42,8 @@ void AutofillExternalDelegate::SelectAutofillSuggestionAtIndex(int unique_id) { } void AutofillExternalDelegate::OnQuery(int query_id, - const webkit::forms::FormData& form, - const webkit::forms::FormField& field, + const FormData& form, + const FormFieldData& field, const gfx::Rect& bounds, bool display_warning_if_disabled) { autofill_query_form_ = form; @@ -118,7 +118,7 @@ void AutofillExternalDelegate::OnSuggestionsReturned( void AutofillExternalDelegate::OnShowPasswordSuggestions( const std::vector<string16>& suggestions, - const webkit::forms::FormField& field, + const FormFieldData& field, const gfx::Rect& bounds) { autofill_query_field_ = field; @@ -231,8 +231,8 @@ void AutofillExternalDelegate::Reset() { } void AutofillExternalDelegate::AddPasswordFormMapping( - const webkit::forms::FormField& form, - const webkit::forms::PasswordFormFillData& fill_data) { + const FormFieldData& form, + const PasswordFormFillData& fill_data) { password_autofill_manager_.AddPasswordFormMapping(form, fill_data); } diff --git a/chrome/browser/autofill/autofill_external_delegate.h b/chrome/browser/autofill/autofill_external_delegate.h index 8d853ad..423860a 100644 --- a/chrome/browser/autofill/autofill_external_delegate.h +++ b/chrome/browser/autofill/autofill_external_delegate.h @@ -11,9 +11,9 @@ #include "base/string16.h" #include "chrome/browser/autofill/password_autofill_manager.h" #include "chrome/browser/ui/tab_contents/tab_contents.h" -#include "webkit/forms/form_data.h" -#include "webkit/forms/form_field.h" -#include "webkit/forms/password_form_dom_manager.h" +#include "chrome/common/form_data.h" +#include "chrome/common/form_field_data.h" +#include "chrome/common/password_form_fill_data.h" class AutofillManager; @@ -47,8 +47,8 @@ class AutofillExternalDelegate { // Autocomplete because they have their own popup, and showing our popup // on to of theirs would be a poor user experience. virtual void OnQuery(int query_id, - const webkit::forms::FormData& form, - const webkit::forms::FormField& field, + const FormData& form, + const FormFieldData& field, const gfx::Rect& bounds, bool display_warning_if_disabled); @@ -63,7 +63,7 @@ class AutofillExternalDelegate { // Show password suggestions in the popup. void OnShowPasswordSuggestions(const std::vector<string16>& suggestions, - const webkit::forms::FormField& field, + const FormFieldData& field, const gfx::Rect& bounds); // Set the data list value associated with the current field. @@ -100,8 +100,8 @@ class AutofillExternalDelegate { // Inform the Password Manager of a filled form. void AddPasswordFormMapping( - const webkit::forms::FormField& form, - const webkit::forms::PasswordFormFillData& fill_data); + const FormFieldData& form, + const PasswordFormFillData& fill_data); // Platforms that wish to implement an external Autofill delegate // MUST implement this. The 1st arg is the tab contents that owns @@ -124,8 +124,8 @@ class AutofillExternalDelegate { // Handle instance specific OnQueryCode. virtual void OnQueryPlatformSpecific(int query_id, - const webkit::forms::FormData& form, - const webkit::forms::FormField& field, + const FormData& form, + const FormFieldData& field, const gfx::Rect& bounds) = 0; // Handle platform-dependent hiding. @@ -179,8 +179,8 @@ class AutofillExternalDelegate { int autofill_query_id_; // The current form and field selected by Autofill. - webkit::forms::FormData autofill_query_form_; - webkit::forms::FormField autofill_query_field_; + FormData autofill_query_form_; + FormFieldData autofill_query_field_; // Should we display a warning if Autofill is disabled? bool display_warning_if_disabled_; diff --git a/chrome/browser/autofill/autofill_external_delegate_unittest.cc b/chrome/browser/autofill/autofill_external_delegate_unittest.cc index 0c7c934..282ec0d 100644 --- a/chrome/browser/autofill/autofill_external_delegate_unittest.cc +++ b/chrome/browser/autofill/autofill_external_delegate_unittest.cc @@ -11,19 +11,17 @@ #include "chrome/browser/autofill/test_autofill_external_delegate.h" #include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h" #include "chrome/browser/ui/tab_contents/test_tab_contents.h" +#include "chrome/common/form_data.h" +#include "chrome/common/form_field_data.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" #include "ui/gfx/rect.h" -#include "webkit/forms/form_data.h" -#include "webkit/forms/form_field.h" using content::BrowserThread; using testing::_; -using webkit::forms::FormData; -using webkit::forms::FormField; using WebKit::WebAutofillClient; namespace { @@ -49,8 +47,8 @@ class MockAutofillExternalDelegate : public TestAutofillExternalDelegate { MOCK_METHOD4(OnQueryPlatformSpecific, void(int query_id, - const webkit::forms::FormData& form, - const webkit::forms::FormField& field, + const FormData& form, + const FormFieldData& field, const gfx::Rect& bounds)); MOCK_METHOD0(ClearPreviewedForm, void()); @@ -72,8 +70,8 @@ class MockAutofillManager : public AutofillManager { MOCK_METHOD4(OnFillAutofillFormData, void(int query_id, - const webkit::forms::FormData& form, - const webkit::forms::FormField& field, + const FormData& form, + const FormFieldData& field, int unique_id)); protected: @@ -104,7 +102,7 @@ class AutofillExternalDelegateUnitTest : public TabContentsTestHarness { // execute it with the given QueryId. void IssueOnQuery(int query_id) { const FormData form; - FormField field; + FormFieldData field; field.is_focusable = true; field.should_autocomplete = true; const gfx::Rect bounds; diff --git a/chrome/browser/autofill/autofill_field.cc b/chrome/browser/autofill/autofill_field.cc index 174d88a..55bb725 100644 --- a/chrome/browser/autofill/autofill_field.cc +++ b/chrome/browser/autofill/autofill_field.cc @@ -31,9 +31,9 @@ AutofillField::AutofillField() phone_part_(IGNORED) { } -AutofillField::AutofillField(const webkit::forms::FormField& field, +AutofillField::AutofillField(const FormFieldData& field, const string16& unique_name) - : webkit::forms::FormField(field), + : FormFieldData(field), unique_name_(unique_name), server_type_(NO_SERVER_DATA), heuristic_type_(UNKNOWN_TYPE), diff --git a/chrome/browser/autofill/autofill_field.h b/chrome/browser/autofill/autofill_field.h index e72a89c..797802a 100644 --- a/chrome/browser/autofill/autofill_field.h +++ b/chrome/browser/autofill/autofill_field.h @@ -10,9 +10,9 @@ #include "base/basictypes.h" #include "base/string16.h" #include "chrome/browser/autofill/field_types.h" -#include "webkit/forms/form_field.h" +#include "chrome/common/form_field_data.h" -class AutofillField : public webkit::forms::FormField { +class AutofillField : public FormFieldData { public: enum PhonePart { IGNORED = 0, @@ -21,8 +21,7 @@ class AutofillField : public webkit::forms::FormField { }; AutofillField(); - AutofillField(const webkit::forms::FormField& field, - const string16& unique_name); + AutofillField(const FormFieldData& field, const string16& unique_name); virtual ~AutofillField(); const string16& unique_name() const { return unique_name_; } diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc index 02f53aa..9793ad6 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -42,6 +42,10 @@ #include "chrome/common/autofill_messages.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/form_data.h" +#include "chrome/common/form_data_predictions.h" +#include "chrome/common/form_field_data.h" +#include "chrome/common/password_form_fill_data.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "content/public/browser/browser_context.h" @@ -56,18 +60,11 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/rect.h" -#include "webkit/forms/form_data.h" -#include "webkit/forms/form_data_predictions.h" -#include "webkit/forms/form_field.h" -#include "webkit/forms/password_form_dom_manager.h" using base::TimeTicks; using content::BrowserThread; using content::RenderViewHost; using switches::kEnableAutofillFeedback; -using webkit::forms::FormData; -using webkit::forms::FormDataPredictions; -using webkit::forms::FormField; namespace { @@ -441,7 +438,7 @@ void AutofillManager::OnFormsSeen(const std::vector<FormData>& forms, } void AutofillManager::OnTextFieldDidChange(const FormData& form, - const FormField& field, + const FormFieldData& field, const TimeTicks& timestamp) { FormStructure* form_structure = NULL; AutofillField* autofill_field = NULL; @@ -470,7 +467,7 @@ void AutofillManager::OnTextFieldDidChange(const FormData& form, void AutofillManager::OnQueryFormFieldAutofill(int query_id, const FormData& form, - const FormField& field, + const FormFieldData& field, const gfx::Rect& bounding_box, bool display_warning) { std::vector<string16> values; @@ -564,7 +561,7 @@ void AutofillManager::OnQueryFormFieldAutofill(int query_id, void AutofillManager::OnFillAutofillFormData(int query_id, const FormData& form, - const FormField& field, + const FormFieldData& field, int unique_id) { const std::vector<AutofillProfile*>& profiles = personal_data_->profiles(); const std::vector<CreditCard*>& credit_cards = personal_data_->credit_cards(); @@ -590,7 +587,7 @@ void AutofillManager::OnFillAutofillFormData(int query_id, // If the relevant section is auto-filled, we should fill |field| but not the // rest of the form. if (SectionIsAutofilled(*form_structure, form, autofill_field->section())) { - for (std::vector<FormField>::iterator iter = result.fields.begin(); + for (std::vector<FormFieldData>::iterator iter = result.fields.begin(); iter != result.fields.end(); ++iter) { if ((*iter) == field) { AutofillFieldType field_type = autofill_field->type(); @@ -716,7 +713,7 @@ void AutofillManager::OnHideAutofillPopup() { void AutofillManager::OnShowPasswordGenerationPopup( const gfx::Rect& bounds, int max_length, - const webkit::forms::PasswordForm& form) { + const content::PasswordForm& form) { password_generator_.reset(new autofill::PasswordGenerator(max_length)); manager_delegate_->ShowPasswordGenerationBubble( bounds, form, password_generator_.get()); @@ -747,14 +744,14 @@ void AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) { } void AutofillManager::OnAddPasswordFormMapping( - const webkit::forms::FormField& form, - const webkit::forms::PasswordFormFillData& fill_data) { + const FormFieldData& form, + const PasswordFormFillData& fill_data) { if (external_delegate_) external_delegate_->AddPasswordFormMapping(form, fill_data); } void AutofillManager::OnShowPasswordSuggestions( - const webkit::forms::FormField& field, + const FormFieldData& field, const gfx::Rect& bounds, const std::vector<string16>& suggestions) { if (external_delegate_) @@ -1004,7 +1001,7 @@ bool AutofillManager::FindCachedForm(const FormData& form, } bool AutofillManager::GetCachedFormAndField(const FormData& form, - const FormField& field, + const FormFieldData& field, FormStructure** form_structure, AutofillField** autofill_field) { // Find the FormStructure that corresponds to |form|. @@ -1093,7 +1090,7 @@ bool AutofillManager::UpdateCachedForm(const FormData& live_form, void AutofillManager::GetProfileSuggestions( FormStructure* form, - const FormField& field, + const FormFieldData& field, AutofillFieldType type, std::vector<string16>* values, std::vector<string16>* labels, @@ -1180,7 +1177,7 @@ void AutofillManager::GetProfileSuggestions( void AutofillManager::GetCreditCardSuggestions( FormStructure* form, - const FormField& field, + const FormFieldData& field, AutofillFieldType type, std::vector<string16>* values, std::vector<string16>* labels, @@ -1219,7 +1216,7 @@ void AutofillManager::GetCreditCardSuggestions( void AutofillManager::FillCreditCardFormField(const CreditCard& credit_card, AutofillFieldType type, - FormField* field) { + FormFieldData* field) { DCHECK_EQ(AutofillType::CREDIT_CARD, AutofillType(type).group()); DCHECK(field); @@ -1243,7 +1240,7 @@ void AutofillManager::FillCreditCardFormField(const CreditCard& credit_card, void AutofillManager::FillFormField(const AutofillProfile& profile, const AutofillField& cached_field, size_t variant, - FormField* field) { + FormFieldData* field) { AutofillFieldType type = cached_field.type(); DCHECK_NE(AutofillType::CREDIT_CARD, AutofillType(type).group()); DCHECK(field); @@ -1270,7 +1267,7 @@ void AutofillManager::FillFormField(const AutofillProfile& profile, void AutofillManager::FillPhoneNumberField(const AutofillProfile& profile, const AutofillField& cached_field, size_t variant, - FormField* field) { + FormFieldData* field) { std::vector<string16> values; profile.GetCanonicalizedMultiInfo(cached_field.type(), &values); DCHECK(variant < values.size()); diff --git a/chrome/browser/autofill/autofill_manager.h b/chrome/browser/autofill/autofill_manager.h index 57af9b3..87e2d37 100644 --- a/chrome/browser/autofill/autofill_manager.h +++ b/chrome/browser/autofill/autofill_manager.h @@ -38,6 +38,9 @@ class PrefService; class ProfileSyncService; class TabContents; +struct FormData; +struct FormFieldData; +struct PasswordFormFillData; struct ViewHostMsg_FrameNavigate_Params; namespace autofill { @@ -47,6 +50,7 @@ class PasswordGenerator; namespace content { class RenderViewHost; +struct PasswordForm; } namespace gfx { @@ -57,15 +61,6 @@ namespace IPC { class Message; } -namespace webkit { -namespace forms { -struct FormData; -struct FormField; -struct PasswordForm; -struct PasswordFormFillData; -} -} - // Manages saving and restoring the user's personal information entered into web // forms. class AutofillManager : public content::NotificationObserver, @@ -95,8 +90,8 @@ class AutofillManager : public content::NotificationObserver, // Called from our external delegate so they cannot be private. virtual void OnFillAutofillFormData(int query_id, - const webkit::forms::FormData& form, - const webkit::forms::FormField& field, + const FormData& form, + const FormFieldData& field, int unique_id); void OnDidShowAutofillSuggestions(bool is_new_popup); void OnDidFillAutofillFormData(const base::TimeTicks& timestamp); @@ -104,7 +99,7 @@ class AutofillManager : public content::NotificationObserver, void OnDidPreviewAutofillFormData(); void OnShowPasswordGenerationPopup(const gfx::Rect& bounds, int max_length, - const webkit::forms::PasswordForm& form); + const content::PasswordForm& form); // Remove the credit card or Autofill profile that matches |unique_id| // from the database. @@ -171,7 +166,7 @@ class AutofillManager : public content::NotificationObserver, // Processes the submitted |form|, saving any new Autofill data and uploading // the possible field types for the submitted fields to the crowdsouring // server. Returns false if this form is not relevant for Autofill. - bool OnFormSubmitted(const webkit::forms::FormData& form, + bool OnFormSubmitted(const FormData& form, const base::TimeTicks& timestamp); private: @@ -204,24 +199,24 @@ class AutofillManager : public content::NotificationObserver, void UpdatePasswordGenerationState(content::RenderViewHost* host, bool new_renderer); - void OnFormsSeen(const std::vector<webkit::forms::FormData>& forms, + void OnFormsSeen(const std::vector<FormData>& forms, const base::TimeTicks& timestamp); - void OnTextFieldDidChange(const webkit::forms::FormData& form, - const webkit::forms::FormField& field, + void OnTextFieldDidChange(const FormData& form, + const FormFieldData& field, const base::TimeTicks& timestamp); // The |bounding_box| is a window relative value. void OnQueryFormFieldAutofill(int query_id, - const webkit::forms::FormData& form, - const webkit::forms::FormField& field, + const FormData& form, + const FormFieldData& field, const gfx::Rect& bounding_box, bool display_warning); void OnDidEndTextFieldEditing(); void OnHideAutofillPopup(); void OnAddPasswordFormMapping( - const webkit::forms::FormField& form, - const webkit::forms::PasswordFormFillData& fill_data); - void OnShowPasswordSuggestions(const webkit::forms::FormField& field, + const FormFieldData& form, + const PasswordFormFillData& fill_data); + void OnShowPasswordSuggestions(const FormFieldData& field, const gfx::Rect& bounds, const std::vector<string16>& suggestions); void OnSetDataList(const std::vector<string16>& values, @@ -246,15 +241,15 @@ class AutofillManager : public content::NotificationObserver, // Fills |form_structure| cached element corresponding to |form|. // Returns false if the cached element was not found. - bool FindCachedForm(const webkit::forms::FormData& form, + bool FindCachedForm(const FormData& form, FormStructure** form_structure) const WARN_UNUSED_RESULT; // Fills |form_structure| and |autofill_field| with the cached elements // corresponding to |form| and |field|. This might have the side-effect of // updating the cache. Returns false if the |form| is not autofillable, or if // it is not already present in the cache and the cache is full. - bool GetCachedFormAndField(const webkit::forms::FormData& form, - const webkit::forms::FormField& field, + bool GetCachedFormAndField(const FormData& form, + const FormFieldData& field, FormStructure** form_structure, AutofillField** autofill_field) WARN_UNUSED_RESULT; @@ -262,7 +257,7 @@ class AutofillManager : public content::NotificationObserver, // |cached_form| should be a pointer to the existing version of the form, or // NULL if no cached version exists. The updated form is then written into // |updated_form|. Returns false if the cache could not be updated. - bool UpdateCachedForm(const webkit::forms::FormData& live_form, + bool UpdateCachedForm(const FormData& live_form, const FormStructure* cached_form, FormStructure** updated_form) WARN_UNUSED_RESULT; @@ -270,7 +265,7 @@ class AutofillManager : public content::NotificationObserver, // value of |field| and returns the labels of the matching profiles. |labels| // is filled with the Profile label. void GetProfileSuggestions(FormStructure* form, - const webkit::forms::FormField& field, + const FormFieldData& field, AutofillFieldType type, std::vector<string16>* values, std::vector<string16>* labels, @@ -280,7 +275,7 @@ class AutofillManager : public content::NotificationObserver, // Returns a list of values from the stored credit cards that match |type| and // the value of |field| and returns the labels of the matching credit cards. void GetCreditCardSuggestions(FormStructure* form, - const webkit::forms::FormField& field, + const FormFieldData& field, AutofillFieldType type, std::vector<string16>* values, std::vector<string16>* labels, @@ -290,7 +285,7 @@ class AutofillManager : public content::NotificationObserver, // Set |field|'s value based on |type| and contents of the |credit_card|. void FillCreditCardFormField(const CreditCard& credit_card, AutofillFieldType type, - webkit::forms::FormField* field); + FormFieldData* field); // Set |field|'s value based on |cached_field|'s type and contents of the // |profile|. The |variant| parameter specifies which value in a multi-valued @@ -298,7 +293,7 @@ class AutofillManager : public content::NotificationObserver, void FillFormField(const AutofillProfile& profile, const AutofillField& cached_field, size_t variant, - webkit::forms::FormField* field); + FormFieldData* field); // Set |field|'s value for phone number based on contents of the |profile|. // The |cached_field| specifies the type of the phone and whether this is a @@ -307,10 +302,10 @@ class AutofillManager : public content::NotificationObserver, void FillPhoneNumberField(const AutofillProfile& profile, const AutofillField& cached_field, size_t variant, - webkit::forms::FormField* field); + FormFieldData* field); // Parses the forms using heuristic matching and querying the Autofill server. - void ParseForms(const std::vector<webkit::forms::FormData>& forms); + void ParseForms(const std::vector<FormData>& forms); // Imports the form data, submitted by the user, into |personal_data_|. void ImportFormData(const FormStructure& submitted_form); diff --git a/chrome/browser/autofill/autofill_manager_delegate.h b/chrome/browser/autofill/autofill_manager_delegate.h index dda8bfe..4e23556 100644 --- a/chrome/browser/autofill/autofill_manager_delegate.h +++ b/chrome/browser/autofill/autofill_manager_delegate.h @@ -11,18 +11,13 @@ class PasswordGenerator; namespace content { class BrowserContext; +struct PasswordForm; } namespace gfx { class Rect; } -namespace webkit { -namespace forms { -struct PasswordForm; -} -} - class InfoBarService; class PrefServiceBase; class Profile; @@ -73,7 +68,7 @@ class AutofillManagerDelegate { // specified form with the given bounds. virtual void ShowPasswordGenerationBubble( const gfx::Rect& bounds, - const webkit::forms::PasswordForm& form, + const content::PasswordForm& form, autofill::PasswordGenerator* generator) = 0; }; diff --git a/chrome/browser/autofill/autofill_manager_unittest.cc b/chrome/browser/autofill/autofill_manager_unittest.cc index 0a59cc6..be1c481 100644 --- a/chrome/browser/autofill/autofill_manager_unittest.cc +++ b/chrome/browser/autofill/autofill_manager_unittest.cc @@ -32,6 +32,8 @@ #include "chrome/browser/ui/tab_contents/test_tab_contents.h" #include "chrome/common/autofill_messages.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/form_data.h" +#include "chrome/common/form_field_data.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" #include "content/public/browser/web_contents.h" @@ -45,14 +47,10 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/rect.h" -#include "webkit/forms/form_data.h" -#include "webkit/forms/form_field.h" using content::BrowserThread; using content::WebContents; using testing::_; -using webkit::forms::FormData; -using webkit::forms::FormField; namespace { @@ -198,7 +196,7 @@ void CreateTestAddressFormData(FormData* form) { form->action = GURL("http://myform.com/submit.html"); form->user_submitted = true; - FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "First Name", "firstname", "", "text", &field); form->fields.push_back(field); @@ -251,7 +249,7 @@ void CreateTestCreditCardFormData(FormData* form, } form->user_submitted = true; - FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "Name on Card", "nameoncard", "", "text", &field); form->fields.push_back(field); @@ -301,7 +299,7 @@ void ExpectFilledField(const char* expected_label, const char* expected_name, const char* expected_value, const char* expected_form_control_type, - const webkit::forms::FormField& field) { + const FormFieldData& field) { SCOPED_TRACE(expected_label); EXPECT_EQ(UTF8ToUTF16(expected_label), field.label); EXPECT_EQ(UTF8ToUTF16(expected_name), field.name); @@ -624,8 +622,8 @@ class AutofillManagerTest : public TabContentsTestHarness { } void GetAutofillSuggestions(int query_id, - const webkit::forms::FormData& form, - const webkit::forms::FormField& field) { + const FormData& form, + const FormFieldData& field) { autofill_manager_->OnQueryFormFieldAutofill(query_id, form, field, @@ -633,8 +631,8 @@ class AutofillManagerTest : public TabContentsTestHarness { false); } - void GetAutofillSuggestions(const webkit::forms::FormData& form, - const webkit::forms::FormField& field) { + void GetAutofillSuggestions(const FormData& form, + const FormFieldData& field) { GetAutofillSuggestions(kDefaultPageID, form, field); } @@ -643,7 +641,7 @@ class AutofillManagerTest : public TabContentsTestHarness { SendSuggestions(&result); } - void FormsSeen(const std::vector<webkit::forms::FormData>& forms) { + void FormsSeen(const std::vector<FormData>& forms) { autofill_manager_->OnFormsSeen(forms, base::TimeTicks()); } @@ -653,8 +651,8 @@ class AutofillManagerTest : public TabContentsTestHarness { } void FillAutofillFormData(int query_id, - const webkit::forms::FormData& form, - const webkit::forms::FormField& field, + const FormData& form, + const FormFieldData& field, int unique_id) { autofill_manager_->OnFillAutofillFormData(query_id, form, field, unique_id); } @@ -758,7 +756,7 @@ TEST_F(AutofillManagerTest, GetProfileSuggestionsEmptyValue) { std::vector<FormData> forms(1, form); FormsSeen(forms); - const FormField& field = form.fields[0]; + const FormFieldData& field = form.fields[0]; GetAutofillSuggestions(form, field); // No suggestions provided, so send an empty vector as the results. @@ -800,7 +798,7 @@ TEST_F(AutofillManagerTest, GetProfileSuggestionsMatchCharacter) { std::vector<FormData> forms(1, form); FormsSeen(forms); - FormField field; + FormFieldData field; autofill_test::CreateTestFormField("First Name", "firstname", "E", "text", &field); GetAutofillSuggestions(form, field); @@ -837,7 +835,7 @@ TEST_F(AutofillManagerTest, GetProfileSuggestionsUnknownFields) { form.action = GURL("http://myform.com/submit.html"); form.user_submitted = true; - FormField field; + FormFieldData field; autofill_test::CreateTestFormField("Username", "username", "", "text", &field); form.fields.push_back(field); @@ -871,7 +869,7 @@ TEST_F(AutofillManagerTest, GetProfileSuggestionsWithDuplicates) { "00000000-0000-0000-0000-000000000001"))); autofill_manager_->AddProfile(duplicate_profile); - const FormField& field = form.fields[0]; + const FormFieldData& field = form.fields[0]; GetAutofillSuggestions(form, field); // No suggestions provided, so send an empty vector as the results. @@ -913,7 +911,7 @@ TEST_F(AutofillManagerTest, GetProfileSuggestionsAutofillDisabledByUser) { // Disable Autofill. autofill_manager_->set_autofill_enabled(false); - const FormField& field = form.fields[0]; + const FormFieldData& field = form.fields[0]; GetAutofillSuggestions(form, field); EXPECT_FALSE(GetAutofillSuggestionsMessage(NULL, NULL, NULL, NULL, NULL)); } @@ -928,7 +926,7 @@ TEST_F(AutofillManagerTest, GetProfileSuggestionsMethodGet) { std::vector<FormData> forms(1, form); FormsSeen(forms); - const FormField& field = form.fields[0]; + const FormFieldData& field = form.fields[0]; GetAutofillSuggestions(form, field); // No suggestions provided, so send an empty vector as the results. @@ -995,7 +993,7 @@ TEST_F(AutofillManagerTest, GetCreditCardSuggestionsEmptyValue) { std::vector<FormData> forms(1, form); FormsSeen(forms); - FormField field = form.fields[1]; + FormFieldData field = form.fields[1]; GetAutofillSuggestions(form, field); // No suggestions provided, so send an empty vector as the results. @@ -1038,7 +1036,7 @@ TEST_F(AutofillManagerTest, GetCreditCardSuggestionsMatchCharacter) { std::vector<FormData> forms(1, form); FormsSeen(forms); - FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "Card Number", "cardnumber", "4", "text", &field); GetAutofillSuggestions(form, field); @@ -1074,7 +1072,7 @@ TEST_F(AutofillManagerTest, GetCreditCardSuggestionsNonCCNumber) { std::vector<FormData> forms(1, form); FormsSeen(forms); - const FormField& field = form.fields[0]; + const FormFieldData& field = form.fields[0]; GetAutofillSuggestions(form, field); // No suggestions provided, so send an empty vector as the results. @@ -1117,7 +1115,7 @@ TEST_F(AutofillManagerTest, GetCreditCardSuggestionsNonHTTPS) { std::vector<FormData> forms(1, form); FormsSeen(forms); - const FormField& field = form.fields[0]; + const FormFieldData& field = form.fields[0]; GetAutofillSuggestions(form, field); // No suggestions provided, so send an empty vector as the results. @@ -1191,7 +1189,7 @@ TEST_F(AutofillManagerTest, GetCreditCardSuggestionsRepeatedObfuscatedNumber) { std::vector<FormData> forms(1, form); FormsSeen(forms); - FormField field = form.fields[1]; + FormFieldData field = form.fields[1]; GetAutofillSuggestions(form, field); // No suggestions provided, so send an empty vector as the results. @@ -1241,7 +1239,7 @@ TEST_F(AutofillManagerTest, GetAddressAndCreditCardSuggestions) { std::vector<FormData> forms(1, form); FormsSeen(forms); - FormField field = form.fields[0]; + FormFieldData field = form.fields[0]; GetAutofillSuggestions(form, field); // No suggestions provided, so send an empty vector as the results. @@ -1315,7 +1313,7 @@ TEST_F(AutofillManagerTest, GetAddressAndCreditCardSuggestionsNonHttps) { std::vector<FormData> forms(1, form); FormsSeen(forms); - FormField field = form.fields[0]; + FormFieldData field = form.fields[0]; GetAutofillSuggestions(form, field); // No suggestions provided, so send an empty vector as the results. @@ -1382,7 +1380,7 @@ TEST_F(AutofillManagerTest, GetCombinedAutofillAndAutocompleteSuggestions) { std::vector<FormData> forms(1, form); FormsSeen(forms); - const FormField& field = form.fields[0]; + const FormFieldData& field = form.fields[0]; GetAutofillSuggestions(form, field); // Add some Autocomplete suggestions. @@ -1433,7 +1431,7 @@ TEST_F(AutofillManagerTest, GetFieldSuggestionsWhenFormIsAutofilled) { // Mark one of the fields as filled. form.fields[2].is_autofilled = true; - const FormField& field = form.fields[0]; + const FormFieldData& field = form.fields[0]; GetAutofillSuggestions(form, field); // No suggestions provided, so send an empty vector as the results. @@ -1466,7 +1464,7 @@ TEST_F(AutofillManagerTest, GetFieldSuggestionsForAutocompleteOnly) { // Set up our form data. FormData form; CreateTestAddressFormData(&form); - FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "Some Field", "somefield", "", "text", &field); form.fields.push_back(field); @@ -1519,7 +1517,7 @@ TEST_F(AutofillManagerTest, GetFieldSuggestionsWithDuplicateValues) { profile->set_guid("00000000-0000-0000-0000-000000000101"); autofill_manager_->AddProfile(profile); - FormField& field = form.fields[0]; + FormFieldData& field = form.fields[0]; field.is_autofilled = true; field.value = ASCIIToUTF16("Elvis"); GetAutofillSuggestions(form, field); @@ -1570,7 +1568,7 @@ TEST_F(AutofillManagerTest, GetFieldSuggestionsForMultiValuedProfileUnfilled) { { // Get the first name field. // Start out with "E", hoping for either "Elvis" or "Elena. - FormField& field = form.fields[0]; + FormFieldData& field = form.fields[0]; field.value = ASCIIToUTF16("E"); field.is_autofilled = false; GetAutofillSuggestions(form, field); @@ -1605,7 +1603,7 @@ TEST_F(AutofillManagerTest, GetFieldSuggestionsForMultiValuedProfileUnfilled) { { // Get the first name field. // This time, start out with "Ele", hoping for "Elena". - FormField& field = form.fields[0]; + FormFieldData& field = form.fields[0]; field.value = ASCIIToUTF16("Ele"); field.is_autofilled = false; GetAutofillSuggestions(form, field); @@ -1654,7 +1652,7 @@ TEST_F(AutofillManagerTest, GetFieldSuggestionsForMultiValuedProfileFilled) { // Get the first name field. And start out with "Travis", hoping for all the // multi-valued variants as suggestions. - FormField& field = form.fields[0]; + FormFieldData& field = form.fields[0]; field.value = ASCIIToUTF16("Travis"); field.is_autofilled = true; GetAutofillSuggestions(form, field); @@ -1700,7 +1698,7 @@ TEST_F(AutofillManagerTest, GetProfileSuggestionsFancyPhone) { profile->SetMultiInfo(PHONE_HOME_WHOLE_NUMBER, multi_values); autofill_manager_->AddProfile(profile); - const FormField& field = form.fields[9]; + const FormFieldData& field = form.fields[9]; GetAutofillSuggestions(form, field); // No suggestions provided, so send an empty vector as the results. @@ -1992,7 +1990,7 @@ TEST_F(AutofillManagerTest, FillFormWithAuthorSpecifiedSections) { form.action = GURL("https://myform.com/submit.html"); form.user_submitted = true; - FormField field; + FormFieldData field; autofill_test::CreateTestFormField("", "country", "", "text", &field); field.autocomplete_type = ASCIIToUTF16("section-billing country"); @@ -2146,7 +2144,7 @@ TEST_F(AutofillManagerTest, FillFormWithMultipleEmails) { // Set up our form data. FormData form; CreateTestAddressFormData(&form); - FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "Confirm email", "email2", "", "text", &field); form.fields.push_back(field); @@ -2214,7 +2212,7 @@ TEST_F(AutofillManagerTest, FillAutofilledForm) { // Now set the credit card fields to also be auto-filled, and try again to // fill the credit card data - for (std::vector<FormField>::iterator iter = form.fields.begin(); + for (std::vector<FormFieldData>::iterator iter = form.fields.begin(); iter != form.fields.end(); ++iter) { iter->is_autofilled = true; @@ -2311,7 +2309,7 @@ TEST_F(AutofillManagerTest, FillPhoneNumber) { { "Phone Extension", "ext", 3, "phone-extension" } }; - FormField field; + FormFieldData field; const size_t default_max_length = field.max_length; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_fields); ++i) { autofill_test::CreateTestFormField( @@ -2439,7 +2437,7 @@ TEST_F(AutofillManagerTest, FormChangesRemoveField) { CreateTestAddressFormData(&form); // Add a field -- we'll remove it again later. - FormField field; + FormFieldData field; autofill_test::CreateTestFormField("Some", "field", "", "text", &field); form.fields.insert(form.fields.begin() + 3, field); @@ -2470,9 +2468,9 @@ TEST_F(AutofillManagerTest, FormChangesAddField) { CreateTestAddressFormData(&form); // Remove the phone field -- we'll add it back later. - std::vector<FormField>::iterator pos = + std::vector<FormFieldData>::iterator pos = form.fields.begin() + kPhoneFieldOffset; - FormField field = *pos; + FormFieldData field = *pos; pos = form.fields.erase(pos); std::vector<FormData> forms(1, form); @@ -2571,7 +2569,7 @@ TEST_F(AutofillManagerTest, FormSubmittedWithDifferentFields) { // Websites would typically invoke JavaScript either on page load or on form // submit to achieve this. form.fields.pop_back(); - FormField field = form.fields[3]; + FormFieldData field = form.fields[3]; form.fields[3] = form.fields[7]; form.fields[7] = field; @@ -2651,7 +2649,7 @@ TEST_F(AutofillManagerTest, DeterminePossibleFieldTypesForUpload) { std::vector<FieldTypeSet> expected_types; // These fields should all match. - FormField field; + FormFieldData field; FieldTypeSet types; autofill_test::CreateTestFormField("", "1", "Elvis", "text", &field); types.clear(); @@ -3083,14 +3081,14 @@ class MockAutofillExternalDelegate : public TestAutofillExternalDelegate { virtual ~MockAutofillExternalDelegate() {} MOCK_METHOD5(OnQuery, void(int query_id, - const webkit::forms::FormData& form, - const webkit::forms::FormField& field, + const FormData& form, + const FormFieldData& field, const gfx::Rect& bounds, bool display_warning)); virtual void OnQueryPlatformSpecific(int query_id, - const webkit::forms::FormData& form, - const webkit::forms::FormField& field, + const FormData& form, + const FormFieldData& field, const gfx::Rect& bounds) OVERRIDE {} private: @@ -3110,7 +3108,7 @@ TEST_F(AutofillManagerTest, TestExternalDelegate) { CreateTestAddressFormData(&form); std::vector<FormData> forms(1, form); FormsSeen(forms); - const FormField& field = form.fields[0]; + const FormFieldData& field = form.fields[0]; GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() autofill_manager_->SetExternalDelegate(NULL); diff --git a/chrome/browser/autofill/autofill_merge_unittest.cc b/chrome/browser/autofill/autofill_merge_unittest.cc index 83430f4..2e51e2d 100644 --- a/chrome/browser/autofill/autofill_merge_unittest.cc +++ b/chrome/browser/autofill/autofill_merge_unittest.cc @@ -13,10 +13,10 @@ #include "chrome/browser/autofill/data_driven_test.h" #include "chrome/browser/autofill/form_structure.h" #include "chrome/browser/autofill/personal_data_manager.h" +#include "chrome/common/form_data.h" #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" -#include "webkit/forms/form_data.h" namespace { @@ -155,7 +155,7 @@ void AutofillMergeTest::MergeProfiles(const std::string& profiles, personal_data_.Reset(); // Create a test form. - webkit::forms::FormData form; + FormData form; form.name = ASCIIToUTF16("MyTestForm"); form.method = ASCIIToUTF16("POST"); form.origin = GURL("https://www.example.com/origin.html"); @@ -175,7 +175,7 @@ void AutofillMergeTest::MergeProfiles(const std::string& profiles, string16 field_type = UTF8ToUTF16(line.substr(0, separator_pos)); string16 value = UTF8ToUTF16(line.substr(separator_pos + kFieldOffset)); - webkit::forms::FormField field; + FormFieldData field; field.label = field_type; field.name = field_type; field.value = value; diff --git a/chrome/browser/autofill/autofill_metrics.cc b/chrome/browser/autofill/autofill_metrics.cc index aa8a805..960c7a6 100644 --- a/chrome/browser/autofill/autofill_metrics.cc +++ b/chrome/browser/autofill/autofill_metrics.cc @@ -9,7 +9,7 @@ #include "base/time.h" #include "chrome/browser/autofill/autofill_type.h" #include "chrome/browser/autofill/form_structure.h" -#include "webkit/forms/form_data.h" +#include "chrome/common/form_data.h" namespace { @@ -203,7 +203,7 @@ void LogServerExperimentId(const std::string& histogram_name, ServerExperiment metric = UNKNOWN_EXPERIMENT; const std::string default_experiment_name = - FormStructure(webkit::forms::FormData()).server_experiment_id(); + FormStructure(FormData()).server_experiment_id(); if (experiment_id.empty()) metric = NO_EXPERIMENT; else if (experiment_id == "ar06") diff --git a/chrome/browser/autofill/autofill_metrics_unittest.cc b/chrome/browser/autofill/autofill_metrics_unittest.cc index 8e31f33..c1d1b00 100644 --- a/chrome/browser/autofill/autofill_metrics_unittest.cc +++ b/chrome/browser/autofill/autofill_metrics_unittest.cc @@ -20,13 +20,13 @@ #include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/ui/tab_contents/test_tab_contents.h" #include "chrome/browser/webdata/web_data_service.h" +#include "chrome/common/form_data.h" +#include "chrome/common/form_field_data.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/rect.h" -#include "webkit/forms/form_data.h" -#include "webkit/forms/form_field.h" using content::BrowserThread; using ::testing::_; @@ -34,8 +34,6 @@ using ::testing::AnyNumber; using ::testing::Mock; using base::TimeTicks; using base::TimeDelta; -using webkit::forms::FormData; -using webkit::forms::FormField; namespace { @@ -339,7 +337,7 @@ TEST_F(AutofillMetricsTest, QualityMetrics) { form.user_submitted = true; std::vector<AutofillFieldType> heuristic_types, server_types; - FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "Autofilled", "autofilled", "Elvis Aaron Presley", "text", &field); @@ -554,7 +552,7 @@ TEST_F(AutofillMetricsTest, QualityMetricsForFailure) { std::vector<AutofillFieldType> heuristic_types, server_types; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(failure_cases); ++i) { - FormField field; + FormFieldData field; autofill_test::CreateTestFormField(failure_cases[i].label, failure_cases[i].name, failure_cases[i].value, "text", &field); @@ -608,7 +606,7 @@ TEST_F(AutofillMetricsTest, SaneMetricsWithCacheMismatch) { std::vector<AutofillFieldType> heuristic_types, server_types; - FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "Both match", "match", "Elvis Aaron Presley", "text", &field); field.is_autofilled = true; @@ -641,7 +639,7 @@ TEST_F(AutofillMetricsTest, SaneMetricsWithCacheMismatch) { // Add a field and re-arrange the remaining form fields before submitting. - std::vector<FormField> cached_fields = form.fields; + std::vector<FormFieldData> cached_fields = form.fields; form.fields.clear(); autofill_test::CreateTestFormField( "New field", "new field", "Tennessee", "text", &field); @@ -763,7 +761,7 @@ TEST_F(AutofillMetricsTest, NoQualityMetricsForNonAutofillableForms) { form.action = GURL("http://example.com/submit.html"); form.user_submitted = true; - FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "Autofilled", "autofilled", "Elvis Presley", "text", &field); field.is_autofilled = true; @@ -804,7 +802,7 @@ TEST_F(AutofillMetricsTest, QualityMetricsWithExperimentId) { form.user_submitted = true; std::vector<AutofillFieldType> heuristic_types, server_types; - FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "Autofilled", "autofilled", "Elvis Aaron Presley", "text", &field); @@ -956,7 +954,7 @@ TEST_F(AutofillMetricsTest, AddressSuggestionsCount) { form.action = GURL("http://example.com/submit.html"); form.user_submitted = true; - FormField field; + FormFieldData field; std::vector<AutofillFieldType> field_types; autofill_test::CreateTestFormField("Name", "name", "", "text", &field); form.fields.push_back(field); @@ -1130,7 +1128,7 @@ TEST_F(AutofillMetricsTest, UserHappinessFormLoadAndSubmission) { form.action = GURL("http://example.com/submit.html"); form.user_submitted = true; - FormField field; + FormFieldData field; autofill_test::CreateTestFormField("Name", "name", "", "text", &field); form.fields.push_back(field); autofill_test::CreateTestFormField("Email", "email", "", "text", &field); @@ -1264,7 +1262,7 @@ TEST_F(AutofillMetricsTest, UserHappinessFormInteraction) { form.action = GURL("http://example.com/submit.html"); form.user_submitted = true; - FormField field; + FormFieldData field; autofill_test::CreateTestFormField("Name", "name", "", "text", &field); form.fields.push_back(field); autofill_test::CreateTestFormField("Email", "email", "", "text", &field); @@ -1369,7 +1367,7 @@ TEST_F(AutofillMetricsTest, FormFillDuration) { form.action = GURL("http://example.com/submit.html"); form.user_submitted = true; - FormField field; + FormFieldData field; autofill_test::CreateTestFormField("Name", "name", "", "text", &field); form.fields.push_back(field); autofill_test::CreateTestFormField("Email", "email", "", "text", &field); diff --git a/chrome/browser/autofill/credit_card_field_unittest.cc b/chrome/browser/autofill/credit_card_field_unittest.cc index 37bd16d..efe1bb5 100644 --- a/chrome/browser/autofill/credit_card_field_unittest.cc +++ b/chrome/browser/autofill/credit_card_field_unittest.cc @@ -8,8 +8,8 @@ #include "chrome/browser/autofill/autofill_field.h" #include "chrome/browser/autofill/autofill_scanner.h" #include "chrome/browser/autofill/credit_card_field.h" +#include "chrome/common/form_field_data.h" #include "testing/gtest/include/gtest/gtest.h" -#include "webkit/forms/form_field.h" class CreditCardFieldTest : public testing::Test { public: @@ -43,7 +43,7 @@ TEST_F(CreditCardFieldTest, NonParse) { } TEST_F(CreditCardFieldTest, ParseCreditCardNoNumber) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Exp Month"); @@ -60,7 +60,7 @@ TEST_F(CreditCardFieldTest, ParseCreditCardNoNumber) { } TEST_F(CreditCardFieldTest, ParseCreditCardNoDate) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Card Number"); @@ -73,7 +73,7 @@ TEST_F(CreditCardFieldTest, ParseCreditCardNoDate) { } TEST_F(CreditCardFieldTest, ParseMiniumCreditCard) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Card Number"); @@ -105,7 +105,7 @@ TEST_F(CreditCardFieldTest, ParseMiniumCreditCard) { } TEST_F(CreditCardFieldTest, ParseFullCreditCard) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Name on Card"); @@ -151,7 +151,7 @@ TEST_F(CreditCardFieldTest, ParseFullCreditCard) { } TEST_F(CreditCardFieldTest, ParseExpMonthYear) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Name on Card"); @@ -190,7 +190,7 @@ TEST_F(CreditCardFieldTest, ParseExpMonthYear) { } TEST_F(CreditCardFieldTest, ParseExpMonthYear2) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Name on Card"); @@ -229,7 +229,7 @@ TEST_F(CreditCardFieldTest, ParseExpMonthYear2) { } TEST_F(CreditCardFieldTest, ParseExpField) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Name on Card"); @@ -261,7 +261,7 @@ TEST_F(CreditCardFieldTest, ParseExpField) { } TEST_F(CreditCardFieldTest, ParseExpField2DigitYear) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Name on Card"); @@ -293,7 +293,7 @@ TEST_F(CreditCardFieldTest, ParseExpField2DigitYear) { } TEST_F(CreditCardFieldTest, ParseCreditCardHolderNameWithCCFullName) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Name"); diff --git a/chrome/browser/autofill/form_structure.cc b/chrome/browser/autofill/form_structure.cc index 5f19ed6..07af748 100644 --- a/chrome/browser/autofill/form_structure.cc +++ b/chrome/browser/autofill/form_structure.cc @@ -20,15 +20,11 @@ #include "chrome/browser/autofill/autofill_xml_parser.h" #include "chrome/browser/autofill/field_types.h" #include "chrome/browser/autofill/form_field.h" +#include "chrome/common/form_data.h" +#include "chrome/common/form_data_predictions.h" +#include "chrome/common/form_field_data.h" +#include "chrome/common/form_field_data_predictions.h" #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" -#include "webkit/forms/form_data.h" -#include "webkit/forms/form_data_predictions.h" -#include "webkit/forms/form_field.h" -#include "webkit/forms/form_field_predictions.h" - -using webkit::forms::FormData; -using webkit::forms::FormDataPredictions; -using webkit::forms::FormFieldPredictions; namespace { @@ -244,7 +240,7 @@ FormStructure::FormStructure(const FormData& form) has_author_specified_types_(false) { // Copy the form fields. std::map<string16, size_t> unique_names; - for (std::vector<webkit::forms::FormField>::const_iterator field = + for (std::vector<FormFieldData>::const_iterator field = form.fields.begin(); field != form.fields.end(); field++) { // Add all supported form fields (including with empty names) to the @@ -487,9 +483,9 @@ void FormStructure::GetFieldTypePredictions( for (std::vector<AutofillField*>::const_iterator field = form_structure->fields_.begin(); field != form_structure->fields_.end(); ++field) { - form.data.fields.push_back(webkit::forms::FormField(**field)); + form.data.fields.push_back(FormFieldData(**field)); - FormFieldPredictions annotated_field; + FormFieldDataPredictions annotated_field; annotated_field.signature = (*field)->FieldSignature(); annotated_field.heuristic_type = AutofillType::FieldTypeToString((*field)->heuristic_type()); diff --git a/chrome/browser/autofill/form_structure.h b/chrome/browser/autofill/form_structure.h index 68223a8..fba3c1f 100644 --- a/chrome/browser/autofill/form_structure.h +++ b/chrome/browser/autofill/form_structure.h @@ -15,6 +15,8 @@ #include "chrome/browser/autofill/field_types.h" #include "googleurl/src/gurl.h" +struct FormData; +struct FormDataPredictions; enum RequestMethod { GET, @@ -37,18 +39,11 @@ namespace buzz { class XmlElement; } -namespace webkit { -namespace forms { -struct FormData; -struct FormDataPredictions; -} -} - // FormStructure stores a single HTML form together with the values entered // in the fields along with additional information needed by Autofill. class FormStructure { public: - explicit FormStructure(const webkit::forms::FormData& form); + explicit FormStructure(const FormData& form); virtual ~FormStructure(); // Runs several heuristics against the form fields to determine their possible @@ -79,7 +74,7 @@ class FormStructure { // fields' predicted types. static void GetFieldTypePredictions( const std::vector<FormStructure*>& form_structures, - std::vector<webkit::forms::FormDataPredictions>* forms); + std::vector<FormDataPredictions>* forms); // The unique signature for this form, composed of the target url domain, // the form name, and the form field names in a 64-bit hash. @@ -140,8 +135,8 @@ class FormStructure { virtual std::string server_experiment_id() const; - bool operator==(const webkit::forms::FormData& form) const; - bool operator!=(const webkit::forms::FormData& form) const; + bool operator==(const FormData& form) const; + bool operator!=(const FormData& form) const; private: friend class FormStructureTest; diff --git a/chrome/browser/autofill/form_structure_unittest.cc b/chrome/browser/autofill/form_structure_unittest.cc index 811c69e..64c8e17 100644 --- a/chrome/browser/autofill/form_structure_unittest.cc +++ b/chrome/browser/autofill/form_structure_unittest.cc @@ -6,18 +6,15 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/autofill/form_structure.h" +#include "chrome/common/form_data.h" +#include "chrome/common/form_field_data.h" #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" -#include "webkit/forms/form_data.h" -#include "webkit/forms/form_field.h" -using webkit::forms::FormData; -using webkit::forms::FormField; using WebKit::WebInputElement; -namespace webkit { -namespace forms { +namespace content { std::ostream& operator<<(std::ostream& os, const FormData& form) { os << UTF16ToUTF8(form.name) @@ -29,7 +26,7 @@ std::ostream& operator<<(std::ostream& os, const FormData& form) { << form.action.spec() << " "; - for (std::vector<webkit::forms::FormField>::const_iterator iter = + for (std::vector<FormFieldData>::const_iterator iter = form.fields.begin(); iter != form.fields.end(); ++iter) { os << *iter @@ -39,8 +36,7 @@ std::ostream& operator<<(std::ostream& os, const FormData& form) { return os; } -} // namespace forms -} // namespace webkit_glue +} // namespace content class FormStructureTest { public: @@ -53,7 +49,7 @@ TEST(FormStructureTest, FieldCount) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.label = ASCIIToUTF16("username"); field.name = ASCIIToUTF16("username"); field.form_control_type = ASCIIToUTF16("text"); @@ -79,7 +75,7 @@ TEST(FormStructureTest, AutofillCount) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.label = ASCIIToUTF16("username"); field.name = ASCIIToUTF16("username"); field.form_control_type = ASCIIToUTF16("text"); @@ -123,7 +119,7 @@ TEST(FormStructureTest, IsAutofillable) { // We need at least three text fields to be auto-fillable. form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.label = ASCIIToUTF16("username"); field.name = ASCIIToUTF16("username"); field.form_control_type = ASCIIToUTF16("text"); @@ -197,7 +193,7 @@ TEST(FormStructureTest, ShouldBeParsed) { // We need at least three text fields to be parseable. form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.label = ASCIIToUTF16("username"); field.name = ASCIIToUTF16("username"); field.form_control_type = ASCIIToUTF16("text"); @@ -270,7 +266,7 @@ TEST(FormStructureTest, HeuristicsContactInfo) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("First Name"); @@ -339,7 +335,7 @@ TEST(FormStructureTest, HeuristicsAutocompletetype) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = string16(); @@ -377,7 +373,7 @@ TEST(FormStructureTest, HeuristicsAutocompletetypePhones) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = string16(); @@ -421,7 +417,7 @@ TEST(FormStructureTest, AutocompletetypeOverridesOtherHeuristics) { form.method = ASCIIToUTF16("post"); // Start with a regular contact form. - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("First Name"); @@ -470,7 +466,7 @@ TEST(FormStructureTest, HeuristicsAutocompletetypeWithSections) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); // We expect "shipping" and "billing" to be the most common sections. @@ -542,7 +538,7 @@ TEST(FormStructureTest, HeuristicsAutocompletetypeWithFallbacks) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); // Skip over any sections and "x"-prefixed types. @@ -590,7 +586,7 @@ TEST(FormStructureTest, HeuristicsSample8) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Your First Name:"); @@ -669,7 +665,7 @@ TEST(FormStructureTest, HeuristicsSample6) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("E-mail address"); @@ -725,14 +721,14 @@ TEST(FormStructureTest, HeuristicsSample6) { } // Tests a sequence of FormFields where only labels are supplied to heuristics -// for matching. This works because FormField labels are matched in the case -// that input element ids (or |name| fields) are missing. +// for matching. This works because FormFieldData labels are matched in the +// case that input element ids (or |name| fields) are missing. TEST(FormStructureTest, HeuristicsLabelsOnly) { scoped_ptr<FormStructure> form_structure; FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("First Name"); @@ -798,7 +794,7 @@ TEST(FormStructureTest, HeuristicsCreditCardInfo) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Name on Card"); @@ -852,7 +848,7 @@ TEST(FormStructureTest, HeuristicsCreditCardInfoWithUnknownCardField) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Name on Card"); @@ -914,7 +910,7 @@ TEST(FormStructureTest, ThreeAddressLines) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Address Line1"); @@ -956,7 +952,7 @@ TEST(FormStructureTest, BillingAndShippingAddresses) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Address Line1"); @@ -1002,7 +998,7 @@ TEST(FormStructureTest, ThreeAddressLinesExpedia) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Street:"); @@ -1045,7 +1041,7 @@ TEST(FormStructureTest, TwoAddressLinesEbay) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Address Line1"); @@ -1079,7 +1075,7 @@ TEST(FormStructureTest, HeuristicsStateWithProvince) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Address Line1"); @@ -1114,7 +1110,7 @@ TEST(FormStructureTest, HeuristicsWithBilling) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("First Name*:"); @@ -1187,7 +1183,7 @@ TEST(FormStructureTest, ThreePartPhoneNumber) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Phone:"); @@ -1235,7 +1231,7 @@ TEST(FormStructureTest, HeuristicsInfernoCC) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Name on Card"); @@ -1284,7 +1280,7 @@ TEST(FormStructureTest, CVCCodeClash) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Card number"); @@ -1338,7 +1334,7 @@ TEST(FormStructureTest, EncodeQueryRequest) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Name on Card"); @@ -1453,7 +1449,7 @@ TEST(FormStructureTest, EncodeUploadRequest) { form_structure.reset(new FormStructure(form)); form_structure->DetermineHeuristicTypes(); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("First Name"); @@ -1599,7 +1595,7 @@ TEST(FormStructureTest, CheckDataPresence) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("First Name"); @@ -1853,7 +1849,7 @@ TEST(FormStructureTest, CheckMultipleTypes) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("email"); @@ -1959,7 +1955,7 @@ TEST(FormStructureTest, CheckFormSignature) { FormData form; form.method = ASCIIToUTF16("post"); - FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("email"); diff --git a/chrome/browser/autofill/name_field_unittest.cc b/chrome/browser/autofill/name_field_unittest.cc index 3c703f3..2c7b87e 100644 --- a/chrome/browser/autofill/name_field_unittest.cc +++ b/chrome/browser/autofill/name_field_unittest.cc @@ -8,8 +8,8 @@ #include "chrome/browser/autofill/autofill_field.h" #include "chrome/browser/autofill/autofill_scanner.h" #include "chrome/browser/autofill/name_field.h" +#include "chrome/common/form_field_data.h" #include "testing/gtest/include/gtest/gtest.h" -#include "webkit/forms/form_field.h" class NameFieldTest : public testing::Test { public: @@ -30,7 +30,7 @@ class NameFieldTest : public testing::Test { }; TEST_F(NameFieldTest, FirstMiddleLast) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("First Name"); @@ -61,7 +61,7 @@ TEST_F(NameFieldTest, FirstMiddleLast) { } TEST_F(NameFieldTest, FirstMiddleLast2) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = string16(); @@ -92,7 +92,7 @@ TEST_F(NameFieldTest, FirstMiddleLast2) { } TEST_F(NameFieldTest, FirstLast) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = string16(); @@ -116,7 +116,7 @@ TEST_F(NameFieldTest, FirstLast) { } TEST_F(NameFieldTest, FirstLast2) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Name"); @@ -140,7 +140,7 @@ TEST_F(NameFieldTest, FirstLast2) { } TEST_F(NameFieldTest, FirstLastMiddleWithSpaces) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("First Name"); @@ -171,7 +171,7 @@ TEST_F(NameFieldTest, FirstLastMiddleWithSpaces) { } TEST_F(NameFieldTest, FirstLastEmpty) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Name"); @@ -195,7 +195,7 @@ TEST_F(NameFieldTest, FirstLastEmpty) { } TEST_F(NameFieldTest, FirstMiddleLastEmpty) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Name"); @@ -226,7 +226,7 @@ TEST_F(NameFieldTest, FirstMiddleLastEmpty) { } TEST_F(NameFieldTest, MiddleInitial) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("First Name"); @@ -257,7 +257,7 @@ TEST_F(NameFieldTest, MiddleInitial) { } TEST_F(NameFieldTest, MiddleInitialNoLastName) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("First Name"); @@ -276,7 +276,7 @@ TEST_F(NameFieldTest, MiddleInitialNoLastName) { // This case is from the dell.com checkout page. The middle initial "mi" string // came at the end following other descriptive text. http://crbug.com/45123. TEST_F(NameFieldTest, MiddleInitialAtEnd) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = string16(); diff --git a/chrome/browser/autofill/password_autofill_manager.cc b/chrome/browser/autofill/password_autofill_manager.cc index d05ec84..f7f36d0 100644 --- a/chrome/browser/autofill/password_autofill_manager.cc +++ b/chrome/browser/autofill/password_autofill_manager.cc @@ -19,9 +19,9 @@ PasswordAutofillManager::~PasswordAutofillManager() { } bool PasswordAutofillManager::DidAcceptAutofillSuggestion( - const webkit::forms::FormField& field, + const FormFieldData& field, const string16& value) { - webkit::forms::PasswordFormFillData password; + PasswordFormFillData password; if (!FindLoginInfo(field, &password)) return false; @@ -40,8 +40,8 @@ bool PasswordAutofillManager::DidAcceptAutofillSuggestion( } void PasswordAutofillManager::AddPasswordFormMapping( - const webkit::forms::FormField& username_element, - const webkit::forms::PasswordFormFillData& password) { + const FormFieldData& username_element, + const PasswordFormFillData& password) { login_to_password_info_[username_element] = password; } @@ -54,13 +54,13 @@ void PasswordAutofillManager::Reset() { bool PasswordAutofillManager::WillFillUserNameAndPassword( const string16& current_username, - const webkit::forms::PasswordFormFillData& fill_data) { + const PasswordFormFillData& fill_data) { // Look for any suitable matches to current field text. if (fill_data.basic_data.fields[0].value == current_username) { return true; } else { // Scan additional logins for a match. - webkit::forms::PasswordFormFillData::LoginCollection::const_iterator iter; + PasswordFormFillData::LoginCollection::const_iterator iter; for (iter = fill_data.additional_logins.begin(); iter != fill_data.additional_logins.end(); ++iter) { if (iter->first == current_username) @@ -72,8 +72,8 @@ bool PasswordAutofillManager::WillFillUserNameAndPassword( } bool PasswordAutofillManager::FindLoginInfo( - const webkit::forms::FormField& field, - webkit::forms::PasswordFormFillData* found_password) { + const FormFieldData& field, + PasswordFormFillData* found_password) { LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(field); if (iter == login_to_password_info_.end()) return false; diff --git a/chrome/browser/autofill/password_autofill_manager.h b/chrome/browser/autofill/password_autofill_manager.h index 8cb6bca..7326f68 100644 --- a/chrome/browser/autofill/password_autofill_manager.h +++ b/chrome/browser/autofill/password_autofill_manager.h @@ -14,7 +14,7 @@ #include <map> -#include "webkit/forms/password_form_dom_manager.h" +#include "chrome/common/password_form_fill_data.h" namespace content { class WebContents; @@ -28,13 +28,13 @@ class PasswordAutofillManager { // Fills the password associated with user name |value|. Returns true if the // username and password fields were filled, false otherwise. - bool DidAcceptAutofillSuggestion(const webkit::forms::FormField& field, + bool DidAcceptAutofillSuggestion(const FormFieldData& field, const string16& value); // Invoked when a password mapping is added. void AddPasswordFormMapping( - const webkit::forms::FormField& username_element, - const webkit::forms::PasswordFormFillData& password); + const FormFieldData& username_element, + const PasswordFormFillData& password); // Invoked to clear any page specific cached values. void Reset(); @@ -43,19 +43,19 @@ class PasswordAutofillManager { // TODO(csharp): Modify the AutofillExternalDeletegate code so that it can // figure out if a entry is a password one without using this mapping. // crbug.com/118601 - typedef std::map<webkit::forms::FormField, - webkit::forms::PasswordFormFillData> + typedef std::map<FormFieldData, + PasswordFormFillData> LoginToPasswordInfoMap; // Returns true if |current_username| matches a username for one of the // login mappings in |password|. bool WillFillUserNameAndPassword( const string16& current_username, - const webkit::forms::PasswordFormFillData& password); + const PasswordFormFillData& password); // Finds login information for a |node| that was previously filled. - bool FindLoginInfo(const webkit::forms::FormField& field, - webkit::forms::PasswordFormFillData* found_password); + bool FindLoginInfo(const FormFieldData& field, + PasswordFormFillData* found_password); // The logins we have filled so far with their associated info. LoginToPasswordInfoMap login_to_password_info_; diff --git a/chrome/browser/autofill/password_autofill_manager_unittest.cc b/chrome/browser/autofill/password_autofill_manager_unittest.cc index 35ca066..f7305a7 100644 --- a/chrome/browser/autofill/password_autofill_manager_unittest.cc +++ b/chrome/browser/autofill/password_autofill_manager_unittest.cc @@ -34,7 +34,7 @@ class PasswordAutofillManagerTest : public testing::Test { username_field_.value = username1; fill_data_.basic_data.fields.push_back(username_field_); - webkit::forms::FormField password_field; + FormFieldData password_field; password_field.name = ASCIIToUTF16(kPasswordName); password_field.value = password1; fill_data_.basic_data.fields.push_back(password_field); @@ -47,11 +47,11 @@ class PasswordAutofillManagerTest : public testing::Test { return &password_autofill_manager_; } - const webkit::forms::FormField& username_field() { return username_field_; } + const FormFieldData& username_field() { return username_field_; } private: - webkit::forms::PasswordFormFillData fill_data_; - webkit::forms::FormField username_field_; + PasswordFormFillData fill_data_; + FormFieldData username_field_; PasswordAutofillManager password_autofill_manager_; }; @@ -62,7 +62,7 @@ TEST_F(PasswordAutofillManagerTest, DidAcceptAutofillSuggestion) { EXPECT_FALSE(password_autofill_manager()->DidAcceptAutofillSuggestion( username_field(), ASCIIToUTF16(kInvalidUsername))); - webkit::forms::FormField invalid_username_field; + FormFieldData invalid_username_field; invalid_username_field.name = ASCIIToUTF16(kInvalidUsername); EXPECT_FALSE(password_autofill_manager()->DidAcceptAutofillSuggestion( diff --git a/chrome/browser/autofill/personal_data_manager_unittest.cc b/chrome/browser/autofill/personal_data_manager_unittest.cc index 3b4b1c6..c20624e 100644 --- a/chrome/browser/autofill/personal_data_manager_unittest.cc +++ b/chrome/browser/autofill/personal_data_manager_unittest.cc @@ -17,6 +17,7 @@ #include "chrome/browser/password_manager/encryptor.h" #include "chrome/browser/webdata/web_data_service.h" #include "chrome/browser/webdata/web_data_service_factory.h" +#include "chrome/common/form_data.h" #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile.h" #include "content/public/browser/notification_details.h" @@ -27,10 +28,8 @@ #include "content/public/test/test_browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "webkit/forms/form_data.h" using content::BrowserThread; -using webkit::forms::FormData; ACTION(QuitUIMessageLoop) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -483,7 +482,7 @@ TEST_F(PersonalDataManagerTest, Refresh) { TEST_F(PersonalDataManagerTest, ImportFormData) { FormData form; - webkit::forms::FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "First name:", "first_name", "George", "text", &field); form.fields.push_back(field); @@ -528,7 +527,7 @@ TEST_F(PersonalDataManagerTest, ImportFormData) { TEST_F(PersonalDataManagerTest, ImportFormDataBadEmail) { FormData form; - webkit::forms::FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "First name:", "first_name", "George", "text", &field); form.fields.push_back(field); @@ -563,7 +562,7 @@ TEST_F(PersonalDataManagerTest, ImportFormDataBadEmail) { TEST_F(PersonalDataManagerTest, ImportFormDataNotEnoughFilledFields) { FormData form; - webkit::forms::FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "First name:", "first_name", "George", "text", &field); form.fields.push_back(field); @@ -588,7 +587,7 @@ TEST_F(PersonalDataManagerTest, ImportFormDataNotEnoughFilledFields) { TEST_F(PersonalDataManagerTest, ImportPhoneNumberSplitAcrossMultipleFields) { FormData form; - webkit::forms::FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "First name:", "first_name", "George", "text", &field); form.fields.push_back(field); @@ -679,7 +678,7 @@ TEST_F(PersonalDataManagerTest, SetUniqueCreditCardLabels) { TEST_F(PersonalDataManagerTest, AggregateTwoDifferentProfiles) { FormData form1; - webkit::forms::FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "First name:", "first_name", "George", "text", &field); form1.fields.push_back(field); @@ -770,7 +769,7 @@ TEST_F(PersonalDataManagerTest, AggregateTwoDifferentProfiles) { TEST_F(PersonalDataManagerTest, AggregateTwoProfilesWithMultiValue) { FormData form1; - webkit::forms::FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "First name:", "first_name", "George", "text", &field); form1.fields.push_back(field); @@ -865,7 +864,7 @@ TEST_F(PersonalDataManagerTest, AggregateTwoProfilesWithMultiValue) { TEST_F(PersonalDataManagerTest, AggregateSameProfileWithConflict) { FormData form1; - webkit::forms::FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "First name:", "first_name", "George", "text", &field); form1.fields.push_back(field); @@ -975,7 +974,7 @@ TEST_F(PersonalDataManagerTest, AggregateSameProfileWithConflict) { TEST_F(PersonalDataManagerTest, AggregateProfileWithMissingInfoInOld) { FormData form1; - webkit::forms::FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "First name:", "first_name", "George", "text", &field); form1.fields.push_back(field); @@ -1062,7 +1061,7 @@ TEST_F(PersonalDataManagerTest, AggregateProfileWithMissingInfoInOld) { TEST_F(PersonalDataManagerTest, AggregateProfileWithMissingInfoInNew) { FormData form1; - webkit::forms::FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "First name:", "first_name", "George", "text", &field); form1.fields.push_back(field); @@ -1153,7 +1152,7 @@ TEST_F(PersonalDataManagerTest, AggregateProfileWithMissingInfoInNew) { TEST_F(PersonalDataManagerTest, AggregateProfileWithInsufficientAddress) { FormData form1; - webkit::forms::FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "First name:", "first_name", "George", "text", &field); form1.fields.push_back(field); @@ -1203,7 +1202,7 @@ TEST_F(PersonalDataManagerTest, AggregateExistingAuxiliaryProfile) { // Simulate a form submission with a subset of the info. // Note that the phone number format is different from the saved format. FormData form; - webkit::forms::FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "First name:", "first_name", "Tester", "text", &field); form.fields.push_back(field); @@ -1250,7 +1249,7 @@ TEST_F(PersonalDataManagerTest, AggregateTwoDifferentCreditCards) { FormData form1; // Start with a single valid credit card form. - webkit::forms::FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); form1.fields.push_back(field); @@ -1326,7 +1325,7 @@ TEST_F(PersonalDataManagerTest, AggregateInvalidCreditCard) { FormData form1; // Start with a single valid credit card form. - webkit::forms::FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); form1.fields.push_back(field); @@ -1393,7 +1392,7 @@ TEST_F(PersonalDataManagerTest, AggregateSameCreditCardWithConflict) { FormData form1; // Start with a single valid credit card form. - webkit::forms::FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); form1.fields.push_back(field); @@ -1469,7 +1468,7 @@ TEST_F(PersonalDataManagerTest, AggregateEmptyCreditCardWithConflict) { FormData form1; // Start with a single valid credit card form. - webkit::forms::FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); form1.fields.push_back(field); @@ -1537,7 +1536,7 @@ TEST_F(PersonalDataManagerTest, AggregateCreditCardWithMissingInfoInNew) { FormData form1; // Start with a single valid credit card form. - webkit::forms::FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); form1.fields.push_back(field); @@ -1653,7 +1652,7 @@ TEST_F(PersonalDataManagerTest, AggregateCreditCardWithMissingInfoInOld) { // Add a second different valid credit card where the year is different but // the credit card number matches. FormData form; - webkit::forms::FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); form.fields.push_back(field); @@ -1710,7 +1709,7 @@ TEST_F(PersonalDataManagerTest, AggregateSameCreditCardWithSeparators) { // Import the same card info, but with different separators in the number. FormData form; - webkit::forms::FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "Name on card:", "name_on_card", "Biggie Smalls", "text", &field); form.fields.push_back(field); @@ -1864,7 +1863,7 @@ TEST_F(PersonalDataManagerTest, GetNonEmptyTypes) { TEST_F(PersonalDataManagerTest, CaseInsensitiveMultiValueAggregation) { FormData form1; - webkit::forms::FormField field; + FormFieldData field; autofill_test::CreateTestFormField( "First name:", "first_name", "George", "text", &field); form1.fields.push_back(field); diff --git a/chrome/browser/autofill/phone_field_unittest.cc b/chrome/browser/autofill/phone_field_unittest.cc index cd8baf5..5bfbace 100644 --- a/chrome/browser/autofill/phone_field_unittest.cc +++ b/chrome/browser/autofill/phone_field_unittest.cc @@ -8,8 +8,8 @@ #include "chrome/browser/autofill/autofill_field.h" #include "chrome/browser/autofill/autofill_scanner.h" #include "chrome/browser/autofill/phone_field.h" +#include "chrome/common/form_field_data.h" #include "testing/gtest/include/gtest/gtest.h" -#include "webkit/forms/form_field.h" class PhoneFieldTest : public testing::Test { public: @@ -43,7 +43,7 @@ TEST_F(PhoneFieldTest, NonParse) { } TEST_F(PhoneFieldTest, ParseOneLinePhone) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Phone"); @@ -60,7 +60,7 @@ TEST_F(PhoneFieldTest, ParseOneLinePhone) { } TEST_F(PhoneFieldTest, ParseTwoLinePhone) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Area Code"); @@ -89,7 +89,7 @@ TEST_F(PhoneFieldTest, ThreePartPhoneNumber) { // <country code> - <area code> - <phone>. The only distinguishing feature is // size: <prefix> is no bigger than 3 characters, and <suffix> is no bigger // than 4. - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Phone:"); @@ -133,7 +133,7 @@ TEST_F(PhoneFieldTest, ThreePartPhoneNumber) { // encountered in http://crbug.com/40694 with page // https://www.wrapables.com/jsp/Signup.jsp. TEST_F(PhoneFieldTest, ThreePartPhoneNumberPrefixSuffix) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Phone:"); @@ -164,7 +164,7 @@ TEST_F(PhoneFieldTest, ThreePartPhoneNumberPrefixSuffix) { } TEST_F(PhoneFieldTest, ThreePartPhoneNumberPrefixSuffix2) { - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("("); @@ -200,7 +200,7 @@ TEST_F(PhoneFieldTest, ThreePartPhoneNumberPrefixSuffix2) { TEST_F(PhoneFieldTest, CountryAndCityAndPhoneNumber) { // Phone in format <country code>:3 - <city and number>:10 // The |maxlength| is considered, otherwise it's too broad. - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("text"); field.label = ASCIIToUTF16("Phone Number"); diff --git a/chrome/browser/autofill/select_control_handler.cc b/chrome/browser/autofill/select_control_handler.cc index 682ebff..d602911 100644 --- a/chrome/browser/autofill/select_control_handler.cc +++ b/chrome/browser/autofill/select_control_handler.cc @@ -13,7 +13,7 @@ #include "chrome/browser/autofill/autofill_country.h" #include "chrome/browser/autofill/autofill_profile.h" #include "chrome/browser/autofill/form_group.h" -#include "webkit/forms/form_field.h" +#include "chrome/common/form_field_data.h" namespace { @@ -120,7 +120,7 @@ const char* const kMonthsNumeric[] = { // Returns true if the value was successfully set, meaning |value| was found in // the list of select options in |field|. bool SetSelectControlValue(const string16& value, - webkit::forms::FormField* field) { + FormFieldData* field) { string16 value_lowercase = StringToLowerASCII(value); DCHECK_EQ(field->option_values.size(), field->option_contents.size()); @@ -136,7 +136,7 @@ bool SetSelectControlValue(const string16& value, } bool FillStateSelectControl(const string16& value, - webkit::forms::FormField* field) { + FormFieldData* field) { string16 abbrev, full; if (value.size() < 4U) { abbrev = value; @@ -157,7 +157,7 @@ bool FillStateSelectControl(const string16& value, } bool FillCountrySelectControl(const FormGroup& form_group, - webkit::forms::FormField* field) { + FormFieldData* field) { const AutofillProfile& profile = static_cast<const AutofillProfile&>(form_group); std::string country_code = profile.CountryCode(); @@ -180,7 +180,7 @@ bool FillCountrySelectControl(const FormGroup& form_group, } bool FillExpirationMonthSelectControl(const string16& value, - webkit::forms::FormField* field) { + FormFieldData* field) { int index = 0; if (!base::StringToInt(value, &index) || index <= 0 || @@ -200,7 +200,7 @@ namespace autofill { void FillSelectControl(const FormGroup& form_group, AutofillFieldType type, - webkit::forms::FormField* field) { + FormFieldData* field) { DCHECK(field); DCHECK_EQ(ASCIIToUTF16("select-one"), field->form_control_type); DCHECK_EQ(field->option_values.size(), field->option_contents.size()); diff --git a/chrome/browser/autofill/select_control_handler.h b/chrome/browser/autofill/select_control_handler.h index e54d4ed..34f4076 100644 --- a/chrome/browser/autofill/select_control_handler.h +++ b/chrome/browser/autofill/select_control_handler.h @@ -10,11 +10,7 @@ class FormGroup; -namespace webkit { -namespace forms { -struct FormField; -} -} +struct FormFieldData; namespace autofill { @@ -24,7 +20,7 @@ namespace autofill { // months, e.g., (04, April). void FillSelectControl(const FormGroup& form_group, AutofillFieldType type, - webkit::forms::FormField* field); + FormFieldData* field); // Returns true if |value| is a valid US state name or abbreviation. It is case // insensitive. Valid for US states only. diff --git a/chrome/browser/autofill/select_control_handler_unittest.cc b/chrome/browser/autofill/select_control_handler_unittest.cc index 2977655..7d74ab6 100644 --- a/chrome/browser/autofill/select_control_handler_unittest.cc +++ b/chrome/browser/autofill/select_control_handler_unittest.cc @@ -8,8 +8,8 @@ #include "chrome/browser/autofill/autofill_type.h" #include "chrome/browser/autofill/credit_card.h" #include "chrome/browser/autofill/select_control_handler.h" +#include "chrome/common/form_field_data.h" #include "testing/gtest/include/gtest/gtest.h" -#include "webkit/forms/form_field.h" typedef testing::Test SelectControlHandlerTest; @@ -21,7 +21,7 @@ TEST_F(SelectControlHandlerTest, CreditCardMonthExact) { for (size_t i = 0; i < arraysize(kMonthsNumeric); ++i) options[i] = ASCIIToUTF16(kMonthsNumeric[i]); - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("select-one"); field.option_values = options; field.option_contents = options; @@ -41,7 +41,7 @@ TEST_F(SelectControlHandlerTest, CreditCardMonthAbbreviated) { for (size_t i = 0; i < arraysize(kMonthsAbbreviated); ++i) options[i] = ASCIIToUTF16(kMonthsAbbreviated[i]); - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("select-one"); field.option_values = options; field.option_contents = options; @@ -61,7 +61,7 @@ TEST_F(SelectControlHandlerTest, CreditCardMonthFull) { for (size_t i = 0; i < arraysize(kMonthsFull); ++i) options[i] = ASCIIToUTF16(kMonthsFull[i]); - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("select-one"); field.option_values = options; field.option_contents = options; @@ -80,7 +80,7 @@ TEST_F(SelectControlHandlerTest, CreditCardMonthNumeric) { for (size_t i = 0; i < arraysize(kMonthsNumeric); ++i) options[i] = ASCIIToUTF16(kMonthsNumeric[i]); - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("select-one"); field.option_values = options; field.option_contents = options; @@ -99,7 +99,7 @@ TEST_F(SelectControlHandlerTest, AddressCountryFull) { for (size_t i = 0; i < arraysize(kCountries); ++i) options[i] = ASCIIToUTF16(kCountries[i]); - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("select-one"); field.option_values = options; field.option_contents = options; @@ -118,7 +118,7 @@ TEST_F(SelectControlHandlerTest, AddressCountryAbbrev) { for (size_t i = 0; i < arraysize(kCountries); ++i) options[i] = ASCIIToUTF16(kCountries[i]); - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("select-one"); field.option_values = options; field.option_contents = options; @@ -137,7 +137,7 @@ TEST_F(SelectControlHandlerTest, AddressStateFull) { for (size_t i = 0; i < arraysize(kStates); ++i) options[i] = ASCIIToUTF16(kStates[i]); - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("select-one"); field.option_values = options; field.option_contents = options; @@ -156,7 +156,7 @@ TEST_F(SelectControlHandlerTest, AddressStateAbbrev) { for (size_t i = 0; i < arraysize(kStates); ++i) options[i] = ASCIIToUTF16(kStates[i]); - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("select-one"); field.option_values = options; field.option_contents = options; @@ -178,7 +178,7 @@ TEST_F(SelectControlHandlerTest, FillByValue) { contents[i] = ASCIIToUTF16(base::StringPrintf("%d", static_cast<int>(i))); } - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("select-one"); field.option_values = values; field.option_contents = contents; @@ -200,7 +200,7 @@ TEST_F(SelectControlHandlerTest, FillByContents) { contents[i] = ASCIIToUTF16(kStates[i]); } - webkit::forms::FormField field; + FormFieldData field; field.form_control_type = ASCIIToUTF16("select-one"); field.option_values = values; field.option_contents = contents; diff --git a/chrome/browser/autofill/test_autofill_external_delegate.cc b/chrome/browser/autofill/test_autofill_external_delegate.cc index 6815477..f5f6a74 100644 --- a/chrome/browser/autofill/test_autofill_external_delegate.cc +++ b/chrome/browser/autofill/test_autofill_external_delegate.cc @@ -18,8 +18,8 @@ void TestAutofillExternalDelegate::ApplyAutofillSuggestions( void TestAutofillExternalDelegate::OnQueryPlatformSpecific( int query_id, - const webkit::forms::FormData& form, - const webkit::forms::FormField& field, + const FormData& form, + const FormFieldData& field, const gfx::Rect& bounds) {} void TestAutofillExternalDelegate::HideAutofillPopupInternal() {} diff --git a/chrome/browser/autofill/test_autofill_external_delegate.h b/chrome/browser/autofill/test_autofill_external_delegate.h index 56725ed..f06b3f9 100644 --- a/chrome/browser/autofill/test_autofill_external_delegate.h +++ b/chrome/browser/autofill/test_autofill_external_delegate.h @@ -26,8 +26,8 @@ class TestAutofillExternalDelegate : public AutofillExternalDelegate { const std::vector<int>& autofill_unique_ids) OVERRIDE; virtual void OnQueryPlatformSpecific(int query_id, - const webkit::forms::FormData& form, - const webkit::forms::FormField& field, + const FormData& form, + const FormFieldData& field, const gfx::Rect& bounds) OVERRIDE; diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index b3bc8c1..e277c97 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -1589,7 +1589,7 @@ AutomationProviderGetPasswordsObserver:: void AutomationProviderGetPasswordsObserver::OnPasswordStoreRequestDone( CancelableRequestProvider::Handle handle, - const std::vector<webkit::forms::PasswordForm*>& result) { + const std::vector<content::PasswordForm*>& result) { if (!provider_) { delete this; return; @@ -1598,10 +1598,10 @@ void AutomationProviderGetPasswordsObserver::OnPasswordStoreRequestDone( scoped_ptr<DictionaryValue> return_value(new DictionaryValue); ListValue* passwords = new ListValue; - for (std::vector<webkit::forms::PasswordForm*>::const_iterator it = + for (std::vector<content::PasswordForm*>::const_iterator it = result.begin(); it != result.end(); ++it) { DictionaryValue* password_val = new DictionaryValue; - webkit::forms::PasswordForm* password_form = *it; + content::PasswordForm* password_form = *it; password_val->SetString("username_value", password_form->username_value); password_val->SetString("password_value", password_form->password_value); password_val->SetString("signon_realm", password_form->signon_realm); diff --git a/chrome/browser/automation/automation_provider_observers.h b/chrome/browser/automation/automation_provider_observers.h index 71f5041..ae2b220 100644 --- a/chrome/browser/automation/automation_provider_observers.h +++ b/chrome/browser/automation/automation_provider_observers.h @@ -1187,7 +1187,7 @@ class AutomationProviderGetPasswordsObserver : public PasswordStoreConsumer { virtual void OnPasswordStoreRequestDone( CancelableRequestProvider::Handle handle, - const std::vector<webkit::forms::PasswordForm*>& result) OVERRIDE; + const std::vector<content::PasswordForm*>& result) OVERRIDE; private: base::WeakPtr<AutomationProvider> provider_; diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 8943336a..4417e35 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -3400,7 +3400,7 @@ void TestingAutomationProvider::ImportSettings(Browser* browser, namespace { // Translates a dictionary password to a PasswordForm struct. -webkit::forms::PasswordForm GetPasswordFormFromDict( +content::PasswordForm GetPasswordFormFromDict( const DictionaryValue& password_dict) { // If the time is specified, change time to the specified time. @@ -3440,7 +3440,7 @@ webkit::forms::PasswordForm GetPasswordFormFromDict( GURL origin_gurl(origin_url_text); GURL action_target(action_target_text); - webkit::forms::PasswordForm password_form; + content::PasswordForm password_form; password_form.signon_realm = signon_realm; password_form.username_value = username_value; password_form.password_value = password_value; @@ -3479,7 +3479,7 @@ void TestingAutomationProvider::AddSavedPassword( return; } - webkit::forms::PasswordForm new_password = + content::PasswordForm new_password = GetPasswordFormFromDict(*password_dict); // Use IMPLICIT_ACCESS since new passwords aren't added in incognito mode. @@ -3525,7 +3525,7 @@ void TestingAutomationProvider::RemoveSavedPassword( "Password must include a value for 'signon_realm.'"); return; } - webkit::forms::PasswordForm to_remove = + content::PasswordForm to_remove = GetPasswordFormFromDict(*password_dict); // Use EXPLICIT_ACCESS since passwords can be removed in incognito mode. diff --git a/chrome/browser/importer/external_process_importer_bridge.cc b/chrome/browser/importer/external_process_importer_bridge.cc index b7c56cb..9b0481e 100644 --- a/chrome/browser/importer/external_process_importer_bridge.cc +++ b/chrome/browser/importer/external_process_importer_bridge.cc @@ -12,7 +12,7 @@ #include "base/values.h" #include "chrome/browser/history/history_types.h" #include "chrome/browser/importer/profile_import_process_messages.h" -#include "webkit/forms/password_form.h" +#include "content/public/common/password_form.h" #if defined(OS_WIN) #include "chrome/browser/password_manager/ie7_password.h" @@ -115,7 +115,7 @@ void ExternalProcessImporterBridge::SetKeywords( } void ExternalProcessImporterBridge::SetPasswordForm( - const webkit::forms::PasswordForm& form) { + const content::PasswordForm& form) { Send(new ProfileImportProcessHostMsg_NotifyPasswordFormReady(form)); } diff --git a/chrome/browser/importer/external_process_importer_bridge.h b/chrome/browser/importer/external_process_importer_bridge.h index b2f9ffd..7942ab69 100644 --- a/chrome/browser/importer/external_process_importer_bridge.h +++ b/chrome/browser/importer/external_process_importer_bridge.h @@ -55,7 +55,7 @@ class ExternalProcessImporterBridge : public ImporterBridge { bool unique_on_host_and_path) OVERRIDE; virtual void SetPasswordForm( - const webkit::forms::PasswordForm& form) OVERRIDE; + const content::PasswordForm& form) OVERRIDE; virtual void NotifyStarted() OVERRIDE; virtual void NotifyItemStarted(importer::ImportItem item) OVERRIDE; diff --git a/chrome/browser/importer/external_process_importer_client.cc b/chrome/browser/importer/external_process_importer_client.cc index e66b6e05..36dc21d 100644 --- a/chrome/browser/importer/external_process_importer_client.cc +++ b/chrome/browser/importer/external_process_importer_client.cc @@ -219,7 +219,7 @@ void ExternalProcessImporterClient::OnFaviconsImportGroup( } void ExternalProcessImporterClient::OnPasswordFormImportReady( - const webkit::forms::PasswordForm& form) { + const content::PasswordForm& form) { if (cancelled_) return; diff --git a/chrome/browser/importer/external_process_importer_client.h b/chrome/browser/importer/external_process_importer_client.h index 9470045..092901f 100644 --- a/chrome/browser/importer/external_process_importer_client.h +++ b/chrome/browser/importer/external_process_importer_client.h @@ -65,7 +65,7 @@ class ExternalProcessImporterClient : public content::UtilityProcessHostClient { void OnFaviconsImportStart(size_t total_favicons_count); void OnFaviconsImportGroup( const std::vector<history::ImportedFaviconUsage>& favicons_group); - void OnPasswordFormImportReady(const webkit::forms::PasswordForm& form); + void OnPasswordFormImportReady(const content::PasswordForm& form); // WARNING: This function takes ownership of (and deletes) the pointers in // |template_urls|! void OnKeywordsImportReady(const std::vector<TemplateURL*>& template_urls, diff --git a/chrome/browser/importer/firefox2_importer.cc b/chrome/browser/importer/firefox2_importer.cc index 09063ed..b05a554 100644 --- a/chrome/browser/importer/firefox2_importer.cc +++ b/chrome/browser/importer/firefox2_importer.cc @@ -26,10 +26,10 @@ #include "chrome/browser/search_engines/template_url.h" #include "chrome/common/time_format.h" #include "chrome/common/url_constants.h" +#include "content/public/common/password_form.h" #include "googleurl/src/gurl.h" #include "grit/generated_resources.h" #include "net/base/data_url.h" -#include "webkit/forms/password_form.h" namespace { const char kItemOpen[] = "<DT><A"; @@ -338,7 +338,7 @@ void Firefox2Importer::ImportPasswords() { std::string content; file_util::ReadFileToString(file, &content); - std::vector<webkit::forms::PasswordForm> forms; + std::vector<content::PasswordForm> forms; decryptor.ParseSignons(content, &forms); if (!cancelled()) { diff --git a/chrome/browser/importer/firefox3_importer.cc b/chrome/browser/importer/firefox3_importer.cc index 948df98..6a38c66 100644 --- a/chrome/browser/importer/firefox3_importer.cc +++ b/chrome/browser/importer/firefox3_importer.cc @@ -22,11 +22,11 @@ #include "chrome/browser/search_engines/template_url.h" #include "chrome/common/time_format.h" #include "content/public/browser/browser_thread.h" +#include "content/public/common/password_form.h" #include "googleurl/src/gurl.h" #include "grit/generated_resources.h" #include "sql/connection.h" #include "sql/statement.h" -#include "webkit/forms/password_form.h" using content::BrowserThread; @@ -307,7 +307,7 @@ void Firefox3Importer::ImportPasswords() { return; } - std::vector<webkit::forms::PasswordForm> forms; + std::vector<content::PasswordForm> forms; FilePath source_path = source_path_; FilePath file = source_path.AppendASCII("signons.sqlite"); if (file_util::PathExists(file)) { diff --git a/chrome/browser/importer/firefox_importer_unittest.cc b/chrome/browser/importer/firefox_importer_unittest.cc index e684209..c0f0ba1 100644 --- a/chrome/browser/importer/firefox_importer_unittest.cc +++ b/chrome/browser/importer/firefox_importer_unittest.cc @@ -25,7 +25,7 @@ #include "chrome/browser/search_engines/template_url.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/base/testing_profile.h" -#include "webkit/forms/password_form.h" +#include "content/public/common/password_form.h" // TODO(estade): some of these are disabled on mac. http://crbug.com/48007 #if defined(OS_MACOSX) @@ -150,7 +150,7 @@ class FirefoxObserver : public ProfileWriter, return true; } - virtual void AddPasswordForm(const webkit::forms::PasswordForm& form) { + virtual void AddPasswordForm(const content::PasswordForm& form) { PasswordInfo p = kFirefox2Passwords[password_count_]; EXPECT_EQ(p.origin, form.origin.spec()); EXPECT_EQ(p.realm, form.signon_realm); @@ -295,7 +295,7 @@ class Firefox3Observer : public ProfileWriter, return true; } - virtual void AddPasswordForm(const webkit::forms::PasswordForm& form) { + virtual void AddPasswordForm(const content::PasswordForm& form) { PasswordInfo p = kFirefox3Passwords[password_count_]; EXPECT_EQ(p.origin, form.origin.spec()); EXPECT_EQ(p.realm, form.signon_realm); diff --git a/chrome/browser/importer/ie_importer.cc b/chrome/browser/importer/ie_importer.cc index 03978e2..1c297d9 100644 --- a/chrome/browser/importer/ie_importer.cc +++ b/chrome/browser/importer/ie_importer.cc @@ -38,10 +38,10 @@ #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/common/time_format.h" #include "chrome/common/url_constants.h" +#include "content/public/common/password_form.h" #include "googleurl/src/gurl.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" -#include "webkit/forms/password_form.h" namespace { @@ -609,7 +609,7 @@ void IEImporter::ImportPasswordsIE6() { continue; } - webkit::forms::PasswordForm form; + content::PasswordForm form; GURL::Replacements rp; rp.ClearUsername(); rp.ClearPassword(); diff --git a/chrome/browser/importer/ie_importer_unittest_win.cc b/chrome/browser/importer/ie_importer_unittest_win.cc index 700d8a0..a86345c 100644 --- a/chrome/browser/importer/ie_importer_unittest_win.cc +++ b/chrome/browser/importer/ie_importer_unittest_win.cc @@ -39,7 +39,7 @@ #include "chrome/browser/search_engines/template_url.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/base/testing_profile.h" -#include "webkit/forms/password_form.h" +#include "content/public/common/password_form.h" namespace { @@ -280,7 +280,7 @@ class TestObserver : public ProfileWriter, return true; } - virtual void AddPasswordForm(const webkit::forms::PasswordForm& form) { + virtual void AddPasswordForm(const content::PasswordForm& form) { // Importer should obtain this password form only. EXPECT_EQ(GURL("http://localhost:8080/security/index.htm"), form.origin); EXPECT_EQ("http://localhost:8080/", form.signon_realm); @@ -377,7 +377,7 @@ class MalformedFavoritesRegistryTestObserver virtual bool BookmarkModelIsLoaded() const { return true; } virtual bool TemplateURLServiceIsLoaded() const { return true; } - virtual void AddPasswordForm(const webkit::forms::PasswordForm& form) {} + virtual void AddPasswordForm(const content::PasswordForm& form) {} virtual void AddHistoryPage(const history::URLRows& page, history::VisitSource visit_source) {} virtual void AddKeyword(std::vector<TemplateURL*> template_url, diff --git a/chrome/browser/importer/importer_bridge.h b/chrome/browser/importer/importer_bridge.h index fa8f377..83f9176 100644 --- a/chrome/browser/importer/importer_bridge.h +++ b/chrome/browser/importer/importer_bridge.h @@ -42,7 +42,7 @@ class ImporterBridge : public base::RefCountedThreadSafe<ImporterBridge> { virtual void SetKeywords(const std::vector<TemplateURL*>& template_urls, bool unique_on_host_and_path) = 0; - virtual void SetPasswordForm(const webkit::forms::PasswordForm& form) = 0; + virtual void SetPasswordForm(const content::PasswordForm& form) = 0; // Notifies the coordinator that the import operation has begun. virtual void NotifyStarted() = 0; diff --git a/chrome/browser/importer/in_process_importer_bridge.cc b/chrome/browser/importer/in_process_importer_bridge.cc index d5a1071..5e7be7d 100644 --- a/chrome/browser/importer/in_process_importer_bridge.cc +++ b/chrome/browser/importer/in_process_importer_bridge.cc @@ -9,8 +9,8 @@ #include "chrome/browser/importer/importer_host.h" #include "chrome/browser/search_engines/template_url.h" #include "content/public/browser/browser_thread.h" +#include "content/public/common/password_form.h" #include "ui/base/l10n/l10n_util.h" -#include "webkit/forms/password_form.h" #if defined(OS_WIN) #include "chrome/browser/password_manager/ie7_password.h" @@ -77,7 +77,7 @@ void InProcessImporterBridge::SetKeywords( } void InProcessImporterBridge::SetPasswordForm( - const webkit::forms::PasswordForm& form) { + const content::PasswordForm& form) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&ProfileWriter::AddPasswordForm, writer_, form)); diff --git a/chrome/browser/importer/in_process_importer_bridge.h b/chrome/browser/importer/in_process_importer_bridge.h index 24876ea..25b5961 100644 --- a/chrome/browser/importer/in_process_importer_bridge.h +++ b/chrome/browser/importer/in_process_importer_bridge.h @@ -43,7 +43,7 @@ class InProcessImporterBridge : public ImporterBridge { bool unique_on_host_and_path) OVERRIDE; virtual void SetPasswordForm( - const webkit::forms::PasswordForm& form) OVERRIDE; + const content::PasswordForm& form) OVERRIDE; virtual void NotifyStarted() OVERRIDE; virtual void NotifyItemStarted(importer::ImportItem item) OVERRIDE; diff --git a/chrome/browser/importer/nss_decryptor.cc b/chrome/browser/importer/nss_decryptor.cc index 4d5a385..4439813 100644 --- a/chrome/browser/importer/nss_decryptor.cc +++ b/chrome/browser/importer/nss_decryptor.cc @@ -12,9 +12,9 @@ #include "base/string_split.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" +#include "content/public/common/password_form.h" #include "sql/connection.h" #include "sql/statement.h" -#include "webkit/forms/password_form.h" #if defined(USE_NSS) #include <pk11pub.h> @@ -112,7 +112,7 @@ string16 NSSDecryptor::Decrypt(const std::string& crypt) const { // http://kb.mozillazine.org/Signons3.txt void NSSDecryptor::ParseSignons( const std::string& content, - std::vector<webkit::forms::PasswordForm>* forms) { + std::vector<content::PasswordForm>* forms) { forms->clear(); // Splits the file content into lines. @@ -141,7 +141,7 @@ void NSSDecryptor::ParseSignons( // Reads never-saved list. Domains are stored one per line. size_t i; for (i = 1; i < lines.size() && lines[i].compare(".") != 0; ++i) { - webkit::forms::PasswordForm form; + content::PasswordForm form; form.origin = GURL(lines[i]).ReplaceComponents(rep); form.signon_realm = form.origin.GetOrigin().spec(); form.blacklisted_by_user = true; @@ -163,7 +163,7 @@ void NSSDecryptor::ParseSignons( if (end - begin < 5) continue; - webkit::forms::PasswordForm form; + content::PasswordForm form; // The first line is the site URL. // For HTTP authentication logins, the URL may contain http realm, @@ -233,7 +233,7 @@ void NSSDecryptor::ParseSignons( } bool NSSDecryptor::ReadAndParseSignons(const FilePath& sqlite_file, - std::vector<webkit::forms::PasswordForm>* forms) { + std::vector<content::PasswordForm>* forms) { sql::Connection db; if (!db.Open(sqlite_file)) return false; @@ -250,7 +250,7 @@ bool NSSDecryptor::ReadAndParseSignons(const FilePath& sqlite_file, rep.ClearPassword(); // Read domains for which passwords are never saved. while (s.Step()) { - webkit::forms::PasswordForm form; + content::PasswordForm form; form.origin = GURL(s.ColumnString(0)).ReplaceComponents(rep); form.signon_realm = form.origin.GetOrigin().spec(); form.blacklisted_by_user = true; @@ -281,7 +281,7 @@ bool NSSDecryptor::ReadAndParseSignons(const FilePath& sqlite_file, if (!url.is_valid()) continue; - webkit::forms::PasswordForm form; + content::PasswordForm form; form.origin = url.ReplaceComponents(rep); form.signon_realm = form.origin.GetOrigin().spec(); if (!realm.empty()) diff --git a/chrome/browser/importer/nss_decryptor_mac.h b/chrome/browser/importer/nss_decryptor_mac.h index 3e0b181..7cae82e 100644 --- a/chrome/browser/importer/nss_decryptor_mac.h +++ b/chrome/browser/importer/nss_decryptor_mac.h @@ -105,11 +105,9 @@ typedef void (*SECITEMFreeItemFunc)(SECItem *item, PRBool free_it); typedef void (*PLArenaFinishFunc)(void); typedef PRStatus (*PRCleanupFunc)(void); -namespace webkit { -namespace forms { +namespace content { struct PasswordForm; } -} // A wrapper for Firefox NSS decrypt component. class NSSDecryptor { @@ -132,13 +130,13 @@ class NSSDecryptor { // username/password and reads other related information. // The result will be stored in |forms|. void ParseSignons(const std::string& content, - std::vector<webkit::forms::PasswordForm>* forms); + std::vector<content::PasswordForm>* forms); // Reads and parses the Firefox password sqlite db, decrypts the // username/password and reads other related information. // The result will be stored in |forms|. bool ReadAndParseSignons(const FilePath& sqlite_file, - std::vector<webkit::forms::PasswordForm>* forms); + std::vector<content::PasswordForm>* forms); private: PK11SlotInfo* GetKeySlotForDB() const { return PK11_GetInternalKeySlot(); } void FreeSlot(PK11SlotInfo* slot) const { PK11_FreeSlot(slot); } diff --git a/chrome/browser/importer/nss_decryptor_null.h b/chrome/browser/importer/nss_decryptor_null.h index 040df33..4fd6934 100644 --- a/chrome/browser/importer/nss_decryptor_null.h +++ b/chrome/browser/importer/nss_decryptor_null.h @@ -13,11 +13,9 @@ class FilePath; -namespace webkit { -namespace forms { +namespace content { struct PasswordForm; } -} // A NULL wrapper for Firefox NSS decrypt component, for use in builds where // we do not have the NSS library. @@ -27,9 +25,9 @@ class NSSDecryptor { bool Init(const FilePath& dll_path, const FilePath& db_path) { return false; } string16 Decrypt(const std::string& crypt) const { return string16(); } void ParseSignons(const std::string& content, - std::vector<webkit::forms::PasswordForm>* forms) {} + std::vector<content::PasswordForm>* forms) {} bool ReadAndParseSignons(const FilePath& sqlite_file, - std::vector<webkit::forms::PasswordForm>* forms) { + std::vector<content::PasswordForm>* forms) { return false; } diff --git a/chrome/browser/importer/nss_decryptor_system_nss.h b/chrome/browser/importer/nss_decryptor_system_nss.h index e055fa9..c125da9 100644 --- a/chrome/browser/importer/nss_decryptor_system_nss.h +++ b/chrome/browser/importer/nss_decryptor_system_nss.h @@ -14,11 +14,9 @@ class FilePath; -namespace webkit { -namespace forms { +namespace content { struct PasswordForm; } -} // A wrapper for Firefox NSS decrypt component. class NSSDecryptor { @@ -37,13 +35,13 @@ class NSSDecryptor { // username/password and reads other related information. // The result will be stored in |forms|. void ParseSignons(const std::string& content, - std::vector<webkit::forms::PasswordForm>* forms); + std::vector<content::PasswordForm>* forms); // Reads and parses the Firefox password sqlite db, decrypts the // username/password and reads other related information. // The result will be stored in |forms|. bool ReadAndParseSignons(const FilePath& sqlite_file, - std::vector<webkit::forms::PasswordForm>* forms); + std::vector<content::PasswordForm>* forms); private: // Does not actually free the slot, since we'll free it when NSSDecryptor is // destroyed. diff --git a/chrome/browser/importer/nss_decryptor_win.h b/chrome/browser/importer/nss_decryptor_win.h index 5fea1a9..1aeb266 100644 --- a/chrome/browser/importer/nss_decryptor_win.h +++ b/chrome/browser/importer/nss_decryptor_win.h @@ -104,11 +104,9 @@ typedef void (*SECITEMFreeItemFunc)(SECItem *item, PRBool free_it); typedef void (*PLArenaFinishFunc)(void); typedef PRStatus (*PRCleanupFunc)(void); -namespace webkit { -namespace forms { +namespace content { struct PasswordForm; } -} // A wrapper for Firefox NSS decrypt component. class NSSDecryptor { @@ -132,13 +130,13 @@ class NSSDecryptor { // username/password and reads other related information. // The result will be stored in |forms|. void ParseSignons(const std::string& content, - std::vector<webkit::forms::PasswordForm>* forms); + std::vector<content::PasswordForm>* forms); // Reads and parses the Firefox password sqlite db, decrypts the // username/password and reads other related information. // The result will be stored in |forms|. bool ReadAndParseSignons(const FilePath& sqlite_file, - std::vector<webkit::forms::PasswordForm>* forms); + std::vector<content::PasswordForm>* forms); private: // Call NSS initialization funcs. diff --git a/chrome/browser/importer/profile_import_process_messages.h b/chrome/browser/importer/profile_import_process_messages.h index d2300dd..d697a1e 100644 --- a/chrome/browser/importer/profile_import_process_messages.h +++ b/chrome/browser/importer/profile_import_process_messages.h @@ -15,9 +15,9 @@ #include "chrome/browser/search_engines/template_url.h" #include "chrome/common/common_param_traits_macros.h" #include "content/public/common/common_param_traits.h" +#include "content/public/common/password_form.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_utils.h" -#include "webkit/forms/password_form.h" #ifndef CHROME_BROWSER_IMPORTER_PROFILE_IMPORT_PROCESS_MESSAGES_H_ #define CHROME_BROWSER_IMPORTER_PROFILE_IMPORT_PROCESS_MESSAGES_H_ @@ -331,7 +331,7 @@ IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyFaviconsImportGroup, std::vector<history::ImportedFaviconUsage>) IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyPasswordFormReady, - webkit::forms::PasswordForm) + content::PasswordForm) // WARNING: The TemplateURL*s in the following message get heap-allocated on the // receiving end. The message handler for this message MUST take ownership of diff --git a/chrome/browser/importer/profile_writer.cc b/chrome/browser/importer/profile_writer.cc index e7a6d20..ae536fb 100644 --- a/chrome/browser/importer/profile_writer.cc +++ b/chrome/browser/importer/profile_writer.cc @@ -91,7 +91,7 @@ bool ProfileWriter::TemplateURLServiceIsLoaded() const { return TemplateURLServiceFactory::GetForProfile(profile_)->loaded(); } -void ProfileWriter::AddPasswordForm(const webkit::forms::PasswordForm& form) { +void ProfileWriter::AddPasswordForm(const content::PasswordForm& form) { PasswordStoreFactory::GetForProfile( profile_, Profile::EXPLICIT_ACCESS)->AddLogin(form); } diff --git a/chrome/browser/importer/profile_writer.h b/chrome/browser/importer/profile_writer.h index 7714828..f4fc4db1 100644 --- a/chrome/browser/importer/profile_writer.h +++ b/chrome/browser/importer/profile_writer.h @@ -19,11 +19,9 @@ class Profile; class TemplateURL; -namespace webkit { -namespace forms { +namespace content { struct PasswordForm; } -} #if defined(OS_WIN) struct IE7PasswordInfo; @@ -55,7 +53,7 @@ class ProfileWriter : public base::RefCountedThreadSafe<ProfileWriter> { virtual bool TemplateURLServiceIsLoaded() const; // Helper methods for adding data to local stores. - virtual void AddPasswordForm(const webkit::forms::PasswordForm& form); + virtual void AddPasswordForm(const content::PasswordForm& form); #if defined(OS_WIN) virtual void AddIE7PasswordInfo(const IE7PasswordInfo& info); diff --git a/chrome/browser/password_manager/login_database.cc b/chrome/browser/password_manager/login_database.cc index 1427f47..a2f4d03 100644 --- a/chrome/browser/password_manager/login_database.cc +++ b/chrome/browser/password_manager/login_database.cc @@ -16,7 +16,7 @@ #include "sql/statement.h" #include "sql/transaction.h" -using webkit::forms::PasswordForm; +using content::PasswordForm; static const int kCurrentVersionNumber = 1; static const int kCompatibleVersionNumber = 1; @@ -297,7 +297,7 @@ bool LoginDatabase::GetLogins(const PasswordForm& form, bool LoginDatabase::GetLoginsCreatedBetween( const base::Time begin, const base::Time end, - std::vector<webkit::forms::PasswordForm*>* forms) const { + std::vector<content::PasswordForm*>* forms) const { DCHECK(forms); sql::Statement s(db_.GetCachedStatement(SQL_FROM_HERE, "SELECT origin_url, action_url, " diff --git a/chrome/browser/password_manager/login_database.h b/chrome/browser/password_manager/login_database.h index 06ac6f1..e37b966 100644 --- a/chrome/browser/password_manager/login_database.h +++ b/chrome/browser/password_manager/login_database.h @@ -10,9 +10,9 @@ #include "base/file_path.h" #include "base/string16.h" +#include "content/public/common/password_form.h" #include "sql/connection.h" #include "sql/meta_table.h" -#include "webkit/forms/password_form.h" // Interface to the database storage of login information, intended as a helper // for PasswordStore on platforms that need internal storage of some or all of @@ -30,14 +30,14 @@ class LoginDatabase { void ReportMetrics(); // Adds |form| to the list of remembered password forms. - bool AddLogin(const webkit::forms::PasswordForm& form); + bool AddLogin(const content::PasswordForm& form); // Updates remembered password form. Returns true on success and sets // items_changed (if non-NULL) to the number of logins updated. - bool UpdateLogin(const webkit::forms::PasswordForm& form, int* items_changed); + bool UpdateLogin(const content::PasswordForm& form, int* items_changed); // Removes |form| from the list of remembered password forms. - bool RemoveLogin(const webkit::forms::PasswordForm& form); + bool RemoveLogin(const content::PasswordForm& form); // Removes all logins created from |delete_begin| onwards (inclusive) and // before |delete_end|. You may use a null Time value to do an unbounded @@ -48,8 +48,8 @@ class LoginDatabase { // Loads a list of matching password forms into the specified vector |forms|. // The list will contain all possibly relevant entries to the observed |form|, // including blacklisted matches. - bool GetLogins(const webkit::forms::PasswordForm& form, - std::vector<webkit::forms::PasswordForm*>* forms) const; + bool GetLogins(const content::PasswordForm& form, + std::vector<content::PasswordForm*>* forms) const; // Loads all logins created from |begin| onwards (inclusive) and before |end|. // You may use a null Time value to do an unbounded search in either @@ -57,16 +57,16 @@ class LoginDatabase { bool GetLoginsCreatedBetween( const base::Time begin, const base::Time end, - std::vector<webkit::forms::PasswordForm*>* forms) const; + std::vector<content::PasswordForm*>* forms) const; // Loads the complete list of autofillable password forms (i.e., not blacklist // entries) into |forms|. bool GetAutofillableLogins( - std::vector<webkit::forms::PasswordForm*>* forms) const; + std::vector<content::PasswordForm*>* forms) const; // Loads the complete list of blacklist forms into |forms|. bool GetBlacklistLogins( - std::vector<webkit::forms::PasswordForm*>* forms) const; + std::vector<content::PasswordForm*>* forms) const; // Deletes the login database file on disk, and creates a new, empty database. // This can be used after migrating passwords to some other store, to ensure @@ -87,13 +87,13 @@ class LoginDatabase { // Fills |form| from the values in the given statement (which is assumed to // be of the form used by the Get*Logins methods). - void InitPasswordFormFromStatement(webkit::forms::PasswordForm* form, + void InitPasswordFormFromStatement(content::PasswordForm* form, sql::Statement& s) const; // Loads all logins whose blacklist setting matches |blacklisted| into // |forms|. bool GetAllLoginsWithBlacklistSetting( - bool blacklisted, std::vector<webkit::forms::PasswordForm*>* forms) const; + bool blacklisted, std::vector<content::PasswordForm*>* forms) const; FilePath db_path_; mutable sql::Connection db_; diff --git a/chrome/browser/password_manager/login_database_unittest.cc b/chrome/browser/password_manager/login_database_unittest.cc index d2486a2..c31376d 100644 --- a/chrome/browser/password_manager/login_database_unittest.cc +++ b/chrome/browser/password_manager/login_database_unittest.cc @@ -13,9 +13,9 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/password_manager/login_database.h" #include "chrome/common/chrome_paths.h" -#include "webkit/forms/password_form.h" +#include "content/public/common/password_form.h" -using webkit::forms::PasswordForm; +using content::PasswordForm; class LoginDatabaseTest : public testing::Test { protected: diff --git a/chrome/browser/password_manager/mock_password_store.h b/chrome/browser/password_manager/mock_password_store.h index 627b5db..608c2ad 100644 --- a/chrome/browser/password_manager/mock_password_store.h +++ b/chrome/browser/password_manager/mock_password_store.h @@ -6,8 +6,8 @@ #define CHROME_BROWSER_PASSWORD_MANAGER_MOCK_PASSWORD_STORE_H_ #include "chrome/browser/password_manager/password_store.h" +#include "content/public/common/password_form.h" #include "testing/gmock/include/gmock/gmock.h" -#include "webkit/forms/password_form.h" class Profile; @@ -17,26 +17,26 @@ class MockPasswordStore : public PasswordStore { static scoped_refptr<RefcountedProfileKeyedService> Build(Profile* profile); - MOCK_METHOD1(RemoveLogin, void(const webkit::forms::PasswordForm&)); - MOCK_METHOD2(GetLogins, int(const webkit::forms::PasswordForm&, + MOCK_METHOD1(RemoveLogin, void(const content::PasswordForm&)); + MOCK_METHOD2(GetLogins, int(const content::PasswordForm&, PasswordStoreConsumer*)); - MOCK_METHOD1(AddLogin, void(const webkit::forms::PasswordForm&)); - MOCK_METHOD1(UpdateLogin, void(const webkit::forms::PasswordForm&)); + MOCK_METHOD1(AddLogin, void(const content::PasswordForm&)); + MOCK_METHOD1(UpdateLogin, void(const content::PasswordForm&)); MOCK_METHOD0(ReportMetrics, void()); MOCK_METHOD0(ReportMetricsImpl, void()); - MOCK_METHOD1(AddLoginImpl, void(const webkit::forms::PasswordForm&)); - MOCK_METHOD1(UpdateLoginImpl, void(const webkit::forms::PasswordForm&)); - MOCK_METHOD1(RemoveLoginImpl, void(const webkit::forms::PasswordForm&)); + MOCK_METHOD1(AddLoginImpl, void(const content::PasswordForm&)); + MOCK_METHOD1(UpdateLoginImpl, void(const content::PasswordForm&)); + MOCK_METHOD1(RemoveLoginImpl, void(const content::PasswordForm&)); MOCK_METHOD2(RemoveLoginsCreatedBetweenImpl, void(const base::Time&, const base::Time&)); MOCK_METHOD2(GetLoginsImpl, void(GetLoginsRequest*, - const webkit::forms::PasswordForm&)); + const content::PasswordForm&)); MOCK_METHOD1(GetAutofillableLoginsImpl, void(GetLoginsRequest*)); MOCK_METHOD1(GetBlacklistLoginsImpl, void(GetLoginsRequest*)); MOCK_METHOD1(FillAutofillableLogins, - bool(std::vector<webkit::forms::PasswordForm*>*)); + bool(std::vector<content::PasswordForm*>*)); MOCK_METHOD1(FillBlacklistLogins, - bool(std::vector<webkit::forms::PasswordForm*>*)); + bool(std::vector<content::PasswordForm*>*)); virtual void ShutdownOnUIThread(); diff --git a/chrome/browser/password_manager/native_backend_gnome_x.cc b/chrome/browser/password_manager/native_backend_gnome_x.cc index 94dcdd2..6fa8f6c 100644 --- a/chrome/browser/password_manager/native_backend_gnome_x.cc +++ b/chrome/browser/password_manager/native_backend_gnome_x.cc @@ -22,7 +22,7 @@ #include "content/public/browser/browser_thread.h" using content::BrowserThread; -using webkit::forms::PasswordForm; +using content::PasswordForm; #define GNOME_KEYRING_DEFINE_POINTER(name) \ typeof(&::gnome_keyring_##name) GnomeKeyringLoader::gnome_keyring_##name; diff --git a/chrome/browser/password_manager/native_backend_gnome_x.h b/chrome/browser/password_manager/native_backend_gnome_x.h index 233eb84..f421831 100644 --- a/chrome/browser/password_manager/native_backend_gnome_x.h +++ b/chrome/browser/password_manager/native_backend_gnome_x.h @@ -17,11 +17,9 @@ class PrefService; -namespace webkit { -namespace forms { +namespace content { struct PasswordForm; } -} // Many of the gnome_keyring_* functions use variable arguments, which makes // them difficult if not impossible to truly wrap in C. Therefore, we use @@ -75,12 +73,12 @@ class NativeBackendGnome : public PasswordStoreX::NativeBackend, virtual bool Init() OVERRIDE; // Implements NativeBackend interface. - virtual bool AddLogin(const webkit::forms::PasswordForm& form) OVERRIDE; - virtual bool UpdateLogin(const webkit::forms::PasswordForm& form) OVERRIDE; - virtual bool RemoveLogin(const webkit::forms::PasswordForm& form) OVERRIDE; + virtual bool AddLogin(const content::PasswordForm& form) OVERRIDE; + virtual bool UpdateLogin(const content::PasswordForm& form) OVERRIDE; + virtual bool RemoveLogin(const content::PasswordForm& form) OVERRIDE; virtual bool RemoveLoginsCreatedBetween( const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; - virtual bool GetLogins(const webkit::forms::PasswordForm& form, + virtual bool GetLogins(const content::PasswordForm& form, PasswordFormList* forms) OVERRIDE; virtual bool GetLoginsCreatedBetween(const base::Time& get_begin, const base::Time& get_end, @@ -90,7 +88,7 @@ class NativeBackendGnome : public PasswordStoreX::NativeBackend, private: // Adds a login form without checking for one to replace first. - bool RawAddLogin(const webkit::forms::PasswordForm& form); + bool RawAddLogin(const content::PasswordForm& form); // Reads PasswordForms from the keyring with the given autofillability state. bool GetLoginsList(PasswordFormList* forms, bool autofillable); diff --git a/chrome/browser/password_manager/native_backend_gnome_x_unittest.cc b/chrome/browser/password_manager/native_backend_gnome_x_unittest.cc index b1163c5..eb0e44d 100644 --- a/chrome/browser/password_manager/native_backend_gnome_x_unittest.cc +++ b/chrome/browser/password_manager/native_backend_gnome_x_unittest.cc @@ -18,7 +18,7 @@ #include "testing/gtest/include/gtest/gtest.h" using content::BrowserThread; -using webkit::forms::PasswordForm; +using content::PasswordForm; namespace { diff --git a/chrome/browser/password_manager/native_backend_kwallet_x.cc b/chrome/browser/password_manager/native_backend_kwallet_x.cc index 66208a1..d88ac50 100644 --- a/chrome/browser/password_manager/native_backend_kwallet_x.cc +++ b/chrome/browser/password_manager/native_backend_kwallet_x.cc @@ -22,7 +22,7 @@ #include "ui/base/l10n/l10n_util.h" using content::BrowserThread; -using webkit::forms::PasswordForm; +using content::PasswordForm; // We could localize this string, but then changing your locale would cause // you to lose access to all your stored passwords. Maybe best not to do that. diff --git a/chrome/browser/password_manager/native_backend_kwallet_x.h b/chrome/browser/password_manager/native_backend_kwallet_x.h index 0bd909e..4bcfc8f 100644 --- a/chrome/browser/password_manager/native_backend_kwallet_x.h +++ b/chrome/browser/password_manager/native_backend_kwallet_x.h @@ -18,11 +18,9 @@ class Pickle; class PickleIterator; class PrefService; -namespace webkit { -namespace forms { +namespace content { struct PasswordForm; } -} namespace base { class WaitableEvent; @@ -43,12 +41,12 @@ class NativeBackendKWallet : public PasswordStoreX::NativeBackend { virtual bool Init() OVERRIDE; // Implements NativeBackend interface. - virtual bool AddLogin(const webkit::forms::PasswordForm& form) OVERRIDE; - virtual bool UpdateLogin(const webkit::forms::PasswordForm& form) OVERRIDE; - virtual bool RemoveLogin(const webkit::forms::PasswordForm& form) OVERRIDE; + virtual bool AddLogin(const content::PasswordForm& form) OVERRIDE; + virtual bool UpdateLogin(const content::PasswordForm& form) OVERRIDE; + virtual bool RemoveLogin(const content::PasswordForm& form) OVERRIDE; virtual bool RemoveLoginsCreatedBetween( const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; - virtual bool GetLogins(const webkit::forms::PasswordForm& form, + virtual bool GetLogins(const content::PasswordForm& form, PasswordFormList* forms) OVERRIDE; virtual bool GetLoginsCreatedBetween(const base::Time& get_begin, const base::Time& get_end, @@ -127,8 +125,8 @@ class NativeBackendKWallet : public PasswordStoreX::NativeBackend { // If |update_check| is false, we only check the fields that are checked by // LoginDatabase::UpdateLogin() when updating logins; otherwise, we check the // fields that are checked by LoginDatabase::RemoveLogin() for removing them. - static bool CompareForms(const webkit::forms::PasswordForm& a, - const webkit::forms::PasswordForm& b, + static bool CompareForms(const content::PasswordForm& a, + const content::PasswordForm& b, bool update_check); // Serializes a list of PasswordForms to be stored in the wallet. diff --git a/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc b/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc index 3157a29..32c2648 100644 --- a/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc +++ b/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc @@ -29,7 +29,7 @@ using content::BrowserThread; using testing::_; using testing::Invoke; using testing::Return; -using webkit::forms::PasswordForm; +using content::PasswordForm; namespace { diff --git a/chrome/browser/password_manager/password_form_data.cc b/chrome/browser/password_manager/password_form_data.cc index 3c6f377..c2c9a01 100644 --- a/chrome/browser/password_manager/password_form_data.cc +++ b/chrome/browser/password_manager/password_form_data.cc @@ -6,7 +6,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/password_manager/password_form_data.h" -using webkit::forms::PasswordForm; +using content::PasswordForm; PasswordForm* CreatePasswordFormFromData( const PasswordFormData& form_data) { @@ -69,7 +69,7 @@ std::ostream& operator<<(std::ostream& os, const PasswordForm& form) { << "date_created: " << form.date_created.ToDoubleT(); } -typedef std::set<const webkit::forms::PasswordForm*> SetOfForms; +typedef std::set<const content::PasswordForm*> SetOfForms; bool ContainsSamePasswordFormsPtr( const std::vector<PasswordForm*>& first, @@ -105,8 +105,8 @@ bool ContainsSamePasswordFormsPtr( } bool ContainsSamePasswordForms( - std::vector<webkit::forms::PasswordForm>& first, - std::vector<webkit::forms::PasswordForm>& second) { + std::vector<content::PasswordForm>& first, + std::vector<content::PasswordForm>& second) { std::vector<PasswordForm*> first_ptr; for (unsigned int i = 0; i < first.size(); ++i) { first_ptr.push_back(&first[i]); diff --git a/chrome/browser/password_manager/password_form_data.h b/chrome/browser/password_manager/password_form_data.h index 35be0de..0bc512f 100644 --- a/chrome/browser/password_manager/password_form_data.h +++ b/chrome/browser/password_manager/password_form_data.h @@ -7,13 +7,13 @@ #include <ostream> +#include "content/public/common/password_form.h" #include "testing/gmock/include/gmock/gmock.h" -#include "webkit/forms/password_form.h" // Struct used for creation of PasswordForms from static arrays of data. // Note: This is only meant to be used in unit test. struct PasswordFormData { - const webkit::forms::PasswordForm::Scheme scheme; + const content::PasswordForm::Scheme scheme; const char* signon_realm; const char* origin; const char* action; @@ -29,23 +29,23 @@ struct PasswordFormData { // Creates and returns a new PasswordForm built from form_data. Caller is // responsible for deleting the object when finished with it. -webkit::forms::PasswordForm* CreatePasswordFormFromData( +content::PasswordForm* CreatePasswordFormFromData( const PasswordFormData& form_data); // Checks whether two vectors of PasswordForms contain equivalent elements, // regardless of order. bool ContainsSamePasswordFormsPtr( - const std::vector<webkit::forms::PasswordForm*>& first, - const std::vector<webkit::forms::PasswordForm*>& second); + const std::vector<content::PasswordForm*>& first, + const std::vector<content::PasswordForm*>& second); bool ContainsSamePasswordForms( - std::vector<webkit::forms::PasswordForm>& first, - std::vector<webkit::forms::PasswordForm>& second); + std::vector<content::PasswordForm>& first, + std::vector<content::PasswordForm>& second); // Pretty-prints the contents of a PasswordForm. // TODO(sync): This file must eventually be refactored away -- crbug.com/87185. std::ostream& operator<<(std::ostream& os, - const webkit::forms::PasswordForm& form); + const content::PasswordForm& form); // This gmock matcher is used to check that the |arg| contains exactly the same // PasswordForms as |forms|, regardless of order. diff --git a/chrome/browser/password_manager/password_form_manager.cc b/chrome/browser/password_manager/password_form_manager.cc index 16b3075..6aacd0c 100644 --- a/chrome/browser/password_manager/password_form_manager.cc +++ b/chrome/browser/password_manager/password_form_manager.cc @@ -16,11 +16,11 @@ #include "chrome/common/autofill_messages.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" -#include "webkit/forms/password_form_dom_manager.h" +#include "content/public/common/password_form.h" using base::Time; -using webkit::forms::PasswordForm; -using webkit::forms::PasswordFormMap; +using content::PasswordForm; +using content::PasswordFormMap; PasswordFormManager::PasswordFormManager(Profile* profile, PasswordManager* password_manager, diff --git a/chrome/browser/password_manager/password_form_manager.h b/chrome/browser/password_manager/password_form_manager.h index 1580f13..aa4bb1c 100644 --- a/chrome/browser/password_manager/password_form_manager.h +++ b/chrome/browser/password_manager/password_form_manager.h @@ -12,7 +12,7 @@ #include "base/stl_util.h" #include "chrome/browser/password_manager/password_store_consumer.h" -#include "webkit/forms/password_form.h" +#include "content/public/common/password_form.h" namespace content { class WebContents; @@ -35,7 +35,7 @@ class PasswordFormManager : public PasswordStoreConsumer { PasswordFormManager(Profile* profile, PasswordManager* password_manager, content::WebContents* web_contents, - const webkit::forms::PasswordForm& observed_form, + const content::PasswordForm& observed_form, bool ssl_valid); virtual ~PasswordFormManager(); @@ -46,7 +46,7 @@ class PasswordFormManager : public PasswordStoreConsumer { // Compare basic data of observed_form_ with argument. Only check the action // URL when action match is required. - bool DoesManage(const webkit::forms::PasswordForm& form, + bool DoesManage(const content::PasswordForm& form, ActionMatch action_match) const; // Retrieves potential matching logins from the database. @@ -85,12 +85,12 @@ class PasswordFormManager : public PasswordStoreConsumer { // Determines if we need to autofill given the results of the query. void OnRequestDone( - int handle, const std::vector<webkit::forms::PasswordForm*>& result); + int handle, const std::vector<content::PasswordForm*>& result); // PasswordStoreConsumer implementation. virtual void OnPasswordStoreRequestDone( CancelableRequestProvider::Handle handle, - const std::vector<webkit::forms::PasswordForm*>& result) OVERRIDE; + const std::vector<content::PasswordForm*>& result) OVERRIDE; // A user opted to 'never remember' passwords for this form. // Blacklist it so that from now on when it is seen we ignore it. @@ -99,7 +99,7 @@ class PasswordFormManager : public PasswordStoreConsumer { // If the user has submitted observed_form_, provisionally hold on to // the submitted credentials until we are told by PasswordManager whether // or not the login was successful. - void ProvisionallySave(const webkit::forms::PasswordForm& credentials); + void ProvisionallySave(const content::PasswordForm& credentials); // Handles save-as-new or update of the form managed by this manager. // Note the basic data of updated_credentials must match that of @@ -166,7 +166,7 @@ class PasswordFormManager : public PasswordStoreConsumer { // Helper for OnPasswordStoreRequestDone to determine whether or not // the given result form is worth scoring. - bool IgnoreResult(const webkit::forms::PasswordForm& form) const; + bool IgnoreResult(const content::PasswordForm& form) const; // Helper for Save in the case that best_matches.size() == 0, meaning // we have no prior record of this form/username/password and the user @@ -176,7 +176,7 @@ class PasswordFormManager : public PasswordStoreConsumer { // Helper for OnPasswordStoreRequestDone to score an individual result // against the observed_form_. - int ScoreResult(const webkit::forms::PasswordForm& form) const; + int ScoreResult(const content::PasswordForm& form) const; // Helper for Save in the case that best_matches.size() > 0, meaning // we have at least one match for this form/username/password. This @@ -202,13 +202,13 @@ class PasswordFormManager : public PasswordStoreConsumer { // Set of PasswordForms from the DB that best match the form // being managed by this. Use a map instead of vector, because we most // frequently require lookups by username value in IsNewLogin. - webkit::forms::PasswordFormMap best_matches_; + content::PasswordFormMap best_matches_; // Cleans up when best_matches_ goes out of scope. - STLValueDeleter<webkit::forms::PasswordFormMap> best_matches_deleter_; + STLValueDeleter<content::PasswordFormMap> best_matches_deleter_; // The PasswordForm from the page or dialog managed by this. - webkit::forms::PasswordForm observed_form_; + content::PasswordForm observed_form_; // The origin url path of observed_form_ tokenized, for convenience when // scoring. @@ -216,7 +216,7 @@ class PasswordFormManager : public PasswordStoreConsumer { // Stores updated credentials when the form was submitted but success is // still unknown. - webkit::forms::PasswordForm pending_credentials_; + content::PasswordForm pending_credentials_; // Whether pending_credentials_ stores a new login or is an update // to an existing one. @@ -235,7 +235,7 @@ class PasswordFormManager : public PasswordStoreConsumer { // as preferred. This is only allowed to be null if there are no best matches // at all, since there will always be one preferred login when there are // multiple matches (when first saved, a login is marked preferred). - const webkit::forms::PasswordForm* preferred_match_; + const content::PasswordForm* preferred_match_; typedef enum { PRE_MATCHING_PHASE, // Have not yet invoked a GetLogins query to find diff --git a/chrome/browser/password_manager/password_form_manager_unittest.cc b/chrome/browser/password_manager/password_form_manager_unittest.cc index 07f3e67..43f1a02 100644 --- a/chrome/browser/password_manager/password_form_manager_unittest.cc +++ b/chrome/browser/password_manager/password_form_manager_unittest.cc @@ -12,16 +12,16 @@ #include "chrome/browser/password_manager/password_manager_delegate.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/test/base/testing_profile.h" -#include "webkit/forms/password_form.h" +#include "content/public/common/password_form.h" -using webkit::forms::PasswordForm; +using content::PasswordForm; class TestPasswordManagerDelegate : public PasswordManagerDelegate { public: explicit TestPasswordManagerDelegate(Profile* profile) : profile_(profile) {} virtual void FillPasswordForm( - const webkit::forms::PasswordFormFillData& form_data) OVERRIDE {} + const PasswordFormFillData& form_data) OVERRIDE {} virtual void AddSavePasswordInfoBarIfPermitted( PasswordFormManager* form_to_save) OVERRIDE {} virtual Profile* GetProfile() OVERRIDE { return profile_; } @@ -37,9 +37,9 @@ class TestPasswordManager : public PasswordManager { : PasswordManager(NULL, delegate) {} virtual void Autofill( - const webkit::forms::PasswordForm& form_for_autofill, - const webkit::forms::PasswordFormMap& best_matches, - const webkit::forms::PasswordForm& preferred_match, + const content::PasswordForm& form_for_autofill, + const content::PasswordFormMap& best_matches, + const content::PasswordForm& preferred_match, bool wait_for_username) const OVERRIDE {} }; @@ -47,7 +47,7 @@ class TestPasswordFormManager : public PasswordFormManager { public: TestPasswordFormManager(Profile* profile, PasswordManager* manager, - const webkit::forms::PasswordForm& observed_form, + const content::PasswordForm& observed_form, bool ssl_valid) : PasswordFormManager(profile, manager, NULL, observed_form, ssl_valid), num_sent_messages_(0) {} diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc index fdd0138..2f93ea5 100644 --- a/chrome/browser/password_manager/password_manager.cc +++ b/chrome/browser/password_manager/password_manager.cc @@ -21,8 +21,8 @@ using content::UserMetricsAction; using content::WebContents; -using webkit::forms::PasswordForm; -using webkit::forms::PasswordFormMap; +using content::PasswordForm; +using content::PasswordFormMap; namespace { @@ -285,12 +285,12 @@ void PasswordManager::Autofill( case PasswordForm::SCHEME_HTML: { // Note the check above is required because the observer_ for a non-HTML // schemed password form may have been freed, so we need to distinguish. - webkit::forms::PasswordFormFillData fill_data; - webkit::forms::PasswordFormDomManager::InitFillData(form_for_autofill, - best_matches, - &preferred_match, - wait_for_username, - &fill_data); + PasswordFormFillData fill_data; + InitPasswordFormFillData(form_for_autofill, + best_matches, + &preferred_match, + wait_for_username, + &fill_data); delegate_->FillPasswordForm(fill_data); return; } diff --git a/chrome/browser/password_manager/password_manager.h b/chrome/browser/password_manager/password_manager.h index 6b990dc..544546d 100644 --- a/chrome/browser/password_manager/password_manager.h +++ b/chrome/browser/password_manager/password_manager.h @@ -13,9 +13,9 @@ #include "chrome/browser/api/prefs/pref_member.h" #include "chrome/browser/password_manager/password_form_manager.h" #include "chrome/browser/ui/login/login_model.h" +#include "chrome/common/password_form_fill_data.h" #include "content/public/browser/web_contents_observer.h" -#include "webkit/forms/password_form.h" -#include "webkit/forms/password_form_dom_manager.h" +#include "content/public/common/password_form.h" class PasswordManagerDelegate; class PasswordManagerTest; @@ -44,23 +44,23 @@ class PasswordManager : public LoginModel, // Called by a PasswordFormManager when it decides a form can be autofilled // on the page. - virtual void Autofill(const webkit::forms::PasswordForm& form_for_autofill, - const webkit::forms::PasswordFormMap& best_matches, - const webkit::forms::PasswordForm& preferred_match, + virtual void Autofill(const content::PasswordForm& form_for_autofill, + const content::PasswordFormMap& best_matches, + const content::PasswordForm& preferred_match, bool wait_for_username) const; // LoginModel implementation. virtual void SetObserver(LoginModelObserver* observer) OVERRIDE; // Mark this form as having a generated password. - void SetFormHasGeneratedPassword(const webkit::forms::PasswordForm& form); + void SetFormHasGeneratedPassword(const content::PasswordForm& form); // TODO(isherman): This should not be public, but is currently being used by // the LoginPrompt code. // When a form is submitted, we prepare to save the password but wait // until we decide the user has successfully logged in. This is step 1 // of 2 (see SavePassword). - void ProvisionallySavePassword(const webkit::forms::PasswordForm& form); + void ProvisionallySavePassword(const content::PasswordForm& form); // content::WebContentsObserver overrides. virtual void DidNavigateAnyFrame( @@ -71,9 +71,9 @@ class PasswordManager : public LoginModel, // TODO(isherman): This should not be public, but is currently being used by // the LoginPrompt code. void OnPasswordFormsParsed( - const std::vector<webkit::forms::PasswordForm>& forms); + const std::vector<content::PasswordForm>& forms); void OnPasswordFormsRendered( - const std::vector<webkit::forms::PasswordForm>& visible_forms); + const std::vector<content::PasswordForm>& visible_forms); private: // Is password autofill enabled for the current profile? diff --git a/chrome/browser/password_manager/password_manager_delegate.h b/chrome/browser/password_manager/password_manager_delegate.h index 158311cc..e3314ba 100644 --- a/chrome/browser/password_manager/password_manager_delegate.h +++ b/chrome/browser/password_manager/password_manager_delegate.h @@ -5,15 +5,11 @@ #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_DELEGATE_H_ #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_DELEGATE_H_ -namespace webkit { -namespace forms { -struct PasswordFormFillData; -} -} - class PasswordFormManager; class Profile; +struct PasswordFormFillData; + // An abstraction of operations in the external environment (WebContents) // that the PasswordManager depends on. This allows for more targeted // unit testing. @@ -26,7 +22,7 @@ class PasswordManagerDelegate { // through the RenderViewHost to FillPasswordForm. Tests can override this // to sever the dependency on the entire rendering stack. virtual void FillPasswordForm( - const webkit::forms::PasswordFormFillData& form_data) = 0; + const PasswordFormFillData& form_data) = 0; // A mechanism to show an infobar in the current tab at our request. // The infobar may not show in some circumstances, such as when the one-click diff --git a/chrome/browser/password_manager/password_manager_delegate_impl.cc b/chrome/browser/password_manager/password_manager_delegate_impl.cc index 6360be4..3966ba3 100644 --- a/chrome/browser/password_manager/password_manager_delegate_impl.cc +++ b/chrome/browser/password_manager/password_manager_delegate_impl.cc @@ -18,6 +18,7 @@ #include "content/public/browser/navigation_entry.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" +#include "content/public/common/password_form.h" #include "content/public/common/ssl_status.h" #include "google_apis/gaia/gaia_urls.h" #include "grit/chromium_strings.h" @@ -26,7 +27,6 @@ #include "net/base/cert_status_flags.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" -#include "webkit/forms/password_form.h" // After a successful *new* login attempt, we take the PasswordFormManager in // provisional_save_manager_ and move it to a SavePasswordInfoBarDelegate while @@ -123,7 +123,7 @@ InfoBarDelegate::InfoBarAutomationType // PasswordManagerDelegateImpl ------------------------------------------------ void PasswordManagerDelegateImpl::FillPasswordForm( - const webkit::forms::PasswordFormFillData& form_data) { + const PasswordFormFillData& form_data) { bool disable_popup = tab_contents_->autofill_manager()->HasExternalDelegate(); tab_contents_->web_contents()->GetRenderViewHost()->Send( diff --git a/chrome/browser/password_manager/password_manager_delegate_impl.h b/chrome/browser/password_manager/password_manager_delegate_impl.h index 6b8c4e9..3837b45 100644 --- a/chrome/browser/password_manager/password_manager_delegate_impl.h +++ b/chrome/browser/password_manager/password_manager_delegate_impl.h @@ -18,7 +18,7 @@ class PasswordManagerDelegateImpl : public PasswordManagerDelegate { // PasswordManagerDelegate implementation. virtual void FillPasswordForm( - const webkit::forms::PasswordFormFillData& form_data) OVERRIDE; + const PasswordFormFillData& form_data) OVERRIDE; virtual void AddSavePasswordInfoBarIfPermitted( PasswordFormManager* form_to_save) OVERRIDE; virtual Profile* GetProfile() OVERRIDE; diff --git a/chrome/browser/password_manager/password_manager_unittest.cc b/chrome/browser/password_manager/password_manager_unittest.cc index 3afd0a3..054c126 100644 --- a/chrome/browser/password_manager/password_manager_unittest.cc +++ b/chrome/browser/password_manager/password_manager_unittest.cc @@ -22,7 +22,7 @@ #include "testing/gtest/include/gtest/gtest.h" using content::BrowserThread; -using webkit::forms::PasswordForm; +using content::PasswordForm; using testing::_; using testing::DoAll; using ::testing::Exactly; @@ -32,7 +32,7 @@ using ::testing::Return; class MockPasswordManagerDelegate : public PasswordManagerDelegate { public: MOCK_METHOD1(FillPasswordForm, void( - const webkit::forms::PasswordFormFillData&)); + const PasswordFormFillData&)); MOCK_METHOD1(AddSavePasswordInfoBarIfPermitted, void(PasswordFormManager*)); MOCK_METHOD0(GetProfile, Profile*()); MOCK_METHOD0(DidLastPageLoadEncounterSSLErrors, bool()); diff --git a/chrome/browser/password_manager/password_store.cc b/chrome/browser/password_manager/password_store.cc index c08ec91..d4ef8e1 100644 --- a/chrome/browser/password_manager/password_store.cc +++ b/chrome/browser/password_manager/password_store.cc @@ -10,11 +10,11 @@ #include "base/stl_util.h" #include "chrome/browser/password_manager/password_store_consumer.h" #include "content/public/browser/browser_thread.h" -#include "webkit/forms/password_form.h" +#include "content/public/common/password_form.h" using content::BrowserThread; using std::vector; -using webkit::forms::PasswordForm; +using content::PasswordForm; PasswordStore::GetLoginsRequest::GetLoginsRequest( const GetLoginsCallback& callback) diff --git a/chrome/browser/password_manager/password_store.h b/chrome/browser/password_manager/password_store.h index 7233d13..a15bd7a 100644 --- a/chrome/browser/password_manager/password_store.h +++ b/chrome/browser/password_manager/password_store.h @@ -25,16 +25,14 @@ class PasswordModelAssociator; class PasswordModelWorker; } -namespace webkit { -namespace forms { +namespace content { struct PasswordForm; } -} namespace passwords_helper { -void AddLogin(PasswordStore* store, const webkit::forms::PasswordForm& form); -void RemoveLogin(PasswordStore* store, const webkit::forms::PasswordForm& form); -void UpdateLogin(PasswordStore* store, const webkit::forms::PasswordForm& form); +void AddLogin(PasswordStore* store, const content::PasswordForm& form); +void RemoveLogin(PasswordStore* store, const content::PasswordForm& form); +void UpdateLogin(PasswordStore* store, const content::PasswordForm& form); } // Interface for storing form passwords in a platform-specific secure way. @@ -45,7 +43,7 @@ class PasswordStore public CancelableRequestProvider { public: typedef base::Callback< - void(Handle, const std::vector<webkit::forms::PasswordForm*>&)> + void(Handle, const std::vector<content::PasswordForm*>&)> GetLoginsCallback; // PasswordForm vector elements are meant to be owned by the @@ -53,7 +51,7 @@ class PasswordStore // allocation, then the request must take care of the deletion. class GetLoginsRequest : public CancelableRequest1<GetLoginsCallback, - std::vector<webkit::forms::PasswordForm*> > { + std::vector<content::PasswordForm*> > { public: explicit GetLoginsRequest(const GetLoginsCallback& callback); @@ -92,13 +90,13 @@ class PasswordStore virtual bool Init(); // Adds the given PasswordForm to the secure password store asynchronously. - virtual void AddLogin(const webkit::forms::PasswordForm& form); + virtual void AddLogin(const content::PasswordForm& form); // Updates the matching PasswordForm in the secure password store (async). - void UpdateLogin(const webkit::forms::PasswordForm& form); + void UpdateLogin(const content::PasswordForm& form); // Removes the matching PasswordForm from the secure password store (async). - void RemoveLogin(const webkit::forms::PasswordForm& form); + void RemoveLogin(const content::PasswordForm& form); // Removes all logins created in the given date range. void RemoveLoginsCreatedBetween(const base::Time& delete_begin, @@ -107,7 +105,7 @@ class PasswordStore // Searches for a matching PasswordForm and returns a handle so the async // request can be tracked. Implement the PasswordStoreConsumer interface to be // notified on completion. - virtual Handle GetLogins(const webkit::forms::PasswordForm& form, + virtual Handle GetLogins(const content::PasswordForm& form, PasswordStoreConsumer* consumer); // Gets the complete list of PasswordForms that are not blacklist entries--and @@ -136,11 +134,11 @@ class PasswordStore friend class browser_sync::PasswordModelAssociator; friend class browser_sync::PasswordModelWorker; friend void passwords_helper::AddLogin(PasswordStore*, - const webkit::forms::PasswordForm&); + const content::PasswordForm&); friend void passwords_helper::RemoveLogin(PasswordStore*, - const webkit::forms::PasswordForm&); + const content::PasswordForm&); friend void passwords_helper::UpdateLogin(PasswordStore*, - const webkit::forms::PasswordForm&); + const content::PasswordForm&); virtual ~PasswordStore(); @@ -156,11 +154,11 @@ class PasswordStore // Synchronous implementation that reports usage metrics. virtual void ReportMetricsImpl() = 0; // Synchronous implementation to add the given login. - virtual void AddLoginImpl(const webkit::forms::PasswordForm& form) = 0; + virtual void AddLoginImpl(const content::PasswordForm& form) = 0; // Synchronous implementation to update the given login. - virtual void UpdateLoginImpl(const webkit::forms::PasswordForm& form) = 0; + virtual void UpdateLoginImpl(const content::PasswordForm& form) = 0; // Synchronous implementation to remove the given login. - virtual void RemoveLoginImpl(const webkit::forms::PasswordForm& form) = 0; + virtual void RemoveLoginImpl(const content::PasswordForm& form) = 0; // Synchronous implementation to remove the given logins. virtual void RemoveLoginsCreatedBetweenImpl(const base::Time& delete_begin, const base::Time& delete_end) = 0; @@ -168,7 +166,7 @@ class PasswordStore // will then be scored by the PasswordFormManager. Once they are found // (or not), the consumer should be notified. virtual void GetLoginsImpl(GetLoginsRequest* request, - const webkit::forms::PasswordForm& form) = 0; + const content::PasswordForm& form) = 0; // Finds all non-blacklist PasswordForms, and notifies the consumer. virtual void GetAutofillableLoginsImpl(GetLoginsRequest* request) = 0; // Finds all blacklist PasswordForms, and notifies the consumer. @@ -176,10 +174,10 @@ class PasswordStore // Finds all non-blacklist PasswordForms, and fills the vector. virtual bool FillAutofillableLogins( - std::vector<webkit::forms::PasswordForm*>* forms) = 0; + std::vector<content::PasswordForm*>* forms) = 0; // Finds all blacklist PasswordForms, and fills the vector. virtual bool FillBlacklistLogins( - std::vector<webkit::forms::PasswordForm*>* forms) = 0; + std::vector<content::PasswordForm*>* forms) = 0; // Dispatches the result to the PasswordStoreConsumer on the original caller's // thread so the callback can be executed there. This should be the UI thread. @@ -196,7 +194,7 @@ class PasswordStore // See GetLogins() for more information on |ignore_logins_cutoff|. template<typename BackendFunc> Handle Schedule(BackendFunc func, PasswordStoreConsumer* consumer, - const webkit::forms::PasswordForm& form, + const content::PasswordForm& form, const base::Time& ignore_logins_cutoff); // Wrapper method called on the destination thread (DB for non-mac) that diff --git a/chrome/browser/password_manager/password_store_change.h b/chrome/browser/password_manager/password_store_change.h index 8e5de8d..404f57b 100644 --- a/chrome/browser/password_manager/password_store_change.h +++ b/chrome/browser/password_manager/password_store_change.h @@ -7,7 +7,7 @@ #include <vector> -#include "webkit/forms/password_form.h" +#include "content/public/common/password_form.h" class PasswordStoreChange { public: @@ -17,13 +17,13 @@ class PasswordStoreChange { REMOVE, }; - PasswordStoreChange(Type type, const webkit::forms::PasswordForm& form) + PasswordStoreChange(Type type, const content::PasswordForm& form) : type_(type), form_(form) { } virtual ~PasswordStoreChange() {} Type type() const { return type_; } - const webkit::forms::PasswordForm& form() const { return form_; } + const content::PasswordForm& form() const { return form_; } bool operator==(const PasswordStoreChange& other) const { return type() == other.type() && @@ -45,7 +45,7 @@ class PasswordStoreChange { private: Type type_; - webkit::forms::PasswordForm form_; + content::PasswordForm form_; }; typedef std::vector<PasswordStoreChange> PasswordStoreChangeList; diff --git a/chrome/browser/password_manager/password_store_consumer.h b/chrome/browser/password_manager/password_store_consumer.h index 7d2ab8d..87e7f43 100644 --- a/chrome/browser/password_manager/password_store_consumer.h +++ b/chrome/browser/password_manager/password_store_consumer.h @@ -7,11 +7,9 @@ #include "chrome/browser/common/cancelable_request.h" -namespace webkit { -namespace forms { +namespace content { struct PasswordForm; } -} // Reads from the PasswordStore are done asynchronously on a separate // thread. PasswordStoreConsumer provides the virtual callback method, which is @@ -26,7 +24,7 @@ class PasswordStoreConsumer { // anyway with an empty vector. virtual void OnPasswordStoreRequestDone( CancelableRequestProvider::Handle handle, - const std::vector<webkit::forms::PasswordForm*>& result) = 0; + const std::vector<content::PasswordForm*>& result) = 0; // The CancelableRequest framework needs both a callback (the // PasswordStoreConsumer::OnPasswordStoreRequestDone) as well as a diff --git a/chrome/browser/password_manager/password_store_default.cc b/chrome/browser/password_manager/password_store_default.cc index 50f54f9..a5c6db6 100644 --- a/chrome/browser/password_manager/password_store_default.cc +++ b/chrome/browser/password_manager/password_store_default.cc @@ -18,7 +18,7 @@ #include "content/public/browser/notification_service.h" using content::BrowserThread; -using webkit::forms::PasswordForm; +using content::PasswordForm; PasswordStoreDefault::PasswordStoreDefault(LoginDatabase* login_db, Profile* profile) @@ -94,7 +94,7 @@ void PasswordStoreDefault::RemoveLoginsCreatedBetweenImpl( } void PasswordStoreDefault::GetLoginsImpl( - GetLoginsRequest* request, const webkit::forms::PasswordForm& form) { + GetLoginsRequest* request, const content::PasswordForm& form) { login_db_->GetLogins(form, &request->value); ForwardLoginsResult(request); } diff --git a/chrome/browser/password_manager/password_store_default.h b/chrome/browser/password_manager/password_store_default.h index 0fe7750..ac624ca 100644 --- a/chrome/browser/password_manager/password_store_default.h +++ b/chrome/browser/password_manager/password_store_default.h @@ -29,21 +29,21 @@ class PasswordStoreDefault : public PasswordStore { // Implements PasswordStore interface. virtual void ReportMetricsImpl() OVERRIDE; - virtual void AddLoginImpl(const webkit::forms::PasswordForm& form) OVERRIDE; + virtual void AddLoginImpl(const content::PasswordForm& form) OVERRIDE; virtual void UpdateLoginImpl( - const webkit::forms::PasswordForm& form) OVERRIDE; + const content::PasswordForm& form) OVERRIDE; virtual void RemoveLoginImpl( - const webkit::forms::PasswordForm& form) OVERRIDE; + const content::PasswordForm& form) OVERRIDE; virtual void RemoveLoginsCreatedBetweenImpl( const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; virtual void GetLoginsImpl(GetLoginsRequest* request, - const webkit::forms::PasswordForm& form) OVERRIDE; + const content::PasswordForm& form) OVERRIDE; virtual void GetAutofillableLoginsImpl(GetLoginsRequest* request) OVERRIDE; virtual void GetBlacklistLoginsImpl(GetLoginsRequest* request) OVERRIDE; virtual bool FillAutofillableLogins( - std::vector<webkit::forms::PasswordForm*>* forms) OVERRIDE; + std::vector<content::PasswordForm*>* forms) OVERRIDE; virtual bool FillBlacklistLogins( - std::vector<webkit::forms::PasswordForm*>* forms) OVERRIDE; + std::vector<content::PasswordForm*>* forms) OVERRIDE; protected: inline bool DeleteAndRecreateDatabaseFile() { diff --git a/chrome/browser/password_manager/password_store_default_unittest.cc b/chrome/browser/password_manager/password_store_default_unittest.cc index 4c99c42..32c6f43 100644 --- a/chrome/browser/password_manager/password_store_default_unittest.cc +++ b/chrome/browser/password_manager/password_store_default_unittest.cc @@ -28,13 +28,13 @@ using base::WaitableEvent; using content::BrowserThread; +using content::PasswordForm; using testing::_; using testing::DoAll; using testing::ElementsAreArray; using testing::Pointee; using testing::Property; using testing::WithArg; -using webkit::forms::PasswordForm; namespace { diff --git a/chrome/browser/password_manager/password_store_mac.cc b/chrome/browser/password_manager/password_store_mac.cc index a1cb791..5c2bb25 100644 --- a/chrome/browser/password_manager/password_store_mac.cc +++ b/chrome/browser/password_manager/password_store_mac.cc @@ -25,7 +25,7 @@ #include "crypto/apple_keychain.h" using crypto::AppleKeychain; -using webkit::forms::PasswordForm; +using content::PasswordForm; // Utility class to handle the details of constructing and running a keychain // search from a set of attributes. @@ -644,7 +644,7 @@ SecKeychainItemRef MacKeychainPasswordFormAdapter::KeychainItemForForm( std::vector<SecKeychainItemRef> MacKeychainPasswordFormAdapter::MatchingKeychainItems( const std::string& signon_realm, - webkit::forms::PasswordForm::Scheme scheme, + content::PasswordForm::Scheme scheme, const char* path, const char* username) { std::vector<SecKeychainItemRef> matches; @@ -889,7 +889,7 @@ void PasswordStoreMac::RemoveLoginsCreatedBetweenImpl( } void PasswordStoreMac::GetLoginsImpl(GetLoginsRequest* request, - const webkit::forms::PasswordForm& form) { + const content::PasswordForm& form) { MacKeychainPasswordFormAdapter keychain_adapter(keychain_.get()); std::vector<PasswordForm*> keychain_forms = keychain_adapter.PasswordsFillingForm(form); @@ -962,7 +962,7 @@ bool PasswordStoreMac::AddToKeychainIfNecessary(const PasswordForm& form) { } bool PasswordStoreMac::DatabaseHasFormMatchingKeychainForm( - const webkit::forms::PasswordForm& form) { + const content::PasswordForm& form) { bool has_match = false; std::vector<PasswordForm*> database_forms; login_metadata_db_->GetLogins(form, &database_forms); diff --git a/chrome/browser/password_manager/password_store_mac.h b/chrome/browser/password_manager/password_store_mac.h index 3974ecb..39cc572 100644 --- a/chrome/browser/password_manager/password_store_mac.h +++ b/chrome/browser/password_manager/password_store_mac.h @@ -44,44 +44,44 @@ class PasswordStoreMac : public PasswordStore { private: virtual void ReportMetricsImpl() OVERRIDE; - virtual void AddLoginImpl(const webkit::forms::PasswordForm& form) OVERRIDE; + virtual void AddLoginImpl(const content::PasswordForm& form) OVERRIDE; virtual void UpdateLoginImpl( - const webkit::forms::PasswordForm& form) OVERRIDE; + const content::PasswordForm& form) OVERRIDE; virtual void RemoveLoginImpl( - const webkit::forms::PasswordForm& form) OVERRIDE; + const content::PasswordForm& form) OVERRIDE; virtual void RemoveLoginsCreatedBetweenImpl( const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; virtual void GetLoginsImpl(GetLoginsRequest* request, - const webkit::forms::PasswordForm& form) OVERRIDE; + const content::PasswordForm& form) OVERRIDE; virtual void GetAutofillableLoginsImpl(GetLoginsRequest* request) OVERRIDE; virtual void GetBlacklistLoginsImpl(GetLoginsRequest* request) OVERRIDE; virtual bool FillAutofillableLogins( - std::vector<webkit::forms::PasswordForm*>* forms) OVERRIDE; + std::vector<content::PasswordForm*>* forms) OVERRIDE; virtual bool FillBlacklistLogins( - std::vector<webkit::forms::PasswordForm*>* forms) OVERRIDE; + std::vector<content::PasswordForm*>* forms) OVERRIDE; // Adds the given form to the Keychain if it's something we want to store // there (i.e., not a blacklist entry). Returns true if the operation // succeeded (either we added successfully, or we didn't need to). - bool AddToKeychainIfNecessary(const webkit::forms::PasswordForm& form); + bool AddToKeychainIfNecessary(const content::PasswordForm& form); // Returns true if our database contains a form that exactly matches the given // keychain form. bool DatabaseHasFormMatchingKeychainForm( - const webkit::forms::PasswordForm& form); + const content::PasswordForm& form); // Returns all the Keychain entries that we own but no longer have // corresponding metadata for in our database. // Caller is responsible for deleting the forms. - std::vector<webkit::forms::PasswordForm*> GetUnusedKeychainForms(); + std::vector<content::PasswordForm*> GetUnusedKeychainForms(); // Removes the given forms from the database. void RemoveDatabaseForms( - const std::vector<webkit::forms::PasswordForm*>& forms); + const std::vector<content::PasswordForm*>& forms); // Removes the given forms from the Keychain. void RemoveKeychainForms( - const std::vector<webkit::forms::PasswordForm*>& forms); + const std::vector<content::PasswordForm*>& forms); // Allows the creation of |notification_service_| to be scheduled on the right // thread. diff --git a/chrome/browser/password_manager/password_store_mac_internal.h b/chrome/browser/password_manager/password_store_mac_internal.h index b287557..9a01ea4 100644 --- a/chrome/browser/password_manager/password_store_mac_internal.h +++ b/chrome/browser/password_manager/password_store_mac_internal.h @@ -26,40 +26,40 @@ class MacKeychainPasswordFormAdapter { // Returns PasswordForms for each keychain entry that could be used to fill // |form|. Caller is responsible for deleting the returned forms. - std::vector<webkit::forms::PasswordForm*> PasswordsFillingForm( - const webkit::forms::PasswordForm& query_form); + std::vector<content::PasswordForm*> PasswordsFillingForm( + const content::PasswordForm& query_form); // Returns PasswordForms for each keychain entry that could be merged with // |form|. Differs from PasswordsFillingForm in that the username must match. // Caller is responsible for deleting the returned forms. - std::vector<webkit::forms::PasswordForm*> PasswordsMergeableWithForm( - const webkit::forms::PasswordForm& query_form); + std::vector<content::PasswordForm*> PasswordsMergeableWithForm( + const content::PasswordForm& query_form); // Returns the PasswordForm for the Keychain entry that matches |form| on all // of the fields that uniquely identify a Keychain item, or NULL if there is // no such entry. // Caller is responsible for deleting the returned form. - webkit::forms::PasswordForm* PasswordExactlyMatchingForm( - const webkit::forms::PasswordForm& query_form); + content::PasswordForm* PasswordExactlyMatchingForm( + const content::PasswordForm& query_form); // Returns true if PasswordsMergeableWithForm would return any items. This is // a separate method because calling PasswordsMergeableWithForm and checking // the return count would require reading the passwords from the keychain, // thus potentially triggering authorizaiton UI, whereas this won't. bool HasPasswordsMergeableWithForm( - const webkit::forms::PasswordForm& query_form); + const content::PasswordForm& query_form); // Returns all keychain items of types corresponding to password forms. - std::vector<webkit::forms::PasswordForm*> GetAllPasswordFormPasswords(); + std::vector<content::PasswordForm*> GetAllPasswordFormPasswords(); // Creates a new keychain entry from |form|, or updates the password of an // existing keychain entry if there is a collision. Returns true if a keychain // entry was successfully added/updated. - bool AddPassword(const webkit::forms::PasswordForm& form); + bool AddPassword(const content::PasswordForm& form); // Removes the keychain password matching |form| if any. Returns true if a // keychain item was found and successfully removed. - bool RemovePassword(const webkit::forms::PasswordForm& form); + bool RemovePassword(const content::PasswordForm& form); // Controls whether or not Chrome will restrict Keychain searches to items // that it created. Defaults to false. @@ -69,14 +69,14 @@ class MacKeychainPasswordFormAdapter { // Returns PasswordForms constructed from the given Keychain items, calling // AppleKeychain::Free on all of the keychain items and clearing the vector. // Caller is responsible for deleting the returned forms. - std::vector<webkit::forms::PasswordForm*> ConvertKeychainItemsToForms( + std::vector<content::PasswordForm*> ConvertKeychainItemsToForms( std::vector<SecKeychainItemRef>* items); // Searches |keychain| for the specific keychain entry that corresponds to the // given form, and returns it (or NULL if no match is found). The caller is // responsible for calling AppleKeychain::Free on on the returned item. SecKeychainItemRef KeychainItemForForm( - const webkit::forms::PasswordForm& form); + const content::PasswordForm& form); // Returns the Keychain items matching the given signon_realm, scheme, and // optionally path and username (either of both can be NULL). @@ -84,7 +84,7 @@ class MacKeychainPasswordFormAdapter { // returned items. std::vector<SecKeychainItemRef> MatchingKeychainItems( const std::string& signon_realm, - webkit::forms::PasswordForm::Scheme scheme, + content::PasswordForm::Scheme scheme, const char* path, const char* username); @@ -100,7 +100,7 @@ class MacKeychainPasswordFormAdapter { // Returns the Keychain SecAuthenticationType type corresponding to |scheme|. SecAuthenticationType AuthTypeForScheme( - webkit::forms::PasswordForm::Scheme scheme); + content::PasswordForm::Scheme scheme); // Changes the password for keychain_item to |password|; returns true if the // password was successfully changed. @@ -142,12 +142,12 @@ namespace internal_keychain_helpers { // require authorization). bool FillPasswordFormFromKeychainItem(const AppleKeychain& keychain, const SecKeychainItemRef& keychain_item, - webkit::forms::PasswordForm* form); + content::PasswordForm* form); // Returns true if the two given forms match based on signon_reaml, scheme, and // username_value, and are thus suitable for merging (see MergePasswordForms). -bool FormsMatchForMerge(const webkit::forms::PasswordForm& form_a, - const webkit::forms::PasswordForm& form_b); +bool FormsMatchForMerge(const content::PasswordForm& form_a, + const content::PasswordForm& form_b); // Populates merged_forms by combining the password data from keychain_forms and // the metadata from database_forms, removing used entries from the two source @@ -159,16 +159,16 @@ bool FormsMatchForMerge(const webkit::forms::PasswordForm& form_a, // keychain_forms its entries that weren't merged into at least one database // form. void MergePasswordForms( - std::vector<webkit::forms::PasswordForm*>* keychain_forms, - std::vector<webkit::forms::PasswordForm*>* database_forms, - std::vector<webkit::forms::PasswordForm*>* merged_forms); + std::vector<content::PasswordForm*>* keychain_forms, + std::vector<content::PasswordForm*>* database_forms, + std::vector<content::PasswordForm*>* merged_forms); // Fills in the passwords for as many of the forms in |database_forms| as // possible using entries from |keychain| and returns them. On return, // |database_forms| will contain only the forms for which no password was found. -std::vector<webkit::forms::PasswordForm*> GetPasswordsForForms( +std::vector<content::PasswordForm*> GetPasswordsForForms( const AppleKeychain& keychain, - std::vector<webkit::forms::PasswordForm*>* database_forms); + std::vector<content::PasswordForm*>* database_forms); } // internal_keychain_helpers diff --git a/chrome/browser/password_manager/password_store_mac_unittest.cc b/chrome/browser/password_manager/password_store_mac_unittest.cc index be42d3b..1a689ce 100644 --- a/chrome/browser/password_manager/password_store_mac_unittest.cc +++ b/chrome/browser/password_manager/password_store_mac_unittest.cc @@ -21,7 +21,7 @@ using content::BrowserThread; using crypto::MockAppleKeychain; -using webkit::forms::PasswordForm; +using content::PasswordForm; using testing::_; using testing::DoAll; using testing::WithArg; @@ -32,7 +32,7 @@ class MockPasswordStoreConsumer : public PasswordStoreConsumer { public: MOCK_METHOD2(OnPasswordStoreRequestDone, void(CancelableRequestProvider::Handle, - const std::vector<webkit::forms::PasswordForm*>&)); + const std::vector<content::PasswordForm*>&)); }; ACTION(STLDeleteElements0) { diff --git a/chrome/browser/password_manager/password_store_unittest.cc b/chrome/browser/password_manager/password_store_unittest.cc index f7fdc89..aec69d9 100644 --- a/chrome/browser/password_manager/password_store_unittest.cc +++ b/chrome/browser/password_manager/password_store_unittest.cc @@ -26,7 +26,7 @@ using content::BrowserThread; using testing::_; using testing::DoAll; using testing::WithArg; -using webkit::forms::PasswordForm; +using content::PasswordForm; namespace { diff --git a/chrome/browser/password_manager/password_store_win.cc b/chrome/browser/password_manager/password_store_win.cc index cdabe99..3982ec4 100644 --- a/chrome/browser/password_manager/password_store_win.cc +++ b/chrome/browser/password_manager/password_store_win.cc @@ -16,7 +16,7 @@ #include "chrome/browser/webdata/web_data_service.h" using content::BrowserThread; -using webkit::forms::PasswordForm; +using content::PasswordForm; namespace { // Subclass GetLoginsRequest in order to hold a copy of the form information diff --git a/chrome/browser/password_manager/password_store_win.h b/chrome/browser/password_manager/password_store_win.h index 22006e6..c4dae0c 100644 --- a/chrome/browser/password_manager/password_store_win.h +++ b/chrome/browser/password_manager/password_store_win.h @@ -12,11 +12,9 @@ class LoginDatabase; class Profile; class WebDataService; -namespace webkit { -namespace forms { +namespace content { struct PasswordForm; } -} // Windows PasswordStore implementation that uses the default implementation, // but also uses IE7 passwords if no others found. @@ -46,7 +44,7 @@ class PasswordStoreWin : public PasswordStoreDefault { // Overridden so that we can save the form for later use. virtual void GetLoginsImpl(GetLoginsRequest* request, - const webkit::forms::PasswordForm& form) OVERRIDE; + const content::PasswordForm& form) OVERRIDE; scoped_ptr<DBHandler> db_handler_; diff --git a/chrome/browser/password_manager/password_store_win_unittest.cc b/chrome/browser/password_manager/password_store_win_unittest.cc index 6a18b21a..e75861f 100644 --- a/chrome/browser/password_manager/password_store_win_unittest.cc +++ b/chrome/browser/password_manager/password_store_win_unittest.cc @@ -32,7 +32,7 @@ using content::BrowserThread; using testing::_; using testing::DoAll; using testing::WithArg; -using webkit::forms::PasswordForm; +using content::PasswordForm; namespace { @@ -40,7 +40,7 @@ class MockPasswordStoreConsumer : public PasswordStoreConsumer { public: MOCK_METHOD2(OnPasswordStoreRequestDone, void(CancelableRequestProvider::Handle, - const std::vector<webkit::forms::PasswordForm*>&)); + const std::vector<content::PasswordForm*>&)); }; class MockWebDataServiceConsumer : public WebDataServiceConsumer { diff --git a/chrome/browser/password_manager/password_store_x.cc b/chrome/browser/password_manager/password_store_x.cc index 13e5a98..f1e29c3 100644 --- a/chrome/browser/password_manager/password_store_x.cc +++ b/chrome/browser/password_manager/password_store_x.cc @@ -20,7 +20,7 @@ using content::BrowserThread; using std::vector; -using webkit::forms::PasswordForm; +using content::PasswordForm; PasswordStoreX::PasswordStoreX(LoginDatabase* login_db, Profile* profile, diff --git a/chrome/browser/password_manager/password_store_x.h b/chrome/browser/password_manager/password_store_x.h index 5f8e455..5caad55 100644 --- a/chrome/browser/password_manager/password_store_x.h +++ b/chrome/browser/password_manager/password_store_x.h @@ -28,18 +28,18 @@ class PasswordStoreX : public PasswordStoreDefault { // with return values rather than implicit consumer notification. class NativeBackend { public: - typedef std::vector<webkit::forms::PasswordForm*> PasswordFormList; + typedef std::vector<content::PasswordForm*> PasswordFormList; virtual ~NativeBackend() {} virtual bool Init() = 0; - virtual bool AddLogin(const webkit::forms::PasswordForm& form) = 0; - virtual bool UpdateLogin(const webkit::forms::PasswordForm& form) = 0; - virtual bool RemoveLogin(const webkit::forms::PasswordForm& form) = 0; + virtual bool AddLogin(const content::PasswordForm& form) = 0; + virtual bool UpdateLogin(const content::PasswordForm& form) = 0; + virtual bool RemoveLogin(const content::PasswordForm& form) = 0; virtual bool RemoveLoginsCreatedBetween(const base::Time& delete_begin, const base::Time& delete_end) = 0; - virtual bool GetLogins(const webkit::forms::PasswordForm& form, + virtual bool GetLogins(const content::PasswordForm& form, PasswordFormList* forms) = 0; virtual bool GetLoginsCreatedBetween(const base::Time& get_begin, const base::Time& get_end, @@ -73,21 +73,21 @@ class PasswordStoreX : public PasswordStoreDefault { virtual ~PasswordStoreX(); // Implements PasswordStore interface. - virtual void AddLoginImpl(const webkit::forms::PasswordForm& form) OVERRIDE; + virtual void AddLoginImpl(const content::PasswordForm& form) OVERRIDE; virtual void UpdateLoginImpl( - const webkit::forms::PasswordForm& form) OVERRIDE; + const content::PasswordForm& form) OVERRIDE; virtual void RemoveLoginImpl( - const webkit::forms::PasswordForm& form) OVERRIDE; + const content::PasswordForm& form) OVERRIDE; virtual void RemoveLoginsCreatedBetweenImpl( const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; virtual void GetLoginsImpl(GetLoginsRequest* request, - const webkit::forms::PasswordForm& form) OVERRIDE; + const content::PasswordForm& form) OVERRIDE; virtual void GetAutofillableLoginsImpl(GetLoginsRequest* request) OVERRIDE; virtual void GetBlacklistLoginsImpl(GetLoginsRequest* request) OVERRIDE; virtual bool FillAutofillableLogins( - std::vector<webkit::forms::PasswordForm*>* forms) OVERRIDE; + std::vector<content::PasswordForm*>* forms) OVERRIDE; virtual bool FillBlacklistLogins( - std::vector<webkit::forms::PasswordForm*>* forms) OVERRIDE; + std::vector<content::PasswordForm*>* forms) OVERRIDE; // Sort logins by origin, like the ORDER BY clause in login_database.cc. void SortLoginsByOrigin(NativeBackend::PasswordFormList* list); diff --git a/chrome/browser/password_manager/password_store_x_unittest.cc b/chrome/browser/password_manager/password_store_x_unittest.cc index 29ed91a..55d2d3c 100644 --- a/chrome/browser/password_manager/password_store_x_unittest.cc +++ b/chrome/browser/password_manager/password_store_x_unittest.cc @@ -39,7 +39,7 @@ using testing::ElementsAreArray; using testing::Pointee; using testing::Property; using testing::WithArg; -using webkit::forms::PasswordForm; +using content::PasswordForm; typedef std::vector<PasswordForm*> VectorOfForms; diff --git a/chrome/browser/sync/glue/password_change_processor.cc b/chrome/browser/sync/glue/password_change_processor.cc index d9cd1c5..5a6e456 100644 --- a/chrome/browser/sync/glue/password_change_processor.cc +++ b/chrome/browser/sync/glue/password_change_processor.cc @@ -18,12 +18,12 @@ #include "chrome/common/chrome_notification_types.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" +#include "content/public/common/password_form.h" #include "sync/internal_api/public/change_record.h" #include "sync/internal_api/public/read_node.h" #include "sync/internal_api/public/write_node.h" #include "sync/internal_api/public/write_transaction.h" #include "sync/protocol/password_specifics.pb.h" -#include "webkit/forms/password_form.h" using content::BrowserThread; @@ -184,7 +184,7 @@ void PasswordChangeProcessor::ApplyChangesFromSyncModel( syncer::ExtraPasswordChangeRecordData* extra = it->extra.get(); const sync_pb::PasswordSpecificsData& password = extra->unencrypted(); - webkit::forms::PasswordForm form; + content::PasswordForm form; PasswordModelAssociator::CopyPassword(password, &form); deleted_passwords_.push_back(form); model_associator_->Disassociate(it->id); @@ -204,7 +204,7 @@ void PasswordChangeProcessor::ApplyChangesFromSyncModel( const sync_pb::PasswordSpecificsData& password_data = sync_node.GetPasswordSpecifics(); - webkit::forms::PasswordForm password; + content::PasswordForm password; PasswordModelAssociator::CopyPassword(password_data, &password); if (syncer::ChangeRecord::ACTION_ADD == it->action) { diff --git a/chrome/browser/sync/glue/password_model_associator.cc b/chrome/browser/sync/glue/password_model_associator.cc index 219de0d..958c9d2 100644 --- a/chrome/browser/sync/glue/password_model_associator.cc +++ b/chrome/browser/sync/glue/password_model_associator.cc @@ -11,6 +11,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/password_manager/password_store.h" #include "chrome/browser/sync/profile_sync_service.h" +#include "content/public/common/password_form.h" #include "net/base/escape.h" #include "sync/api/sync_error.h" #include "sync/internal_api/public/read_node.h" @@ -18,7 +19,6 @@ #include "sync/internal_api/public/write_node.h" #include "sync/internal_api/public/write_transaction.h" #include "sync/protocol/password_specifics.pb.h" -#include "webkit/forms/password_form.h" using content::BrowserThread; @@ -58,7 +58,7 @@ syncer::SyncError PasswordModelAssociator::AssociateModels() { // We must not be holding a transaction when we interact with the password // store, as it can post tasks to the UI thread which can itself be blocked // on our transaction, resulting in deadlock. (http://crbug.com/70658) - std::vector<webkit::forms::PasswordForm*> passwords; + std::vector<content::PasswordForm*> passwords; if (!password_store_->FillAutofillableLogins(&passwords) || !password_store_->FillBlacklistLogins(&passwords)) { STLDeleteElements(&passwords); @@ -83,7 +83,7 @@ syncer::SyncError PasswordModelAssociator::AssociateModels() { model_type()); } - for (std::vector<webkit::forms::PasswordForm*>::iterator ix = + for (std::vector<content::PasswordForm*>::iterator ix = passwords.begin(); ix != passwords.end(); ++ix) { if (IsAbortPending()) { @@ -98,7 +98,7 @@ syncer::SyncError PasswordModelAssociator::AssociateModels() { node.GetPasswordSpecifics(); DCHECK_EQ(tag, MakeTag(password)); - webkit::forms::PasswordForm new_password; + content::PasswordForm new_password; if (MergePasswords(password, **ix, &new_password)) { syncer::WriteNode write_node(&trans); @@ -154,7 +154,7 @@ syncer::SyncError PasswordModelAssociator::AssociateModels() { // The password only exists on the server. Add it to the local // model. if (current_passwords.find(tag) == current_passwords.end()) { - webkit::forms::PasswordForm new_password; + content::PasswordForm new_password; CopyPassword(password, &new_password); Associate(&tag, sync_child_node.GetId()); @@ -328,9 +328,9 @@ syncer::SyncError PasswordModelAssociator::WriteToPasswordStore( // static void PasswordModelAssociator::CopyPassword( const sync_pb::PasswordSpecificsData& password, - webkit::forms::PasswordForm* new_password) { + content::PasswordForm* new_password) { new_password->scheme = - static_cast<webkit::forms::PasswordForm::Scheme>(password.scheme()); + static_cast<content::PasswordForm::Scheme>(password.scheme()); new_password->signon_realm = password.signon_realm(); new_password->origin = GURL(password.origin()); new_password->action = GURL(password.action()); @@ -353,8 +353,8 @@ void PasswordModelAssociator::CopyPassword( // static bool PasswordModelAssociator::MergePasswords( const sync_pb::PasswordSpecificsData& password, - const webkit::forms::PasswordForm& password_form, - webkit::forms::PasswordForm* new_password) { + const content::PasswordForm& password_form, + content::PasswordForm* new_password) { DCHECK(new_password); if (password.scheme() == password_form.scheme && @@ -389,7 +389,7 @@ bool PasswordModelAssociator::MergePasswords( // static void PasswordModelAssociator::WriteToSyncNode( - const webkit::forms::PasswordForm& password_form, + const content::PasswordForm& password_form, syncer::WriteNode* node) { sync_pb::PasswordSpecificsData password; password.set_scheme(password_form.scheme); @@ -410,7 +410,7 @@ void PasswordModelAssociator::WriteToSyncNode( // static std::string PasswordModelAssociator::MakeTag( - const webkit::forms::PasswordForm& password) { + const content::PasswordForm& password) { return MakeTag(password.origin.spec(), UTF16ToUTF8(password.username_element), UTF16ToUTF8(password.username_value), diff --git a/chrome/browser/sync/glue/password_model_associator.h b/chrome/browser/sync/glue/password_model_associator.h index e3d14f3..5c68efa 100644 --- a/chrome/browser/sync/glue/password_model_associator.h +++ b/chrome/browser/sync/glue/password_model_associator.h @@ -21,11 +21,9 @@ class MessageLoop; class PasswordStore; class ProfileSyncService; -namespace webkit { -namespace forms { +namespace content { struct PasswordForm; } -} namespace syncer { class WriteNode; @@ -44,7 +42,7 @@ extern const char kPasswordTag[]; class PasswordModelAssociator : public PerDataTypeAssociatorInterface<std::string, std::string> { public: - typedef std::vector<webkit::forms::PasswordForm> PasswordVector; + typedef std::vector<content::PasswordForm> PasswordVector; static syncer::ModelType model_type() { return syncer::PASSWORDS; } PasswordModelAssociator(ProfileSyncService* sync_service, @@ -98,7 +96,7 @@ class PasswordModelAssociator const PasswordVector* updated_passwords, const PasswordVector* deleted_passwords); - static std::string MakeTag(const webkit::forms::PasswordForm& password); + static std::string MakeTag(const content::PasswordForm& password); static std::string MakeTag(const sync_pb::PasswordSpecificsData& password); static std::string MakeTag(const std::string& origin_url, const std::string& username_element, @@ -107,12 +105,12 @@ class PasswordModelAssociator const std::string& signon_realm); static void CopyPassword(const sync_pb::PasswordSpecificsData& password, - webkit::forms::PasswordForm* new_password); + content::PasswordForm* new_password); static bool MergePasswords(const sync_pb::PasswordSpecificsData& password, - const webkit::forms::PasswordForm& password_form, - webkit::forms::PasswordForm* new_password); - static void WriteToSyncNode(const webkit::forms::PasswordForm& password_form, + const content::PasswordForm& password_form, + content::PasswordForm* new_password); + static void WriteToSyncNode(const content::PasswordForm& password_form, syncer::WriteNode* node); // Called at various points in model association to determine if the diff --git a/chrome/browser/sync/profile_sync_service_password_unittest.cc b/chrome/browser/sync/profile_sync_service_password_unittest.cc index efe136c..b85a07c 100644 --- a/chrome/browser/sync/profile_sync_service_password_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_password_unittest.cc @@ -32,6 +32,7 @@ #include "chrome/common/pref_names.h" #include "chrome/test/base/profile_mock.h" #include "content/public/browser/notification_source.h" +#include "content/public/common/password_form.h" #include "content/public/test/mock_notification_observer.h" #include "content/public/test/test_browser_thread.h" #include "google_apis/gaia/gaia_constants.h" @@ -42,13 +43,13 @@ #include "sync/protocol/password_specifics.pb.h" #include "sync/test/engine/test_id_factory.h" #include "testing/gmock/include/gmock/gmock.h" -#include "webkit/forms/password_form.h" using base::Time; using browser_sync::PasswordChangeProcessor; using browser_sync::PasswordDataTypeController; using browser_sync::PasswordModelAssociator; using content::BrowserThread; +using content::PasswordForm; using syncer::syncable::WriteTransaction; using testing::_; using testing::AtLeast; @@ -56,7 +57,6 @@ using testing::DoAll; using testing::InvokeWithoutArgs; using testing::Return; using testing::SetArgumentPointee; -using webkit::forms::PasswordForm; ACTION_P3(MakePasswordSyncComponents, service, ps, dtc) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); diff --git a/chrome/browser/sync/test/integration/autofill_helper.cc b/chrome/browser/sync/test/integration/autofill_helper.cc index 42c32a1..82dde67 100644 --- a/chrome/browser/sync/test/integration/autofill_helper.cc +++ b/chrome/browser/sync/test/integration/autofill_helper.cc @@ -21,8 +21,8 @@ #include "chrome/browser/webdata/web_data_service_factory.h" #include "chrome/browser/webdata/web_database.h" #include "chrome/common/chrome_notification_types.h" +#include "chrome/common/form_field_data.h" #include "chrome/test/base/thread_observer_helper.h" -#include "webkit/forms/form_field.h" using base::WaitableEvent; using content::BrowserThread; @@ -159,11 +159,11 @@ PersonalDataManager* GetPersonalDataManager(int index) { } void AddKeys(int profile, const std::set<AutofillKey>& keys) { - std::vector<webkit::forms::FormField> form_fields; + std::vector<FormFieldData> form_fields; for (std::set<AutofillKey>::const_iterator i = keys.begin(); i != keys.end(); ++i) { - webkit::forms::FormField field; + FormFieldData field; field.name = i->name(); field.value = i->value(); form_fields.push_back(field); diff --git a/chrome/browser/sync/test/integration/multiple_client_passwords_sync_test.cc b/chrome/browser/sync/test/integration/multiple_client_passwords_sync_test.cc index a7b7271..f0e185f 100644 --- a/chrome/browser/sync/test/integration/multiple_client_passwords_sync_test.cc +++ b/chrome/browser/sync/test/integration/multiple_client_passwords_sync_test.cc @@ -14,7 +14,7 @@ using passwords_helper::CreateTestPasswordForm; using passwords_helper::GetPasswordCount; using passwords_helper::GetPasswordStore; -using webkit::forms::PasswordForm; +using content::PasswordForm; class MultipleClientPasswordsSyncTest : public SyncTest { public: diff --git a/chrome/browser/sync/test/integration/passwords_helper.cc b/chrome/browser/sync/test/integration/passwords_helper.cc index bd94344..e54d89d 100644 --- a/chrome/browser/sync/test/integration/passwords_helper.cc +++ b/chrome/browser/sync/test/integration/passwords_helper.cc @@ -19,7 +19,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/browser_thread.h" -using webkit::forms::PasswordForm; +using content::PasswordForm; using sync_datatype_helper::test; const std::string kFakeSignonRealm = "http://fake-signon-realm.google.com/"; diff --git a/chrome/browser/sync/test/integration/passwords_helper.h b/chrome/browser/sync/test/integration/passwords_helper.h index 737a811..2322944 100644 --- a/chrome/browser/sync/test/integration/passwords_helper.h +++ b/chrome/browser/sync/test/integration/passwords_helper.h @@ -11,7 +11,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/test/integration/sync_test.h" -#include "webkit/forms/password_form.h" +#include "content/public/common/password_form.h" class PasswordStore; @@ -20,21 +20,21 @@ namespace passwords_helper { // Adds the login held in |form| to the password store |store|. Even though // logins are normally added asynchronously, this method will block until the // login is added. -void AddLogin(PasswordStore* store, const webkit::forms::PasswordForm& form); +void AddLogin(PasswordStore* store, const content::PasswordForm& form); // Update the data held in password store |store| with a modified |form|. // This method blocks until the operation is complete. -void UpdateLogin(PasswordStore* store, const webkit::forms::PasswordForm& form); +void UpdateLogin(PasswordStore* store, const content::PasswordForm& form); // Searches |store| for all logins matching a fake signon realm used only by // LivePasswordsSyncTest and adds the results to |matches|. Note that the // caller is responsible for deleting the forms added to |matches|. void GetLogins(PasswordStore* store, - std::vector<webkit::forms::PasswordForm>& matches); + std::vector<content::PasswordForm>& matches); // Removes the login held in |form| from the password store |store|. This // method blocks until the operation is complete. -void RemoveLogin(PasswordStore* store, const webkit::forms::PasswordForm& form); +void RemoveLogin(PasswordStore* store, const content::PasswordForm& form); // Removes all password forms from the password store |store|. void RemoveLogins(PasswordStore* store); @@ -80,7 +80,7 @@ int GetVerifierPasswordCount(); // Creates a test password form with a well known fake signon realm used only // by LivePasswordsSyncTest based on |index|. -webkit::forms::PasswordForm CreateTestPasswordForm(int index); +content::PasswordForm CreateTestPasswordForm(int index); } // namespace passwords_helper diff --git a/chrome/browser/sync/test/integration/performance/passwords_sync_perf_test.cc b/chrome/browser/sync/test/integration/performance/passwords_sync_perf_test.cc index ffd64e9..16eb808 100644 --- a/chrome/browser/sync/test/integration/performance/passwords_sync_perf_test.cc +++ b/chrome/browser/sync/test/integration/performance/passwords_sync_perf_test.cc @@ -34,7 +34,7 @@ class PasswordsSyncPerfTest : public SyncTest { private: // Returns a new unique login. - webkit::forms::PasswordForm NextLogin(); + content::PasswordForm NextLogin(); // Returns a new unique password value. std::string NextPassword(); @@ -50,9 +50,9 @@ void PasswordsSyncPerfTest::AddLogins(int profile, int num_logins) { } void PasswordsSyncPerfTest::UpdateLogins(int profile) { - std::vector<webkit::forms::PasswordForm> logins; + std::vector<content::PasswordForm> logins; GetLogins(GetPasswordStore(profile), logins); - for (std::vector<webkit::forms::PasswordForm>::iterator it = logins.begin(); + for (std::vector<content::PasswordForm>::iterator it = logins.begin(); it != logins.end(); ++it) { (*it).password_value = ASCIIToUTF16(NextPassword()); UpdateLogin(GetPasswordStore(profile), (*it)); @@ -63,7 +63,7 @@ void PasswordsSyncPerfTest::RemoveLogins(int profile) { passwords_helper::RemoveLogins(GetPasswordStore(profile)); } -webkit::forms::PasswordForm PasswordsSyncPerfTest::NextLogin() { +content::PasswordForm PasswordsSyncPerfTest::NextLogin() { return CreateTestPasswordForm(password_number_++); } diff --git a/chrome/browser/sync/test/integration/single_client_passwords_sync_test.cc b/chrome/browser/sync/test/integration/single_client_passwords_sync_test.cc index f53955e..471146c 100644 --- a/chrome/browser/sync/test/integration/single_client_passwords_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_passwords_sync_test.cc @@ -15,7 +15,7 @@ using passwords_helper::GetVerifierPasswordCount; using passwords_helper::GetVerifierPasswordStore; using passwords_helper::ProfileContainsSamePasswordFormsAsVerifier; -using webkit::forms::PasswordForm; +using content::PasswordForm; class SingleClientPasswordsSyncTest : public SyncTest { public: diff --git a/chrome/browser/sync/test/integration/two_client_passwords_sync_test.cc b/chrome/browser/sync/test/integration/two_client_passwords_sync_test.cc index 3b9a0ec..af281c9 100644 --- a/chrome/browser/sync/test/integration/two_client_passwords_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_passwords_sync_test.cc @@ -24,7 +24,7 @@ using passwords_helper::SetDecryptionPassphrase; using passwords_helper::SetEncryptionPassphrase; using passwords_helper::UpdateLogin; -using webkit::forms::PasswordForm; +using content::PasswordForm; static const char* kValidPassphrase = "passphrase!"; static const char* kAnotherValidPassphrase = "another passphrase!"; diff --git a/chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc b/chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc index a26c3e3..f54c046 100644 --- a/chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc +++ b/chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc @@ -18,8 +18,8 @@ #include "chrome/browser/ui/chrome_pages.h" #include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/common/url_constants.h" +#include "content/public/common/password_form.h" #include "ui/gfx/rect.h" -#include "webkit/forms/password_form.h" DEFINE_WEB_CONTENTS_USER_DATA_KEY(TabAutofillManagerDelegate) @@ -74,7 +74,7 @@ void TabAutofillManagerDelegate::ShowAutofillSettings() { void TabAutofillManagerDelegate::ShowPasswordGenerationBubble( const gfx::Rect& bounds, - const webkit::forms::PasswordForm& form, + const content::PasswordForm& form, autofill::PasswordGenerator* generator) { #if defined(OS_ANDROID) NOTIMPLEMENTED(); diff --git a/chrome/browser/ui/autofill/tab_autofill_manager_delegate.h b/chrome/browser/ui/autofill/tab_autofill_manager_delegate.h index bdd5edc..020491c 100644 --- a/chrome/browser/ui/autofill/tab_autofill_manager_delegate.h +++ b/chrome/browser/ui/autofill/tab_autofill_manager_delegate.h @@ -30,7 +30,7 @@ class TabAutofillManagerDelegate virtual void ShowAutofillSettings() OVERRIDE; virtual void ShowPasswordGenerationBubble( const gfx::Rect& bounds, - const webkit::forms::PasswordForm& form, + const content::PasswordForm& form, autofill::PasswordGenerator* generator) OVERRIDE; private: diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h index 800b046..071ce18 100644 --- a/chrome/browser/ui/browser_window.h +++ b/chrome/browser/ui/browser_window.h @@ -36,6 +36,7 @@ class PasswordGenerator; namespace content { class WebContents; struct NativeWebKeyboardEvent; +struct PasswordForm; struct SSLStatus; } @@ -48,12 +49,6 @@ class Rect; class Size; } -namespace webkit { -namespace forms { -struct PasswordForm; -} -} - enum DevToolsDockSide { DEVTOOLS_DOCK_SIDE_BOTTOM = 0, DEVTOOLS_DOCK_SIDE_RIGHT = 1 @@ -382,7 +377,7 @@ class BrowserWindow : public BaseWindow { // available on mac. virtual void ShowPasswordGenerationBubble( const gfx::Rect& rect, - const webkit::forms::PasswordForm& form, + const content::PasswordForm& form, autofill::PasswordGenerator* password_generator) {} protected: diff --git a/chrome/browser/ui/cocoa/login_prompt_cocoa.mm b/chrome/browser/ui/cocoa/login_prompt_cocoa.mm index 97db062..53f63b3 100644 --- a/chrome/browser/ui/cocoa/login_prompt_cocoa.mm +++ b/chrome/browser/ui/cocoa/login_prompt_cocoa.mm @@ -24,8 +24,8 @@ #include "ui/base/l10n/l10n_util.h" using content::BrowserThread; +using content::PasswordForm; using content::WebContents; -using webkit::forms::PasswordForm; // ---------------------------------------------------------------------------- // LoginHandlerMac diff --git a/chrome/browser/ui/gtk/autofill/autofill_external_delegate_gtk.cc b/chrome/browser/ui/gtk/autofill/autofill_external_delegate_gtk.cc index 4112e08..4323414 100644 --- a/chrome/browser/ui/gtk/autofill/autofill_external_delegate_gtk.cc +++ b/chrome/browser/ui/gtk/autofill/autofill_external_delegate_gtk.cc @@ -40,8 +40,8 @@ void AutofillExternalDelegateGtk::HideAutofillPopupInternal() { void AutofillExternalDelegateGtk::OnQueryPlatformSpecific( int query_id, - const webkit::forms::FormData& form, - const webkit::forms::FormField& field, + const FormData& form, + const FormFieldData& field, const gfx::Rect& bounds) { CreateViewIfNeeded(); view_->set_element_bounds(bounds); diff --git a/chrome/browser/ui/gtk/autofill/autofill_external_delegate_gtk.h b/chrome/browser/ui/gtk/autofill/autofill_external_delegate_gtk.h index eb477cb..0425fa9 100644 --- a/chrome/browser/ui/gtk/autofill/autofill_external_delegate_gtk.h +++ b/chrome/browser/ui/gtk/autofill/autofill_external_delegate_gtk.h @@ -26,8 +26,8 @@ class AutofillExternalDelegateGtk : public AutofillExternalDelegate { virtual void HideAutofillPopupInternal() OVERRIDE; virtual void OnQueryPlatformSpecific( int query_id, - const webkit::forms::FormData& form, - const webkit::forms::FormField& field, + const FormData& form, + const FormFieldData& field, const gfx::Rect& bounds) OVERRIDE; virtual void ApplyAutofillSuggestions( const std::vector<string16>& autofill_values, diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index 3c1cde2..bf47d93 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -1182,7 +1182,7 @@ void BrowserWindowGtk::ShowAvatarBubbleFromAvatarButton() { void BrowserWindowGtk::ShowPasswordGenerationBubble( const gfx::Rect& rect, - const webkit::forms::PasswordForm& form, + const content::PasswordForm& form, autofill::PasswordGenerator* password_generator) { WebContents* web_contents = chrome::GetActiveWebContents(browser_.get()); if (!web_contents || !web_contents->GetContentNativeView()) { diff --git a/chrome/browser/ui/gtk/browser_window_gtk.h b/chrome/browser/ui/gtk/browser_window_gtk.h index a3bbc67..189c4e3 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.h +++ b/chrome/browser/ui/gtk/browser_window_gtk.h @@ -174,7 +174,7 @@ class BrowserWindowGtk virtual void ShowAvatarBubbleFromAvatarButton() OVERRIDE; virtual void ShowPasswordGenerationBubble( const gfx::Rect& rect, - const webkit::forms::PasswordForm& form, + const content::PasswordForm& form, autofill::PasswordGenerator* password_generator) OVERRIDE; // Overridden from NotificationObserver: diff --git a/chrome/browser/ui/gtk/login_prompt_gtk.cc b/chrome/browser/ui/gtk/login_prompt_gtk.cc index 199fb41..8e114d4 100644 --- a/chrome/browser/ui/gtk/login_prompt_gtk.cc +++ b/chrome/browser/ui/gtk/login_prompt_gtk.cc @@ -25,8 +25,8 @@ #include "ui/base/l10n/l10n_util.h" using content::BrowserThread; +using content::PasswordForm; using content::WebContents; -using webkit::forms::PasswordForm; // ---------------------------------------------------------------------------- // LoginHandlerGtk diff --git a/chrome/browser/ui/gtk/password_generation_bubble_gtk.cc b/chrome/browser/ui/gtk/password_generation_bubble_gtk.cc index 774b81f..fcd85e3 100644 --- a/chrome/browser/ui/gtk/password_generation_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/password_generation_bubble_gtk.cc @@ -39,7 +39,7 @@ GdkPixbuf* GetImage(int resource_id) { PasswordGenerationBubbleGtk::PasswordGenerationBubbleGtk( const gfx::Rect& anchor_rect, - const webkit::forms::PasswordForm& form, + const content::PasswordForm& form, TabContents* tab, autofill::PasswordGenerator* password_generator) : form_(form), diff --git a/chrome/browser/ui/gtk/password_generation_bubble_gtk.h b/chrome/browser/ui/gtk/password_generation_bubble_gtk.h index df1e35b..8011a49 100644 --- a/chrome/browser/ui/gtk/password_generation_bubble_gtk.h +++ b/chrome/browser/ui/gtk/password_generation_bubble_gtk.h @@ -10,9 +10,9 @@ #include "base/basictypes.h" #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" #include "chrome/common/password_generation_util.h" +#include "content/public/common/password_form.h" #include "ui/base/gtk/gtk_signal.h" #include "ui/gfx/rect.h" -#include "webkit/forms/password_form.h" namespace autofill { class PasswordGenerator; @@ -27,7 +27,7 @@ class TabContents; class PasswordGenerationBubbleGtk : public BubbleDelegateGtk { public: PasswordGenerationBubbleGtk(const gfx::Rect& anchor_rect, - const webkit::forms::PasswordForm& form, + const content::PasswordForm& form, TabContents* tab, autofill::PasswordGenerator* password_generator); virtual ~PasswordGenerationBubbleGtk(); @@ -49,7 +49,7 @@ class PasswordGenerationBubbleGtk : public BubbleDelegateGtk { // Form that contains the password field that we are generating a password // for. Used by the password_manager_. - webkit::forms::PasswordForm form_; + content::PasswordForm form_; // TabContents associated with the button that spawned this bubble. TabContents* tab_; diff --git a/chrome/browser/ui/login/login_prompt.cc b/chrome/browser/ui/login/login_prompt.cc index ca6bde1..de4e7ff 100644 --- a/chrome/browser/ui/login/login_prompt.cc +++ b/chrome/browser/ui/login/login_prompt.cc @@ -38,7 +38,7 @@ using content::RenderViewHostDelegate; using content::ResourceDispatcherHost; using content::ResourceRequestInfo; using content::WebContents; -using webkit::forms::PasswordForm; +using content::PasswordForm; class LoginHandlerImpl; @@ -115,7 +115,7 @@ void LoginHandler::OnRequestCancelled() { CancelAuth(); } -void LoginHandler::SetPasswordForm(const webkit::forms::PasswordForm& form) { +void LoginHandler::SetPasswordForm(const content::PasswordForm& form) { password_form_ = form; } diff --git a/chrome/browser/ui/login/login_prompt.h b/chrome/browser/ui/login/login_prompt.h index 416c13b..ad755a0 100644 --- a/chrome/browser/ui/login/login_prompt.h +++ b/chrome/browser/ui/login/login_prompt.h @@ -50,7 +50,7 @@ class LoginHandler : public content::ResourceDispatcherHostLoginDelegate, // Sets information about the authentication type (|form|) and the // |password_manager| for this profile. - void SetPasswordForm(const webkit::forms::PasswordForm& form); + void SetPasswordForm(const content::PasswordForm& form); void SetPasswordManager(PasswordManager* password_manager); // Returns the WebContents that needs authentication. @@ -141,7 +141,7 @@ class LoginHandler : public content::ResourceDispatcherHostLoginDelegate, // when later notifying the password manager if the credentials were accepted // or rejected. // This should only be accessed on the UI loop. - webkit::forms::PasswordForm password_form_; + content::PasswordForm password_form_; // Points to the password manager owned by the WebContents requesting auth. // This should only be accessed on the UI loop. diff --git a/chrome/browser/ui/sync/one_click_signin_helper.cc b/chrome/browser/ui/sync/one_click_signin_helper.cc index bf9472b..9563ab8 100644 --- a/chrome/browser/ui/sync/one_click_signin_helper.cc +++ b/chrome/browser/ui/sync/one_click_signin_helper.cc @@ -37,6 +37,7 @@ #include "content/public/browser/web_contents_view.h" #include "content/public/common/frame_navigate_params.h" #include "content/public/common/page_transition_types.h" +#include "content/public/common/password_form.h" #include "googleurl/src/gurl.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -45,8 +46,6 @@ #include "net/url_request/url_request.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" -#include "webkit/forms/password_form.h" -#include "webkit/forms/password_form_dom_manager.h" DEFINE_WEB_CONTENTS_USER_DATA_KEY(OneClickSigninHelper) diff --git a/chrome/browser/ui/views/autofill/autofill_external_delegate_views.cc b/chrome/browser/ui/views/autofill/autofill_external_delegate_views.cc index 424625c..0685399 100644 --- a/chrome/browser/ui/views/autofill/autofill_external_delegate_views.cc +++ b/chrome/browser/ui/views/autofill/autofill_external_delegate_views.cc @@ -39,8 +39,8 @@ void AutofillExternalDelegateViews::HideAutofillPopupInternal() { void AutofillExternalDelegateViews::OnQueryPlatformSpecific( int query_id, - const webkit::forms::FormData& form, - const webkit::forms::FormField& field, + const FormData& form, + const FormFieldData& field, const gfx::Rect& bounds) { CreateViewIfNeeded(); popup_view_->set_element_bounds(bounds); diff --git a/chrome/browser/ui/views/autofill/autofill_external_delegate_views.h b/chrome/browser/ui/views/autofill/autofill_external_delegate_views.h index a9a965b..9628571 100644 --- a/chrome/browser/ui/views/autofill/autofill_external_delegate_views.h +++ b/chrome/browser/ui/views/autofill/autofill_external_delegate_views.h @@ -35,8 +35,8 @@ class AutofillExternalDelegateViews : public AutofillExternalDelegate { // AutofillExternalDelegate implementation. virtual void OnQueryPlatformSpecific( int query_id, - const webkit::forms::FormData& form, - const webkit::forms::FormField& field, + const FormData& form, + const FormFieldData& field, const gfx::Rect& bounds) OVERRIDE; virtual void ApplyAutofillSuggestions( const std::vector<string16>& autofill_values, diff --git a/chrome/browser/ui/views/autofill/autofill_external_delegate_views_browsertest.cc b/chrome/browser/ui/views/autofill/autofill_external_delegate_views_browsertest.cc index 3c49fe6..be56a02 100644 --- a/chrome/browser/ui/views/autofill/autofill_external_delegate_views_browsertest.cc +++ b/chrome/browser/ui/views/autofill/autofill_external_delegate_views_browsertest.cc @@ -51,8 +51,8 @@ class AutofillExternalDelegateViewsBrowserTest : public InProcessBrowserTest { void GeneratePopup() { int query_id = 1; - webkit::forms::FormData form; - webkit::forms::FormField field; + FormData form; + FormFieldData field; field.is_focusable = true; field.should_autocomplete = true; gfx::Rect bounds(100, 100); diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index c6f5b81..355dc07 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -2587,7 +2587,7 @@ void BrowserView::ShowAvatarBubbleFromAvatarButton() { void BrowserView::ShowPasswordGenerationBubble( const gfx::Rect& rect, - const webkit::forms::PasswordForm& form, + const content::PasswordForm& form, autofill::PasswordGenerator* password_generator) { // Create a rect in the content bounds that the bubble will point to. gfx::Point origin(rect.origin()); diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index 1074e8a..325f811 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h @@ -351,7 +351,7 @@ class BrowserView : public BrowserWindow, virtual void ShowAvatarBubbleFromAvatarButton() OVERRIDE; virtual void ShowPasswordGenerationBubble( const gfx::Rect& rect, - const webkit::forms::PasswordForm& form, + const content::PasswordForm& form, autofill::PasswordGenerator* password_generator) OVERRIDE; // Overridden from BrowserWindowTesting: diff --git a/chrome/browser/ui/views/login_prompt_views.cc b/chrome/browser/ui/views/login_prompt_views.cc index f5955a2..56ade68 100644 --- a/chrome/browser/ui/views/login_prompt_views.cc +++ b/chrome/browser/ui/views/login_prompt_views.cc @@ -20,8 +20,8 @@ #include "ui/views/window/dialog_delegate.h" using content::BrowserThread; +using content::PasswordForm; using content::WebContents; -using webkit::forms::PasswordForm; // ---------------------------------------------------------------------------- // LoginHandlerViews diff --git a/chrome/browser/ui/views/password_generation_bubble_view.cc b/chrome/browser/ui/views/password_generation_bubble_view.cc index c508f89..0d0fe46 100644 --- a/chrome/browser/ui/views/password_generation_bubble_view.cc +++ b/chrome/browser/ui/views/password_generation_bubble_view.cc @@ -118,7 +118,7 @@ gfx::Size TextfieldWrapper::GetImageSize() const { } // namespace PasswordGenerationBubbleView::PasswordGenerationBubbleView( - const webkit::forms::PasswordForm& form, + const content::PasswordForm& form, const gfx::Rect& anchor_rect, views::View* anchor_view, content::RenderViewHost* render_view_host, diff --git a/chrome/browser/ui/views/password_generation_bubble_view.h b/chrome/browser/ui/views/password_generation_bubble_view.h index d8c7853..2c7936b 100644 --- a/chrome/browser/ui/views/password_generation_bubble_view.h +++ b/chrome/browser/ui/views/password_generation_bubble_view.h @@ -6,11 +6,11 @@ #define CHROME_BROWSER_UI_VIEWS_PASSWORD_GENERATION_BUBBLE_VIEW_H_ #include "base/basictypes.h" +#include "content/public/common/password_form.h" #include "ui/gfx/rect.h" #include "ui/views/bubble/bubble_delegate.h" #include "ui/views/controls/button/button.h" #include "ui/views/view.h" -#include "webkit/forms/password_form.h" namespace autofill { class PasswordGenerator; @@ -37,7 +37,7 @@ class PasswordManager; class PasswordGenerationBubbleView : public views::BubbleDelegateView, public views::ButtonListener { public: - PasswordGenerationBubbleView(const webkit::forms::PasswordForm& form, + PasswordGenerationBubbleView(const content::PasswordForm& form, const gfx::Rect& anchor_rect, views::View* anchor_view, content::RenderViewHost* render_view_host, @@ -71,7 +71,7 @@ class PasswordGenerationBubbleView : public views::BubbleDelegateView, views::View* textfield_wrapper_; // The form associated with the password field(s) that we are generated. - webkit::forms::PasswordForm form_; + content::PasswordForm form_; // Location that the bubble points to gfx::Rect anchor_rect_; diff --git a/chrome/browser/ui/webui/options/password_manager_handler.cc b/chrome/browser/ui/webui/options/password_manager_handler.cc index bdbe4d4..73d6cb3 100644 --- a/chrome/browser/ui/webui/options/password_manager_handler.cc +++ b/chrome/browser/ui/webui/options/password_manager_handler.cc @@ -17,11 +17,11 @@ #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/web_ui.h" +#include "content/public/common/password_form.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "net/base/net_util.h" #include "ui/base/l10n/l10n_util.h" -#include "webkit/forms/password_form.h" namespace options { @@ -241,7 +241,7 @@ void PasswordManagerHandler::PasswordListPopulater::Populate() { void PasswordManagerHandler::PasswordListPopulater:: OnPasswordStoreRequestDone( CancelableRequestProvider::Handle handle, - const std::vector<webkit::forms::PasswordForm*>& result) { + const std::vector<content::PasswordForm*>& result) { DCHECK_EQ(pending_login_query_, handle); pending_login_query_ = 0; page_->password_list_.clear(); @@ -270,7 +270,7 @@ void PasswordManagerHandler::PasswordExceptionListPopulater::Populate() { void PasswordManagerHandler::PasswordExceptionListPopulater:: OnPasswordStoreRequestDone( CancelableRequestProvider::Handle handle, - const std::vector<webkit::forms::PasswordForm*>& result) { + const std::vector<content::PasswordForm*>& result) { DCHECK_EQ(pending_login_query_, handle); pending_login_query_ = 0; page_->password_exception_list_.clear(); diff --git a/chrome/browser/ui/webui/options/password_manager_handler.h b/chrome/browser/ui/webui/options/password_manager_handler.h index 1990737..f7b7fc9 100644 --- a/chrome/browser/ui/webui/options/password_manager_handler.h +++ b/chrome/browser/ui/webui/options/password_manager_handler.h @@ -14,11 +14,9 @@ #include "chrome/browser/password_manager/password_store_consumer.h" #include "chrome/browser/ui/webui/options/options_ui.h" -namespace webkit { -namespace forms { +namespace content { struct PasswordForm; } -} namespace options { @@ -83,7 +81,7 @@ class PasswordManagerHandler : public OptionsPageUIHandler, // Send the password store's reply back to the handler. virtual void OnPasswordStoreRequestDone( CancelableRequestProvider::Handle handle, - const std::vector<webkit::forms::PasswordForm*>& result) = 0; + const std::vector<content::PasswordForm*>& result) = 0; protected: PasswordManagerHandler* page_; @@ -101,7 +99,7 @@ class PasswordManagerHandler : public OptionsPageUIHandler, // Send the password store's reply back to the handler. virtual void OnPasswordStoreRequestDone( CancelableRequestProvider::Handle handle, - const std::vector<webkit::forms::PasswordForm*>& result) OVERRIDE; + const std::vector<content::PasswordForm*>& result) OVERRIDE; }; // A short class to mediate requests to the password store for exceptions. @@ -115,15 +113,15 @@ class PasswordManagerHandler : public OptionsPageUIHandler, // Send the password store's reply back to the handler. virtual void OnPasswordStoreRequestDone( CancelableRequestProvider::Handle handle, - const std::vector<webkit::forms::PasswordForm*>& result) OVERRIDE; + const std::vector<content::PasswordForm*>& result) OVERRIDE; }; // Password store consumer for populating the password list and exceptions. PasswordListPopulater populater_; PasswordExceptionListPopulater exception_populater_; - ScopedVector<webkit::forms::PasswordForm> password_list_; - ScopedVector<webkit::forms::PasswordForm> password_exception_list_; + ScopedVector<content::PasswordForm> password_list_; + ScopedVector<content::PasswordForm> password_exception_list_; // User's pref std::string languages_; diff --git a/chrome/browser/webdata/autofill_table.cc b/chrome/browser/webdata/autofill_table.cc index f390caa..c237782 100644 --- a/chrome/browser/webdata/autofill_table.cc +++ b/chrome/browser/webdata/autofill_table.cc @@ -25,12 +25,11 @@ #include "chrome/browser/password_manager/encryptor.h" #include "chrome/browser/webdata/autofill_change.h" #include "chrome/browser/webdata/autofill_entry.h" +#include "chrome/common/form_field_data.h" #include "sql/statement.h" #include "ui/base/l10n/l10n_util.h" -#include "webkit/forms/form_field.h" using base::Time; -using webkit::forms::FormField; namespace { @@ -343,12 +342,13 @@ bool AutofillTable::IsSyncable() { return true; } -bool AutofillTable::AddFormFieldValues(const std::vector<FormField>& elements, - std::vector<AutofillChange>* changes) { +bool AutofillTable::AddFormFieldValues( + const std::vector<FormFieldData>& elements, + std::vector<AutofillChange>* changes) { return AddFormFieldValuesTime(elements, changes, Time::Now()); } -bool AutofillTable::AddFormFieldValue(const FormField& element, +bool AutofillTable::AddFormFieldValue(const FormFieldData& element, std::vector<AutofillChange>* changes) { return AddFormFieldValueTime(element, changes, Time::Now()); } @@ -566,7 +566,7 @@ bool AutofillTable::AddToCountOfFormElement(int64 pair_id, } bool AutofillTable::GetIDAndCountOfFormElement( - const FormField& element, + const FormFieldData& element, int64* pair_id, int* count) { DCHECK(pair_id); @@ -614,7 +614,7 @@ bool AutofillTable::SetCountOfFormElement(int64 pair_id, int count) { return s.Run(); } -bool AutofillTable::InsertFormElement(const FormField& element, +bool AutofillTable::InsertFormElement(const FormFieldData& element, int64* pair_id) { DCHECK(pair_id); sql::Statement s(db_->GetUniqueStatement( @@ -655,7 +655,7 @@ bool AutofillTable::DeleteLastAccess(int64 pair_id) { } bool AutofillTable::AddFormFieldValuesTime( - const std::vector<FormField>& elements, + const std::vector<FormFieldData>& elements, std::vector<AutofillChange>* changes, Time time) { // Only add one new entry for each unique element name. Use |seen_names| to @@ -663,7 +663,7 @@ bool AutofillTable::AddFormFieldValuesTime( const size_t kMaximumUniqueNames = 256; std::set<string16> seen_names; bool result = true; - for (std::vector<FormField>::const_iterator itr = elements.begin(); + for (std::vector<FormFieldData>::const_iterator itr = elements.begin(); itr != elements.end(); ++itr) { if (seen_names.size() >= kMaximumUniqueNames) break; @@ -818,7 +818,7 @@ bool AutofillTable::InsertAutofillEntry(const AutofillEntry& entry) { return true; } -bool AutofillTable::AddFormFieldValueTime(const FormField& element, +bool AutofillTable::AddFormFieldValueTime(const FormFieldData& element, std::vector<AutofillChange>* changes, Time time) { int count = 0; diff --git a/chrome/browser/webdata/autofill_table.h b/chrome/browser/webdata/autofill_table.h index 74e94ab..22196d1 100644 --- a/chrome/browser/webdata/autofill_table.h +++ b/chrome/browser/webdata/autofill_table.h @@ -18,16 +18,12 @@ class AutofillProfile; class AutofillTableTest; class CreditCard; +struct FormFieldData; + namespace base { class Time; } -namespace webkit { -namespace forms { -struct FormField; -} -} - // This class manages the various autofill tables within the SQLite database // passed to the constructor. It expects the following schemas: // @@ -126,13 +122,13 @@ class AutofillTable : public WebDatabaseTable { // Records the form elements in |elements| in the database in the // autofill table. A list of all added and updated autofill entries // is returned in the changes out parameter. - bool AddFormFieldValues(const std::vector<webkit::forms::FormField>& elements, + bool AddFormFieldValues(const std::vector<FormFieldData>& elements, std::vector<AutofillChange>* changes); // Records a single form element in the database in the autofill table. A list // of all added and updated autofill entries is returned in the changes out // parameter. - bool AddFormFieldValue(const webkit::forms::FormField& element, + bool AddFormFieldValue(const FormFieldData& element, std::vector<AutofillChange>* changes); // Retrieves a vector of all values which have been recorded in the autofill @@ -177,7 +173,7 @@ class AutofillTable : public WebDatabaseTable { // Gets the pair_id and count entries from name and value specified in // |element|. Sets *pair_id and *count to 0 if there is no such row in // the table. - bool GetIDAndCountOfFormElement(const webkit::forms::FormField& element, + bool GetIDAndCountOfFormElement(const FormFieldData& element, int64* pair_id, int* count); @@ -189,7 +185,7 @@ class AutofillTable : public WebDatabaseTable { // 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 webkit::forms::FormField& element, + bool InsertFormElement(const FormFieldData& element, int64* pair_id); // Adds a new row to the autofill_dates table. @@ -325,10 +321,10 @@ class AutofillTable : public WebDatabaseTable { // Methods for adding autofill entries at a specified time. For // testing only. bool AddFormFieldValuesTime( - const std::vector<webkit::forms::FormField>& elements, + const std::vector<FormFieldData>& elements, std::vector<AutofillChange>* changes, base::Time time); - bool AddFormFieldValueTime(const webkit::forms::FormField& element, + bool AddFormFieldValueTime(const FormFieldData& element, std::vector<AutofillChange>* changes, base::Time time); diff --git a/chrome/browser/webdata/autofill_table_unittest.cc b/chrome/browser/webdata/autofill_table_unittest.cc index 23a520e..e34fec8 100644 --- a/chrome/browser/webdata/autofill_table_unittest.cc +++ b/chrome/browser/webdata/autofill_table_unittest.cc @@ -20,13 +20,12 @@ #include "chrome/browser/webdata/autofill_table.h" #include "chrome/browser/webdata/web_database.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/form_field_data.h" #include "sql/statement.h" #include "testing/gtest/include/gtest/gtest.h" -#include "webkit/forms/form_field.h" using base::Time; using base::TimeDelta; -using webkit::forms::FormField; // So we can compare AutofillKeys with EXPECT_EQ(). std::ostream& operator<<(std::ostream& os, const AutofillKey& key) { @@ -132,7 +131,7 @@ TEST_F(AutofillTableTest, Autofill) { // Simulate the submission of a handful of entries in a field called "Name", // some more often than others. AutofillChangeList changes; - FormField field; + FormFieldData field; field.name = ASCIIToUTF16("Name"); field.value = ASCIIToUTF16("Superman"); base::Time now = base::Time::Now(); @@ -290,7 +289,7 @@ TEST_F(AutofillTableTest, Autofill_RemoveBetweenChanges) { Time t2 = t1 + one_day; AutofillChangeList changes; - FormField field; + FormFieldData field; field.name = ASCIIToUTF16("Name"); field.value = ASCIIToUTF16("Superman"); EXPECT_TRUE( @@ -326,7 +325,7 @@ TEST_F(AutofillTableTest, Autofill_AddChanges) { Time t2 = t1 + one_day; AutofillChangeList changes; - FormField field; + FormFieldData field; field.name = ASCIIToUTF16("Name"); field.value = ASCIIToUTF16("Superman"); EXPECT_TRUE( @@ -356,7 +355,7 @@ TEST_F(AutofillTableTest, Autofill_UpdateOneWithOneTimestamp) { entries.push_back(entry); ASSERT_TRUE(db.GetAutofillTable()->UpdateAutofillEntries(entries)); - FormField field; + FormFieldData field; field.name = ASCIIToUTF16("foo"); field.value = ASCIIToUTF16("bar"); int64 pair_id; @@ -381,7 +380,7 @@ TEST_F(AutofillTableTest, Autofill_UpdateOneWithTwoTimestamps) { entries.push_back(entry); ASSERT_TRUE(db.GetAutofillTable()->UpdateAutofillEntries(entries)); - FormField field; + FormFieldData field; field.name = ASCIIToUTF16("foo"); field.value = ASCIIToUTF16("bar"); int64 pair_id; @@ -426,7 +425,7 @@ TEST_F(AutofillTableTest, Autofill_UpdateTwo) { entries.push_back(entry1); ASSERT_TRUE(db.GetAutofillTable()->UpdateAutofillEntries(entries)); - FormField field0; + FormFieldData field0; field0.name = ASCIIToUTF16("foo"); field0.value = ASCIIToUTF16("bar0"); int64 pair_id; @@ -436,7 +435,7 @@ TEST_F(AutofillTableTest, Autofill_UpdateTwo) { EXPECT_LE(0, pair_id); EXPECT_EQ(1, count); - FormField field1; + FormFieldData field1; field1.name = ASCIIToUTF16("foo"); field1.value = ASCIIToUTF16("bar1"); ASSERT_TRUE(db.GetAutofillTable()->GetIDAndCountOfFormElement( @@ -451,7 +450,7 @@ TEST_F(AutofillTableTest, Autofill_UpdateReplace) { AutofillChangeList changes; // Add a form field. This will be replaced. - FormField field; + FormFieldData field; field.name = ASCIIToUTF16("Name"); field.value = ASCIIToUTF16("Superman"); EXPECT_TRUE(db.GetAutofillTable()->AddFormFieldValue(field, &changes)); @@ -477,7 +476,7 @@ TEST_F(AutofillTableTest, Autofill_UpdateDontReplace) { AutofillChangeList changes; // Add a form field. This will NOT be replaced. - FormField field; + FormFieldData field; field.name = existing.key().name(); field.value = existing.key().value(); EXPECT_TRUE(db.GetAutofillTable()->AddFormFieldValueTime(field, &changes, t)); @@ -505,8 +504,8 @@ TEST_F(AutofillTableTest, Autofill_AddFormFieldValues) { // Add multiple values for "firstname" and "lastname" names. Test that only // first value of each gets added. Related to security issue: // http://crbug.com/51727. - std::vector<FormField> elements; - FormField field; + std::vector<FormFieldData> elements; + FormFieldData field; field.name = ASCIIToUTF16("firstname"); field.value = ASCIIToUTF16("Joe"); elements.push_back(field); @@ -1305,7 +1304,7 @@ TEST_F(AutofillTableTest, Autofill_GetAllAutofillEntries_OneResult) { time_t start = 0; std::vector<Time> timestamps1; - FormField field; + FormFieldData field; field.name = ASCIIToUTF16("Name"); field.value = ASCIIToUTF16("Superman"); EXPECT_TRUE( @@ -1347,7 +1346,7 @@ TEST_F(AutofillTableTest, Autofill_GetAllAutofillEntries_TwoDistinct) { time_t start = 0; std::vector<Time> timestamps1; - FormField field; + FormFieldData field; field.name = ASCIIToUTF16("Name"); field.value = ASCIIToUTF16("Superman"); EXPECT_TRUE( @@ -1405,7 +1404,7 @@ TEST_F(AutofillTableTest, Autofill_GetAllAutofillEntries_TwoSame) { time_t start = 0; std::vector<Time> timestamps; for (int i = 0; i < 2; i++) { - FormField field; + FormFieldData field; field.name = ASCIIToUTF16("Name"); field.value = ASCIIToUTF16("Superman"); EXPECT_TRUE( diff --git a/chrome/browser/webdata/autofill_web_data_service_impl.cc b/chrome/browser/webdata/autofill_web_data_service_impl.cc index 856ec96..09b083c 100644 --- a/chrome/browser/webdata/autofill_web_data_service_impl.cc +++ b/chrome/browser/webdata/autofill_web_data_service_impl.cc @@ -17,7 +17,7 @@ AutofillWebDataServiceImpl::~AutofillWebDataServiceImpl() { } void AutofillWebDataServiceImpl::AddFormFields( - const std::vector<webkit::forms::FormField>& fields) { + const std::vector<FormFieldData>& fields) { service_->AddFormFields(fields); } diff --git a/chrome/browser/webdata/autofill_web_data_service_impl.h b/chrome/browser/webdata/autofill_web_data_service_impl.h index c85c18e..768ee44 100644 --- a/chrome/browser/webdata/autofill_web_data_service_impl.h +++ b/chrome/browser/webdata/autofill_web_data_service_impl.h @@ -19,7 +19,7 @@ class AutofillWebDataServiceImpl : public AutofillWebDataService { // AutofillWebData implementation. virtual void AddFormFields( - const std::vector<webkit::forms::FormField>& fields) OVERRIDE; + const std::vector<FormFieldData>& fields) OVERRIDE; virtual WebDataServiceBase::Handle GetFormValuesForElementName( const string16& name, const string16& prefix, diff --git a/chrome/browser/webdata/web_data_service.cc b/chrome/browser/webdata/web_data_service.cc index ee8733f..50e974b 100644 --- a/chrome/browser/webdata/web_data_service.cc +++ b/chrome/browser/webdata/web_data_service.cc @@ -28,6 +28,7 @@ #include "chrome/browser/webdata/web_intents_table.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_notification_types.h" +#include "chrome/common/form_field_data.h" #ifdef DEBUG #include "content/public/browser/browser_thread.h" #endif @@ -37,7 +38,6 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "third_party/skia/include/core/SkBitmap.h" -#include "webkit/forms/form_field.h" //////////////////////////////////////////////////////////////////////////////// // @@ -48,7 +48,6 @@ using base::Bind; using base::Time; using content::BrowserThread; -using webkit::forms::FormField; using webkit_glue::WebIntentServiceData; namespace { @@ -418,9 +417,9 @@ WebDataService::Handle WebDataService::GetAllTokens( //////////////////////////////////////////////////////////////////////////////// void WebDataService::AddFormFields( - const std::vector<FormField>& fields) { - GenericRequest<std::vector<FormField> >* request = - new GenericRequest<std::vector<FormField> >( + const std::vector<FormFieldData>& fields) { + GenericRequest<std::vector<FormFieldData> >* request = + new GenericRequest<std::vector<FormFieldData> >( this, GetNextRequestHandle(), NULL, fields); RegisterRequest(request); ScheduleTask(FROM_HERE, @@ -1067,7 +1066,7 @@ void WebDataService::GetAllTokensImpl( //////////////////////////////////////////////////////////////////////////////// void WebDataService::AddFormElementsImpl( - GenericRequest<std::vector<FormField> >* request) { + GenericRequest<std::vector<FormFieldData> >* request) { InitializeDatabaseIfNecessary(); if (db_ && !request->IsCancelled(NULL)) { AutofillChangeList changes; diff --git a/chrome/browser/webdata/web_data_service.h b/chrome/browser/webdata/web_data_service.h index e1e6087..39e0ad4 100644 --- a/chrome/browser/webdata/web_data_service.h +++ b/chrome/browser/webdata/web_data_service.h @@ -375,7 +375,7 @@ class WebDataService // AutofillWebData implementation. virtual void AddFormFields( - const std::vector<webkit::forms::FormField>& fields) OVERRIDE; + const std::vector<FormFieldData>& fields) OVERRIDE; virtual Handle GetFormValuesForElementName( const string16& name, const string16& prefix, @@ -550,7 +550,7 @@ class WebDataService // ////////////////////////////////////////////////////////////////////////////// void AddFormElementsImpl( - GenericRequest<std::vector<webkit::forms::FormField> >* request); + GenericRequest<std::vector<FormFieldData> >* request); void GetFormValuesForElementNameImpl(WebDataRequest* request, const string16& name, const string16& prefix, int limit); void RemoveFormElementsAddedBetweenImpl( diff --git a/chrome/browser/webdata/web_data_service_unittest.cc b/chrome/browser/webdata/web_data_service_unittest.cc index 0bc49f7..48a50b9 100644 --- a/chrome/browser/webdata/web_data_service_unittest.cc +++ b/chrome/browser/webdata/web_data_service_unittest.cc @@ -27,13 +27,13 @@ #include "chrome/browser/webdata/web_intents_table.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/form_field_data.h" #include "chrome/test/base/thread_observer_helper.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" #include "content/public/test/test_browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "webkit/forms/form_field.h" using base::Time; using base::TimeDelta; @@ -135,8 +135,8 @@ class WebDataServiceAutofillTest : public WebDataServiceTest { void AppendFormField(const string16& name, const string16& value, - std::vector<webkit::forms::FormField>* form_fields) { - webkit::forms::FormField field; + std::vector<FormFieldData>* form_fields) { + FormFieldData field; field.name = name; field.value = value; form_fields->push_back(field); @@ -245,7 +245,7 @@ TEST_F(WebDataServiceAutofillTest, FormFillAdd) { Pointee(ElementsAreArray(expected_changes))))). WillOnce(SignalEvent(&done_event_)); - std::vector<webkit::forms::FormField> form_fields; + std::vector<FormFieldData> form_fields; AppendFormField(name1_, value1_, &form_fields); AppendFormField(name2_, value2_, &form_fields); wds_->AddFormFields(form_fields); @@ -271,7 +271,7 @@ TEST_F(WebDataServiceAutofillTest, FormFillRemoveOne) { // First add some values to autofill. EXPECT_CALL(*observer_helper_->observer(), Observe(_, _, _)). WillOnce(SignalEvent(&done_event_)); - std::vector<webkit::forms::FormField> form_fields; + std::vector<FormFieldData> form_fields; AppendFormField(name1_, value1_, &form_fields); wds_->AddFormFields(form_fields); @@ -302,7 +302,7 @@ TEST_F(WebDataServiceAutofillTest, FormFillRemoveMany) { EXPECT_CALL(*observer_helper_->observer(), Observe(_, _, _)). WillOnce(SignalEvent(&done_event_)); - std::vector<webkit::forms::FormField> form_fields; + std::vector<FormFieldData> form_fields; AppendFormField(name1_, value1_, &form_fields); AppendFormField(name2_, value2_, &form_fields); wds_->AddFormFields(form_fields); diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index e3eadc7..8be665d 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -73,7 +73,6 @@ '../webkit/support/webkit_support.gyp:blob', '../webkit/support/webkit_support.gyp:database', '../webkit/support/webkit_support.gyp:fileapi', - '../webkit/support/webkit_support.gyp:forms', '../webkit/support/webkit_support.gyp:glue', '../webkit/support/webkit_support.gyp:quota', '../webkit/support/webkit_support.gyp:user_agent', diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index b94e9e9..0d38ce1 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -221,6 +221,14 @@ 'common/external_ipc_fuzzer.cc', 'common/favicon_url.cc', 'common/favicon_url.h', + 'common/form_data.cc', + 'common/form_data.h', + 'common/form_data_predictions.cc', + 'common/form_data_predictions.h', + 'common/form_field_data.cc', + 'common/form_field_data.h', + 'common/form_field_data_predictions.cc', + 'common/form_field_data_predictions.h', 'common/icon_messages.h', 'common/important_file_writer.cc', 'common/important_file_writer.h', @@ -270,6 +278,8 @@ 'common/nacl_messages.h', 'common/nacl_types.cc', 'common/nacl_types.h', + 'common/password_form_fill_data.cc', + 'common/password_form_fill_data.h', 'common/password_generation_util.cc', 'common/password_generation_util.h', 'common/pepper_flash.cc', diff --git a/chrome/common/DEPS b/chrome/common/DEPS index 75b7eea..ffc99a7 100644 --- a/chrome/common/DEPS +++ b/chrome/common/DEPS @@ -8,7 +8,6 @@ include_rules = [ "+remoting/client/plugin", "+sandbox/win/src", "+skia", - "+webkit/forms", # Defines some types that are marshalled over IPC. "+webkit/glue", "+webkit/plugins", "+webkit/user_agent", diff --git a/chrome/common/autofill_messages.h b/chrome/common/autofill_messages.h index e23d510..faf7e3c 100644 --- a/chrome/common/autofill_messages.h +++ b/chrome/common/autofill_messages.h @@ -8,19 +8,19 @@ #include "base/time.h" #include "chrome/common/common_param_traits_macros.h" +#include "chrome/common/form_data.h" +#include "chrome/common/form_data_predictions.h" +#include "chrome/common/form_field_data.h" +#include "chrome/common/form_field_data_predictions.h" +#include "chrome/common/password_form_fill_data.h" +#include "content/public/common/password_form.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_utils.h" #include "ui/gfx/rect.h" -#include "webkit/forms/form_data.h" -#include "webkit/forms/form_data_predictions.h" -#include "webkit/forms/form_field.h" -#include "webkit/forms/form_field_predictions.h" -#include "webkit/forms/password_form.h" -#include "webkit/forms/password_form_dom_manager.h" #define IPC_MESSAGE_START AutofillMsgStart -IPC_STRUCT_TRAITS_BEGIN(webkit::forms::FormField) +IPC_STRUCT_TRAITS_BEGIN(FormFieldData) IPC_STRUCT_TRAITS_MEMBER(label) IPC_STRUCT_TRAITS_MEMBER(name) IPC_STRUCT_TRAITS_MEMBER(value) @@ -34,7 +34,7 @@ IPC_STRUCT_TRAITS_BEGIN(webkit::forms::FormField) IPC_STRUCT_TRAITS_MEMBER(option_contents) IPC_STRUCT_TRAITS_END() -IPC_STRUCT_TRAITS_BEGIN(webkit::forms::FormFieldPredictions) +IPC_STRUCT_TRAITS_BEGIN(FormFieldDataPredictions) IPC_STRUCT_TRAITS_MEMBER(field) IPC_STRUCT_TRAITS_MEMBER(signature) IPC_STRUCT_TRAITS_MEMBER(heuristic_type) @@ -42,7 +42,7 @@ IPC_STRUCT_TRAITS_BEGIN(webkit::forms::FormFieldPredictions) IPC_STRUCT_TRAITS_MEMBER(overall_type) IPC_STRUCT_TRAITS_END() -IPC_STRUCT_TRAITS_BEGIN(webkit::forms::FormData) +IPC_STRUCT_TRAITS_BEGIN(FormData) IPC_STRUCT_TRAITS_MEMBER(name) IPC_STRUCT_TRAITS_MEMBER(method) IPC_STRUCT_TRAITS_MEMBER(origin) @@ -51,14 +51,14 @@ IPC_STRUCT_TRAITS_BEGIN(webkit::forms::FormData) IPC_STRUCT_TRAITS_MEMBER(fields) IPC_STRUCT_TRAITS_END() -IPC_STRUCT_TRAITS_BEGIN(webkit::forms::FormDataPredictions) +IPC_STRUCT_TRAITS_BEGIN(FormDataPredictions) IPC_STRUCT_TRAITS_MEMBER(data) IPC_STRUCT_TRAITS_MEMBER(signature) IPC_STRUCT_TRAITS_MEMBER(experiment_id) IPC_STRUCT_TRAITS_MEMBER(fields) IPC_STRUCT_TRAITS_END() -IPC_STRUCT_TRAITS_BEGIN(webkit::forms::PasswordFormFillData) +IPC_STRUCT_TRAITS_BEGIN(PasswordFormFillData) IPC_STRUCT_TRAITS_MEMBER(basic_data) IPC_STRUCT_TRAITS_MEMBER(additional_logins) IPC_STRUCT_TRAITS_MEMBER(wait_for_username) @@ -79,19 +79,19 @@ IPC_MESSAGE_ROUTED5(AutofillMsg_SuggestionsReturned, // Autofill form data. IPC_MESSAGE_ROUTED2(AutofillMsg_FormDataFilled, int /* id of the request message */, - webkit::forms::FormData /* form data */) + FormData /* form data */) // Fill a password form and prepare field autocomplete for multiple // matching logins. Lets the renderer know if it should disable the popup // because the browser process will own the popup UI. IPC_MESSAGE_ROUTED2(AutofillMsg_FillPasswordForm, - webkit::forms::PasswordFormFillData, /* the fill form data*/ + PasswordFormFillData, /* the fill form data*/ bool /* disable popup */ ) // Send the heuristic and server field type predictions to the renderer. IPC_MESSAGE_ROUTED1( AutofillMsg_FieldTypePredictionsAvailable, - std::vector<webkit::forms::FormDataPredictions> /* forms */) + std::vector<FormDataPredictions> /* forms */) // Select an Autofill item when using an external delegate. IPC_MESSAGE_ROUTED1(AutofillMsg_SelectAutofillSuggestionAtIndex, @@ -133,42 +133,42 @@ IPC_MESSAGE_ROUTED1(AutofillMsg_AcceptPasswordAutofillSuggestion, // Tells the renderer that this password form is not blacklisted. A form can // be blacklisted if a user chooses "never save passwords for this site". IPC_MESSAGE_ROUTED1(AutofillMsg_FormNotBlacklisted, - webkit::forms::PasswordForm /* form checked */) + content::PasswordForm /* form checked */) // Autofill messages sent from the renderer to the browser. // Notification that forms have been seen that are candidates for // filling/submitting by the AutofillManager. IPC_MESSAGE_ROUTED2(AutofillHostMsg_FormsSeen, - std::vector<webkit::forms::FormData> /* forms */, + std::vector<FormData> /* forms */, base::TimeTicks /* timestamp */) // Notification that password forms have been seen that are candidates for // filling/submitting by the password manager. IPC_MESSAGE_ROUTED1(AutofillHostMsg_PasswordFormsParsed, - std::vector<webkit::forms::PasswordForm> /* forms */) + std::vector<content::PasswordForm> /* forms */) // Notification that initial layout has occurred and the following password // forms are visible on the page (e.g. not set to display:none.) IPC_MESSAGE_ROUTED1(AutofillHostMsg_PasswordFormsRendered, - std::vector<webkit::forms::PasswordForm> /* forms */) + std::vector<content::PasswordForm> /* forms */) // Notification that a form has been submitted. The user hit the button. IPC_MESSAGE_ROUTED2(AutofillHostMsg_FormSubmitted, - webkit::forms::FormData /* form */, + FormData /* form */, base::TimeTicks /* timestamp */) // Notification that a form field's value has changed. IPC_MESSAGE_ROUTED3(AutofillHostMsg_TextFieldDidChange, - webkit::forms::FormData /* the form */, - webkit::forms::FormField /* the form field */, + FormData /* the form */, + FormFieldData /* the form field */, base::TimeTicks /* timestamp */) // Queries the browser for Autofill suggestions for a form input field. IPC_MESSAGE_ROUTED5(AutofillHostMsg_QueryFormFieldAutofill, int /* id of this message */, - webkit::forms::FormData /* the form */, - webkit::forms::FormField /* the form field */, + FormData /* the form */, + FormFieldData /* the form field */, gfx::Rect /* input field bounds, window-relative */, bool /* display warning if autofill disabled */) @@ -180,8 +180,8 @@ IPC_MESSAGE_ROUTED1(AutofillHostMsg_DidShowAutofillSuggestions, // profile data. IPC_MESSAGE_ROUTED4(AutofillHostMsg_FillAutofillFormData, int /* id of this message */, - webkit::forms::FormData /* the form */, - webkit::forms::FormField /* the form field */, + FormData /* the form */, + FormFieldData /* the form field */, int /* profile unique ID */) // Sent when a form is previewed with Autofill suggestions. @@ -212,17 +212,17 @@ IPC_MESSAGE_ROUTED0(AutofillHostMsg_HideAutofillPopup) IPC_MESSAGE_ROUTED3(AutofillHostMsg_ShowPasswordGenerationPopup, gfx::Rect /* source location */, int /* max length of the password */, - webkit::forms::PasswordForm) + content::PasswordForm) // Instruct the browser that a password mapping has been found for a field. IPC_MESSAGE_ROUTED2(AutofillHostMsg_AddPasswordFormMapping, - webkit::forms::FormField, /* the user name field */ - webkit::forms::PasswordFormFillData /* password pairings */) + FormFieldData, /* the user name field */ + PasswordFormFillData /* password pairings */) // Instruct the browser to show a popup with the following suggestions from the // password manager. IPC_MESSAGE_ROUTED3(AutofillHostMsg_ShowPasswordSuggestions, - webkit::forms::FormField /* the form field */, + FormFieldData /* the form field */, gfx::Rect /* input field bounds, window-relative */, std::vector<string16> /* suggestions */) diff --git a/chrome/common/chrome_notification_types.h b/chrome/common/chrome_notification_types.h index efba24f..2892cf0 100644 --- a/chrome/common/chrome_notification_types.h +++ b/chrome/common/chrome_notification_types.h @@ -1147,7 +1147,7 @@ enum NotificationType { // store are changed. The detail of this notification is a list of changes // represented by a vector of PasswordStoreChange. Each change includes a // change type (ADD, UPDATE, or REMOVE) as well as the - // |webkit::forms::PasswordForm|s that were affected. + // |content::PasswordForm|s that were affected. NOTIFICATION_LOGINS_CHANGED, // Sent when an import process has ended. diff --git a/webkit/forms/form_data.cc b/chrome/common/form_data.cc index ea85146..d12c77c0 100644 --- a/webkit/forms/form_data.cc +++ b/chrome/common/form_data.cc @@ -2,13 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/forms/form_data.h" +#include "chrome/common/form_data.h" #include "base/string_util.h" -namespace webkit { -namespace forms { - FormData::FormData() : user_submitted(false) { } @@ -33,6 +30,3 @@ bool FormData::operator==(const FormData& form) const { user_submitted == form.user_submitted && fields == form.fields); } - -} // namespace forms -} // namespace webkit diff --git a/webkit/forms/form_data.h b/chrome/common/form_data.h index da9b0e8..fd987a8 100644 --- a/webkit/forms/form_data.h +++ b/chrome/common/form_data.h @@ -2,21 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_FORMS_FORM_DATA_H__ -#define WEBKIT_FORMS_FORM_DATA_H__ +#ifndef CHROME_COMMON_FORM_DATA_H__ +#define CHROME_COMMON_FORM_DATA_H__ #include <vector> #include "base/string16.h" +#include "chrome/common/form_field_data.h" #include "googleurl/src/gurl.h" -#include "webkit/forms/form_field.h" -#include "webkit/forms/webkit_forms_export.h" - -namespace webkit { -namespace forms { // Holds information about a form to be filled and/or submitted. -struct WEBKIT_FORMS_EXPORT FormData { +struct FormData { // The name of the form. string16 name; // GET or POST. @@ -28,7 +24,7 @@ struct WEBKIT_FORMS_EXPORT FormData { // true if this form was submitted by a user gesture and not javascript. bool user_submitted; // A vector of all the input fields in the form. - std::vector<FormField> fields; + std::vector<FormFieldData> fields; FormData(); FormData(const FormData& data); @@ -38,7 +34,4 @@ struct WEBKIT_FORMS_EXPORT FormData { bool operator==(const FormData& form) const; }; -} // namespace forms -} // namespace webkit - -#endif // WEBKIT_FORMS_FORM_DATA_H__ +#endif // CHROME_COMMON_FORM_DATA_H__ diff --git a/webkit/forms/form_data_predictions.cc b/chrome/common/form_data_predictions.cc index 62d9a0e..6a03c5c 100644 --- a/webkit/forms/form_data_predictions.cc +++ b/chrome/common/form_data_predictions.cc @@ -2,10 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/forms/form_data_predictions.h" - -namespace webkit { -namespace forms { +#include "chrome/common/form_data_predictions.h" FormDataPredictions::FormDataPredictions() { } @@ -19,6 +16,3 @@ FormDataPredictions::FormDataPredictions(const FormDataPredictions& other) FormDataPredictions::~FormDataPredictions() { } - -} // namespace forms -} // namespace webkit diff --git a/webkit/forms/form_data_predictions.h b/chrome/common/form_data_predictions.h index df3015a..a4eb28f 100644 --- a/webkit/forms/form_data_predictions.h +++ b/chrome/common/form_data_predictions.h @@ -2,21 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_FORMS_FORM_DATA_PREDICTIONS_H__ -#define WEBKIT_FORMS_FORM_DATA_PREDICTIONS_H__ +#ifndef CHROME_COMMON_FORM_DATA_PREDICTIONS_H__ +#define CHROME_COMMON_FORM_DATA_PREDICTIONS_H__ #include <string> #include <vector> -#include "webkit/forms/form_data.h" -#include "webkit/forms/form_field_predictions.h" -#include "webkit/forms/webkit_forms_export.h" - -namespace webkit { -namespace forms { +#include "chrome/common/form_data.h" +#include "chrome/common/form_field_data_predictions.h" // Holds information about a form to be filled and/or submitted. -struct WEBKIT_FORMS_EXPORT FormDataPredictions { +struct FormDataPredictions { // Data for this form. FormData data; // The form signature for communication with the crowdsourcing server. @@ -24,14 +20,11 @@ struct WEBKIT_FORMS_EXPORT FormDataPredictions { // The experiment id for the server predictions. std::string experiment_id; // The form fields and their predicted field types. - std::vector<FormFieldPredictions> fields; + std::vector<FormFieldDataPredictions> fields; FormDataPredictions(); FormDataPredictions(const FormDataPredictions& other); ~FormDataPredictions(); }; -} // namespace forms -} // namespace webkit - -#endif // WEBKIT_FORMS_FORM_DATA_PREDICTIONS_H__ +#endif // CHROME_COMMON_FORM_DATA_PREDICTIONS_H__ diff --git a/webkit/forms/form_field.cc b/chrome/common/form_field_data.cc index 3032c61..cd134d4 100644 --- a/webkit/forms/form_field.cc +++ b/chrome/common/form_field_data.cc @@ -2,27 +2,24 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/forms/form_field.h" +#include "chrome/common/form_field_data.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" -namespace webkit { -namespace forms { - -FormField::FormField() +FormFieldData::FormFieldData() : max_length(0), is_autofilled(false), is_focusable(false), should_autocomplete(false) { } -FormField::~FormField() { +FormFieldData::~FormFieldData() { } -bool FormField::operator==(const FormField& field) const { - // A FormField stores a value, but the value is not part of the identity of - // the field, so we don't want to compare the values. +bool FormFieldData::operator==(const FormFieldData& field) const { + // A FormFieldData stores a value, but the value is not part of the identity + // of the field, so we don't want to compare the values. return (label == field.label && name == field.name && form_control_type == field.form_control_type && @@ -30,18 +27,18 @@ bool FormField::operator==(const FormField& field) const { max_length == field.max_length); } -bool FormField::operator!=(const FormField& field) const { +bool FormFieldData::operator!=(const FormFieldData& field) const { return !operator==(field); } -bool FormField::operator<(const FormField& field) const { +bool FormFieldData::operator<(const FormFieldData& field) const { if (label == field.label) return name < field.name; return label < field.label; } -std::ostream& operator<<(std::ostream& os, const FormField& field) { +std::ostream& operator<<(std::ostream& os, const FormFieldData& field) { return os << UTF16ToUTF8(field.label) << " " @@ -61,6 +58,3 @@ std::ostream& operator<<(std::ostream& os, const FormField& field) { << " " << (field.should_autocomplete ? "true" : "false"); } - -} // namespace forms -} // namespace webkit diff --git a/webkit/forms/form_field.h b/chrome/common/form_field_data.h index 0e92d98..286fb72 100644 --- a/webkit/forms/form_field.h +++ b/chrome/common/form_field_data.h @@ -2,30 +2,26 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_FORMS_FORM_FIELD_H_ -#define WEBKIT_FORMS_FORM_FIELD_H_ +#ifndef CHROME_COMMON_FORM_FIELD_DATA_H_ +#define CHROME_COMMON_FORM_FIELD_DATA_H_ #include <vector> #include "base/string16.h" -#include "webkit/forms/webkit_forms_export.h" - -namespace webkit { -namespace forms { // Stores information about a field in a form. -struct WEBKIT_FORMS_EXPORT FormField { - FormField(); - virtual ~FormField(); +struct FormFieldData { + FormFieldData(); + virtual ~FormFieldData(); // Equality tests for identity which does not include |value| or // |is_autofilled|. // TODO(dhollowa): These operators need to be revised when we implement field // ids. - bool operator==(const FormField& field) const; - bool operator!=(const FormField& field) const; + bool operator==(const FormFieldData& field) const; + bool operator!=(const FormFieldData& field) const; // Comparsion operator exposed for STL map. Uses label, then name to sort. - bool operator<(const FormField& field) const; + bool operator<(const FormFieldData& field) const; string16 label; string16 name; @@ -43,16 +39,12 @@ struct WEBKIT_FORMS_EXPORT FormField { std::vector<string16> option_contents; }; -// So we can compare FormFields with EXPECT_EQ(). -WEBKIT_FORMS_EXPORT std::ostream& operator<<(std::ostream& os, - const FormField& field); - -} // namespace forms -} // namespace webkit +// So we can compare FormFieldDatas with EXPECT_EQ(). +std::ostream& operator<<(std::ostream& os, const FormFieldData& field); -// Prefer to use this macro in place of |EXPECT_EQ()| for comparing |FormField|s -// in test code. -#define EXPECT_FORM_FIELD_EQUALS(expected, actual) \ +// Prefer to use this macro in place of |EXPECT_EQ()| for comparing +// |FormFieldData|s in test code. +#define EXPECT_FORM_FIELD_DATA_EQUALS(expected, actual) \ do { \ EXPECT_EQ(expected.label, actual.label); \ EXPECT_EQ(expected.name, actual.name); \ @@ -63,4 +55,4 @@ WEBKIT_FORMS_EXPORT std::ostream& operator<<(std::ostream& os, EXPECT_EQ(expected.is_autofilled, actual.is_autofilled); \ } while (0) -#endif // WEBKIT_FORMS_FORM_FIELD_H_ +#endif // CHROME_COMMON_FORM_FIELD_DATA_H_ diff --git a/webkit/forms/form_field_predictions.cc b/chrome/common/form_field_data_predictions.cc index 3f0cd1e..9530a3b 100644 --- a/webkit/forms/form_field_predictions.cc +++ b/chrome/common/form_field_data_predictions.cc @@ -2,15 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/forms/form_field_predictions.h" +#include "chrome/common/form_field_data_predictions.h" -namespace webkit { -namespace forms { - -FormFieldPredictions::FormFieldPredictions() { +FormFieldDataPredictions::FormFieldDataPredictions() { } -FormFieldPredictions::FormFieldPredictions(const FormFieldPredictions& other) +FormFieldDataPredictions::FormFieldDataPredictions( + const FormFieldDataPredictions& other) : field(other.field), signature(other.signature), heuristic_type(other.heuristic_type), @@ -18,8 +16,5 @@ FormFieldPredictions::FormFieldPredictions(const FormFieldPredictions& other) overall_type(other.overall_type) { } -FormFieldPredictions::~FormFieldPredictions() { +FormFieldDataPredictions::~FormFieldDataPredictions() { } - -} // namespace forms -} // namespace webkit diff --git a/chrome/common/form_field_data_predictions.h b/chrome/common/form_field_data_predictions.h new file mode 100644 index 0000000..8dc5e34 --- /dev/null +++ b/chrome/common/form_field_data_predictions.h @@ -0,0 +1,26 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_COMMON_FORM_FIELD_DATA_PREDICTIONS_H_ +#define CHROME_COMMON_FORM_FIELD_DATA_PREDICTIONS_H_ + +#include <string> +#include <vector> + +#include "chrome/common/form_field_data.h" + +// Stores information about a field in a form. +struct FormFieldDataPredictions { + FormFieldDataPredictions(); + FormFieldDataPredictions(const FormFieldDataPredictions& other); + ~FormFieldDataPredictions(); + + FormFieldData field; + std::string signature; + std::string heuristic_type; + std::string server_type; + std::string overall_type; +}; + +#endif // CHROME_COMMON_FORM_FIELD_DATA_PREDICTIONS_H_ diff --git a/webkit/forms/password_form_dom_manager.cc b/chrome/common/password_form_fill_data.cc index 9354598..c733719 100644 --- a/webkit/forms/password_form_dom_manager.cc +++ b/chrome/common/password_form_fill_data.cc @@ -1,20 +1,11 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/forms/password_form_dom_manager.h" +#include "chrome/common/password_form_fill_data.h" #include "base/logging.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebPasswordFormData.h" -#include "webkit/forms/form_field.h" - -using WebKit::WebFormElement; -using WebKit::WebInputElement; -using WebKit::WebPasswordFormData; - -namespace webkit { -namespace forms { +#include "chrome/common/form_field_data.h" PasswordFormFillData::PasswordFormFillData() : wait_for_username(false) { } @@ -22,28 +13,19 @@ PasswordFormFillData::PasswordFormFillData() : wait_for_username(false) { PasswordFormFillData::~PasswordFormFillData() { } -scoped_ptr<PasswordForm> PasswordFormDomManager::CreatePasswordForm( - const WebFormElement& webform) { - WebPasswordFormData web_password_form(webform); - if (web_password_form.isValid()) - return scoped_ptr<PasswordForm>(new PasswordForm(web_password_form)); - return scoped_ptr<PasswordForm>(); -} - -// static -void PasswordFormDomManager::InitFillData( - const PasswordForm& form_on_page, - const PasswordFormMap& matches, - const PasswordForm* const preferred_match, +void InitPasswordFormFillData( + const content::PasswordForm& form_on_page, + const content::PasswordFormMap& matches, + const content::PasswordForm* const preferred_match, bool wait_for_username_before_autofill, PasswordFormFillData* result) { - // Note that many of the |FormField| members are not initialized for + // Note that many of the |FormFieldData| members are not initialized for // |username_field| and |password_field| because they are currently not used // by the password autocomplete code. - FormField username_field; + FormFieldData username_field; username_field.name = form_on_page.username_element; username_field.value = preferred_match->username_value; - FormField password_field; + FormFieldData password_field; password_field.name = form_on_page.password_element; password_field.value = preferred_match->password_value; @@ -55,12 +37,9 @@ void PasswordFormDomManager::InitFillData( result->wait_for_username = wait_for_username_before_autofill; // Copy additional username/value pairs. - PasswordFormMap::const_iterator iter; + content::PasswordFormMap::const_iterator iter; for (iter = matches.begin(); iter != matches.end(); iter++) { if (iter->second != preferred_match) result->additional_logins[iter->first] = iter->second->password_value; } } - -} // namespace forms -} // namespace webkit diff --git a/chrome/common/password_form_fill_data.h b/chrome/common/password_form_fill_data.h new file mode 100644 index 0000000..00850a9 --- /dev/null +++ b/chrome/common/password_form_fill_data.h @@ -0,0 +1,46 @@ +// Copyright 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_COMMON_PASSWORD_FORM_FILL_DATA_H_ +#define CHROME_COMMON_PASSWORD_FORM_FILL_DATA_H_ + +#include <map> + +#include "base/memory/scoped_ptr.h" +#include "chrome/common/form_data.h" +#include "content/public/common/password_form.h" + +// Structure used for autofilling password forms. +// basic_data identifies the HTML form on the page and preferred username/ +// password for login, while +// additional_logins is a list of other matching user/pass pairs for the form. +// wait_for_username tells us whether we need to wait for the user to enter +// a valid username before we autofill the password. By default, this is off +// unless the PasswordManager determined there is an additional risk +// associated with this form. This can happen, for example, if action URI's +// of the observed form and our saved representation don't match up. +struct PasswordFormFillData { + typedef std::map<string16, string16> LoginCollection; + + FormData basic_data; + LoginCollection additional_logins; + bool wait_for_username; + PasswordFormFillData(); + ~PasswordFormFillData(); +}; + +// Create a FillData structure in preparation for autofilling a form, +// from basic_data identifying which form to fill, and a collection of +// matching stored logins to use as username/password values. +// preferred_match should equal (address) one of matches. +// wait_for_username_before_autofill is true if we should not autofill +// anything until the user typed in a valid username and blurred the field. +void InitPasswordFormFillData( + const content::PasswordForm& form_on_page, + const content::PasswordFormMap& matches, + const content::PasswordForm* const preferred_match, + bool wait_for_username_before_autofill, + PasswordFormFillData* result); + +#endif // CHROME_COMMON_PASSWORD_FORM_FILL_DATA_H__ diff --git a/chrome/renderer/DEPS b/chrome/renderer/DEPS index d86e5de3..768d625 100644 --- a/chrome/renderer/DEPS +++ b/chrome/renderer/DEPS @@ -14,7 +14,6 @@ include_rules = [ "+webkit/extensions", "+webkit/fileapi", - "+webkit/forms", # Defines some types that are marshalled over IPC. "+webkit/glue", "+webkit/glue/plugins", "+webkit/gpu", diff --git a/chrome/renderer/autofill/autofill_agent.cc b/chrome/renderer/autofill/autofill_agent.cc index a86a213..bd574c0 100644 --- a/chrome/renderer/autofill/autofill_agent.cc +++ b/chrome/renderer/autofill/autofill_agent.cc @@ -12,8 +12,12 @@ #include "base/utf_string_conversions.h" #include "chrome/common/autofill_messages.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/form_data.h" +#include "chrome/common/form_data_predictions.h" +#include "chrome/common/form_field_data.h" #include "chrome/renderer/autofill/form_autofill_util.h" #include "chrome/renderer/autofill/password_autofill_manager.h" +#include "content/public/common/password_form.h" #include "content/public/renderer/render_view.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -28,10 +32,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/base/l10n/l10n_util.h" -#include "webkit/forms/form_data.h" -#include "webkit/forms/form_data_predictions.h" -#include "webkit/forms/form_field.h" -#include "webkit/forms/password_form.h" using WebKit::WebAutofillClient; using WebKit::WebFormControlElement; @@ -43,8 +43,6 @@ using WebKit::WebNode; using WebKit::WebNodeCollection; using WebKit::WebOptionElement; using WebKit::WebString; -using webkit::forms::FormData; -using webkit::forms::FormDataPredictions; namespace { @@ -169,7 +167,7 @@ bool AutofillAgent::OnMessageReceived(const IPC::Message& message) { void AutofillAgent::DidFinishDocumentLoad(WebFrame* frame) { // The document has now been fully loaded. Scan for forms to be sent up to // the browser. - std::vector<webkit::forms::FormData> forms; + std::vector<FormData> forms; form_cache_.ExtractForms(*frame, &forms); if (!forms.empty()) { @@ -334,8 +332,8 @@ void AutofillAgent::TextFieldDidChangeImpl(const WebInputElement& element) { ShowSuggestions(element, false, true, false); - webkit::forms::FormData form; - webkit::forms::FormField field; + FormData form; + FormFieldData field; if (FindFormAndFieldForInputElement(element, &form, &field, REQUIRE_NONE)) { Send(new AutofillHostMsg_TextFieldDidChange(routing_id(), form, field, base::TimeTicks::Now())); @@ -507,7 +505,7 @@ void AutofillAgent::AcceptDataListSuggestion(const string16& suggested_value) { } void AutofillAgent::OnFormDataFilled(int query_id, - const webkit::forms::FormData& form) { + const FormData& form) { if (!render_view()->GetWebView() || query_id != autofill_query_id_) return; @@ -626,8 +624,8 @@ void AutofillAgent::QueryAutofillSuggestions(const WebInputElement& element, autofill_query_id_ = query_counter++; display_warning_if_disabled_ = display_warning_if_disabled; - webkit::forms::FormData form; - webkit::forms::FormField field; + FormData form; + FormFieldData field; if (!FindFormAndFieldForInputElement(element, &form, &field, REQUIRE_AUTOCOMPLETE)) { // If we didn't find the cached form, at least let autocomplete have a shot @@ -675,8 +673,8 @@ void AutofillAgent::FillAutofillFormData(const WebNode& node, static int query_counter = 0; autofill_query_id_ = query_counter++; - webkit::forms::FormData form; - webkit::forms::FormField field; + FormData form; + FormFieldData field; if (!FindFormAndFieldForInputElement(node.toConst<WebInputElement>(), &form, &field, REQUIRE_AUTOCOMPLETE)) { return; diff --git a/chrome/renderer/autofill/autofill_agent.h b/chrome/renderer/autofill/autofill_agent.h index b269300..89f0a31 100644 --- a/chrome/renderer/autofill/autofill_agent.h +++ b/chrome/renderer/autofill/autofill_agent.h @@ -17,13 +17,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" -namespace webkit { -namespace forms { -struct FormData; -struct FormDataPredictions; -struct FormField; -} -} +struct FormFieldData; namespace WebKit { class WebNode; @@ -100,9 +94,9 @@ class AutofillAgent : public content::RenderViewObserver, const std::vector<string16>& labels, const std::vector<string16>& icons, const std::vector<int>& unique_ids); - void OnFormDataFilled(int query_id, const webkit::forms::FormData& form); + void OnFormDataFilled(int query_id, const FormData& form); void OnFieldTypePredictionsAvailable( - const std::vector<webkit::forms::FormDataPredictions>& forms); + const std::vector<FormDataPredictions>& forms); // For external Autofill selection. void OnSelectAutofillSuggestionAtIndex(int listIndex); @@ -163,8 +157,8 @@ class AutofillAgent : public content::RenderViewObserver, // |node|. Returns true if the data was found; and false otherwise. bool FindFormAndFieldForNode( const WebKit::WebNode& node, - webkit::forms::FormData* form, - webkit::forms::FormField* field) WARN_UNUSED_RESULT; + FormData* form, + FormFieldData* field) WARN_UNUSED_RESULT; // Set |node| to display the given |value|. void SetNodeText(const string16& value, WebKit::WebInputElement* node); diff --git a/chrome/renderer/autofill/autofill_renderer_browsertest.cc b/chrome/renderer/autofill/autofill_renderer_browsertest.cc index 6f38ca9..dd6171b 100644 --- a/chrome/renderer/autofill/autofill_renderer_browsertest.cc +++ b/chrome/renderer/autofill/autofill_renderer_browsertest.cc @@ -4,20 +4,18 @@ #include "base/utf_string_conversions.h" #include "chrome/common/autofill_messages.h" +#include "chrome/common/form_data.h" +#include "chrome/common/form_field_data.h" #include "chrome/test/base/chrome_render_view_test.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" -#include "webkit/forms/form_data.h" -#include "webkit/forms/form_field.h" using WebKit::WebDocument; using WebKit::WebFrame; using WebKit::WebInputElement; using WebKit::WebString; -using webkit::forms::FormData; -using webkit::forms::FormField; namespace autofill { @@ -49,31 +47,31 @@ TEST_F(ChromeRenderViewTest, SendForms) { ASSERT_EQ(1UL, forms.size()); ASSERT_EQ(4UL, forms[0].fields.size()); - FormField expected; + FormFieldData expected; expected.name = ASCIIToUTF16("firstname"); expected.value = string16(); expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, forms[0].fields[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, forms[0].fields[0]); expected.name = ASCIIToUTF16("middlename"); expected.value = string16(); expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, forms[0].fields[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, forms[0].fields[1]); expected.name = ASCIIToUTF16("lastname"); expected.value = string16(); expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, forms[0].fields[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, forms[0].fields[2]); expected.name = ASCIIToUTF16("state"); expected.value = ASCIIToUTF16("?"); expected.form_control_type = ASCIIToUTF16("select-one"); expected.max_length = 0; - EXPECT_FORM_FIELD_EQUALS(expected, forms[0].fields[3]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, forms[0].fields[3]); // Verify that |didAcceptAutofillSuggestion()| sends the expected number of // fields. @@ -110,19 +108,19 @@ TEST_F(ChromeRenderViewTest, SendForms) { expected.value = string16(); expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, form2.fields[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, form2.fields[0]); expected.name = ASCIIToUTF16("middlename"); expected.value = string16(); expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, form2.fields[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, form2.fields[1]); expected.name = ASCIIToUTF16("state"); expected.value = ASCIIToUTF16("?"); expected.form_control_type = ASCIIToUTF16("select-one"); expected.max_length = 0; - EXPECT_FORM_FIELD_EQUALS(expected, form2.fields[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, form2.fields[2]); } TEST_F(ChromeRenderViewTest, FillFormElement) { diff --git a/chrome/renderer/autofill/form_autocomplete_browsertest.cc b/chrome/renderer/autofill/form_autocomplete_browsertest.cc index 5285231..0249918 100644 --- a/chrome/renderer/autofill/form_autocomplete_browsertest.cc +++ b/chrome/renderer/autofill/form_autocomplete_browsertest.cc @@ -4,16 +4,15 @@ #include "base/time.h" #include "chrome/common/autofill_messages.h" +#include "chrome/common/form_data.h" #include "chrome/test/base/chrome_render_view_test.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.h" -#include "webkit/forms/form_data.h" #include "webkit/glue/web_io_operators.h" -using webkit::forms::FormData; using WebKit::WebFrame; using WebKit::WebString; using WebKit::WebURLError; @@ -40,7 +39,7 @@ TEST_F(FormAutocompleteTest, NormalFormSubmit) { AutofillHostMsg_FormSubmitted::Read(message, &forms); ASSERT_EQ(2U, forms.a.fields.size()); - webkit::forms::FormField& form_field = forms.a.fields[0]; + FormFieldData& form_field = forms.a.fields[0]; EXPECT_EQ(WebString("fname"), form_field.name); EXPECT_EQ(WebString("Rick"), form_field.value); @@ -89,7 +88,7 @@ TEST_F(FormAutocompleteTest, AutoCompleteOffInputSubmit) { AutofillHostMsg_FormSubmitted::Read(message, &forms); ASSERT_EQ(1U, forms.a.fields.size()); - webkit::forms::FormField& form_field = forms.a.fields[0]; + FormFieldData& form_field = forms.a.fields[0]; EXPECT_EQ(WebString("fname"), form_field.name); EXPECT_EQ(WebString("Rick"), form_field.value); } diff --git a/chrome/renderer/autofill/form_autofill_browsertest.cc b/chrome/renderer/autofill/form_autofill_browsertest.cc index ae91235..15ab038e 100644 --- a/chrome/renderer/autofill/form_autofill_browsertest.cc +++ b/chrome/renderer/autofill/form_autofill_browsertest.cc @@ -9,6 +9,7 @@ #include "base/string_util.h" #include "base/stringprintf.h" #include "base/utf_string_conversions.h" +#include "chrome/common/form_data.h" #include "chrome/renderer/autofill/form_autofill_util.h" #include "chrome/renderer/autofill/form_cache.h" #include "chrome/test/base/chrome_render_view_test.h" @@ -22,7 +23,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebSelectElement.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" -#include "webkit/forms/form_data.h" #include "webkit/glue/web_io_operators.h" using WebKit::WebDocument; @@ -44,9 +44,6 @@ using autofill::FormCache; using autofill::PreviewForm; using autofill::WebFormControlElementToFormField; -using webkit::forms::FormData; -using webkit::forms::FormField; - class FormAutofillTest : public ChromeRenderViewTest { public: FormAutofillTest() : ChromeRenderViewTest() {} @@ -84,19 +81,19 @@ class FormAutofillTest : public ChromeRenderViewTest { EXPECT_EQ(GURL(web_frame->document().url()), form.origin); EXPECT_EQ(GURL("http://cnn.com"), form.action); - const std::vector<FormField>& fields = form.fields; + const std::vector<FormFieldData>& fields = form.fields; ASSERT_EQ(labels.size(), fields.size()); for (size_t i = 0; i < labels.size(); ++i) { int max_length = control_types[i] == ASCIIToUTF16("text") ? WebInputElement::defaultMaxLength() : 0; - FormField expected; + FormFieldData expected; expected.label = labels[i]; expected.name = names[i]; expected.value = values[i]; expected.form_control_type = control_types[i]; expected.max_length = max_length; SCOPED_TRACE(StringPrintf("i: %" PRIuS, i)); - EXPECT_FORM_FIELD_EQUALS(expected, fields[i]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[i]); } } @@ -131,23 +128,23 @@ TEST_F(FormAutofillTest, WebFormControlElementToFormField) { WebElement web_element = frame->document().getElementById("element"); WebFormControlElement element = web_element.to<WebFormControlElement>(); - FormField result1; + FormFieldData result1; WebFormControlElementToFormField(element, autofill::EXTRACT_NONE, &result1); - FormField expected; + FormFieldData expected; expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); expected.name = ASCIIToUTF16("element"); expected.value = string16(); - EXPECT_FORM_FIELD_EQUALS(expected, result1); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, result1); - FormField result2; + FormFieldData result2; WebFormControlElementToFormField(element, autofill::EXTRACT_VALUE, &result2); expected.name = ASCIIToUTF16("element"); expected.value = ASCIIToUTF16("value"); - EXPECT_FORM_FIELD_EQUALS(expected, result2); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, result2); } // We should be able to extract a text field with autocomplete="off". @@ -160,15 +157,15 @@ TEST_F(FormAutofillTest, WebFormControlElementToFormFieldAutocompleteOff) { WebElement web_element = frame->document().getElementById("element"); WebFormControlElement element = web_element.to<WebFormControlElement>(); - FormField result; + FormFieldData result; WebFormControlElementToFormField(element, autofill::EXTRACT_VALUE, &result); - FormField expected; + FormFieldData expected; expected.name = ASCIIToUTF16("element"); expected.value = ASCIIToUTF16("value"); expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, result); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, result); } // We should be able to extract a text field with maxlength specified. @@ -181,15 +178,15 @@ TEST_F(FormAutofillTest, WebFormControlElementToFormFieldMaxLength) { WebElement web_element = frame->document().getElementById("element"); WebFormControlElement element = web_element.to<WebFormControlElement>(); - FormField result; + FormFieldData result; WebFormControlElementToFormField(element, autofill::EXTRACT_VALUE, &result); - FormField expected; + FormFieldData expected; expected.name = ASCIIToUTF16("element"); expected.value = ASCIIToUTF16("value"); expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = 5; - EXPECT_FORM_FIELD_EQUALS(expected, result); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, result); } // We should be able to extract a text field that has been autofilled. @@ -202,16 +199,16 @@ TEST_F(FormAutofillTest, WebFormControlElementToFormFieldAutofilled) { WebElement web_element = frame->document().getElementById("element"); WebInputElement element = web_element.to<WebInputElement>(); element.setAutofilled(true); - FormField result; + FormFieldData result; WebFormControlElementToFormField(element, autofill::EXTRACT_VALUE, &result); - FormField expected; + FormFieldData expected; expected.name = ASCIIToUTF16("element"); expected.value = ASCIIToUTF16("value"); expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); expected.is_autofilled = true; - EXPECT_FORM_FIELD_EQUALS(expected, result); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, result); } // We should be able to extract a <select> field. @@ -226,31 +223,31 @@ TEST_F(FormAutofillTest, WebFormControlElementToFormFieldSelect) { WebElement web_element = frame->document().getElementById("element"); WebFormControlElement element = web_element.to<WebFormControlElement>(); - FormField result1; + FormFieldData result1; WebFormControlElementToFormField(element, autofill::EXTRACT_VALUE, &result1); - FormField expected; + FormFieldData expected; expected.name = ASCIIToUTF16("element"); expected.max_length = 0; expected.form_control_type = ASCIIToUTF16("select-one"); expected.value = ASCIIToUTF16("CA"); - EXPECT_FORM_FIELD_EQUALS(expected, result1); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, result1); - FormField result2; + FormFieldData result2; WebFormControlElementToFormField( element, static_cast<autofill::ExtractMask>(autofill::EXTRACT_VALUE | autofill::EXTRACT_OPTION_TEXT), &result2); expected.value = ASCIIToUTF16("California"); - EXPECT_FORM_FIELD_EQUALS(expected, result2); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, result2); - FormField result3; + FormFieldData result3; WebFormControlElementToFormField(element, autofill::EXTRACT_OPTIONS, &result3); expected.value = string16(); - EXPECT_FORM_FIELD_EQUALS(expected, result3); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, result3); ASSERT_EQ(2U, result3.option_values.size()); ASSERT_EQ(2U, result3.option_contents.size()); @@ -275,36 +272,36 @@ TEST_F(FormAutofillTest, WebFormControlElementToFormFieldInvalidType) { WebElement web_element = frame->document().getElementById("hidden"); WebFormControlElement element = web_element.to<WebFormControlElement>(); - FormField result; + FormFieldData result; WebFormControlElementToFormField(element, autofill::EXTRACT_VALUE, &result); - FormField expected; + FormFieldData expected; expected.max_length = 0; expected.name = ASCIIToUTF16("hidden"); expected.form_control_type = ASCIIToUTF16("hidden"); - EXPECT_FORM_FIELD_EQUALS(expected, result); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, result); web_element = frame->document().getElementById("password"); element = web_element.to<WebFormControlElement>(); WebFormControlElementToFormField(element, autofill::EXTRACT_VALUE, &result); expected.name = ASCIIToUTF16("password"); expected.form_control_type = ASCIIToUTF16("password"); - EXPECT_FORM_FIELD_EQUALS(expected, result); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, result); web_element = frame->document().getElementById("checkbox"); element = web_element.to<WebFormControlElement>(); WebFormControlElementToFormField(element, autofill::EXTRACT_VALUE, &result); expected.name = ASCIIToUTF16("checkbox"); expected.form_control_type = ASCIIToUTF16("checkbox"); - EXPECT_FORM_FIELD_EQUALS(expected, result); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, result); web_element = frame->document().getElementById("radio"); element = web_element.to<WebFormControlElement>(); WebFormControlElementToFormField(element, autofill::EXTRACT_VALUE, &result); expected.name = ASCIIToUTF16("radio"); expected.form_control_type = ASCIIToUTF16("radio"); - EXPECT_FORM_FIELD_EQUALS(expected, result); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, result); web_element = frame->document().getElementById("submit"); @@ -312,7 +309,7 @@ TEST_F(FormAutofillTest, WebFormControlElementToFormFieldInvalidType) { WebFormControlElementToFormField(element, autofill::EXTRACT_VALUE, &result); expected.name = ASCIIToUTF16("submit"); expected.form_control_type = ASCIIToUTF16("submit"); - EXPECT_FORM_FIELD_EQUALS(expected, result); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, result); } // We should be able to extract the autocompletetype attribute. @@ -340,93 +337,93 @@ TEST_F(FormAutofillTest, WebFormControlElementToFormFieldAutocompletetype) { // An absent attribute is equivalent to an empty one. WebElement web_element = frame->document().getElementById("absent"); WebFormControlElement element = web_element.to<WebFormControlElement>(); - FormField result1; + FormFieldData result1; WebFormControlElementToFormField(element, autofill::EXTRACT_NONE, &result1); - FormField expected; + FormFieldData expected; expected.name = ASCIIToUTF16("absent"); expected.form_control_type = ASCIIToUTF16("text"); expected.autocomplete_type = string16(); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, result1); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, result1); web_element = frame->document().getElementById("empty"); element = web_element.to<WebFormControlElement>(); - FormField result2; + FormFieldData result2; WebFormControlElementToFormField(element, autofill::EXTRACT_NONE, &result2); expected.name = ASCIIToUTF16("empty"); expected.form_control_type = ASCIIToUTF16("text"); expected.autocomplete_type = string16(); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, result2); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, result2); // The renderer should trim whitespace. web_element = frame->document().getElementById("whitespace"); element = web_element.to<WebFormControlElement>(); - FormField result3; + FormFieldData result3; WebFormControlElementToFormField(element, autofill::EXTRACT_NONE, &result3); expected.name = ASCIIToUTF16("whitespace"); expected.form_control_type = ASCIIToUTF16("text"); expected.autocomplete_type = string16(); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, result3); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, result3); // Common case: exactly one type specified. web_element = frame->document().getElementById("regular"); element = web_element.to<WebFormControlElement>(); - FormField result4; + FormFieldData result4; WebFormControlElementToFormField(element, autofill::EXTRACT_NONE, &result4); expected.name = ASCIIToUTF16("regular"); expected.form_control_type = ASCIIToUTF16("text"); expected.autocomplete_type = ASCIIToUTF16("email"); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, result4); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, result4); // Verify that we correctly extract fallback types as well. web_element = frame->document().getElementById("multi-valued"); element = web_element.to<WebFormControlElement>(); - FormField result5; + FormFieldData result5; WebFormControlElementToFormField(element, autofill::EXTRACT_NONE, &result5); expected.name = ASCIIToUTF16("multi-valued"); expected.form_control_type = ASCIIToUTF16("text"); expected.autocomplete_type = ASCIIToUTF16("x-confirm-email email"); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, result5); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, result5); // The attribute is not yet part of the HTML standard, so we only recognize // the prefixed version -- 'x-autocompletetype' -- and not the unprefixed one. web_element = frame->document().getElementById("unprefixed"); element = web_element.to<WebFormControlElement>(); - FormField result6; + FormFieldData result6; WebFormControlElementToFormField(element, autofill::EXTRACT_NONE, &result6); expected.name = ASCIIToUTF16("unprefixed"); expected.form_control_type = ASCIIToUTF16("text"); expected.autocomplete_type = string16(); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, result6); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, result6); // <select> elements should behave no differently from text fields here. web_element = frame->document().getElementById("select"); element = web_element.to<WebFormControlElement>(); - FormField result7; + FormFieldData result7; WebFormControlElementToFormField(element, autofill::EXTRACT_NONE, &result7); expected.name = ASCIIToUTF16("select"); expected.form_control_type = ASCIIToUTF16("select-one"); expected.autocomplete_type = ASCIIToUTF16("state"); expected.max_length = 0; - EXPECT_FORM_FIELD_EQUALS(expected, result7); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, result7); // Very long attribute values should be replaced by a default string, to // prevent malicious websites from DOSing the browser process. web_element = frame->document().getElementById("malicious"); element = web_element.to<WebFormControlElement>(); - FormField result8; + FormFieldData result8; WebFormControlElementToFormField(element, autofill::EXTRACT_NONE, &result8); expected.name = ASCIIToUTF16("malicious"); expected.form_control_type = ASCIIToUTF16("text"); expected.autocomplete_type = ASCIIToUTF16("x-max-data-length-exceeded"); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, result8); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, result8); } TEST_F(FormAutofillTest, WebFormElementToFormData) { @@ -459,7 +456,7 @@ TEST_F(FormAutofillTest, WebFormElementToFormData) { WebInputElement input_element = element.to<WebInputElement>(); FormData form; - FormField field; + FormFieldData field; EXPECT_TRUE(WebFormElementToFormData(forms[0], input_element, autofill::REQUIRE_NONE, @@ -470,30 +467,30 @@ TEST_F(FormAutofillTest, WebFormElementToFormData) { EXPECT_EQ(GURL(frame->document().url()), form.origin); EXPECT_EQ(GURL("http://cnn.com"), form.action); - const std::vector<FormField>& fields = form.fields; + const std::vector<FormFieldData>& fields = form.fields; ASSERT_EQ(3U, fields.size()); - FormField expected; + FormFieldData expected; expected.name = ASCIIToUTF16("firstname"); expected.value = ASCIIToUTF16("John"); expected.label = ASCIIToUTF16("First name:"); expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, fields[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[0]); expected.name = ASCIIToUTF16("lastname"); expected.value = ASCIIToUTF16("Smith"); expected.label = ASCIIToUTF16("Last name:"); expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, fields[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); expected.name = ASCIIToUTF16("state"); expected.value = ASCIIToUTF16("CA"); expected.label = ASCIIToUTF16("State:"); expected.form_control_type = ASCIIToUTF16("select-one"); expected.max_length = 0; - EXPECT_FORM_FIELD_EQUALS(expected, fields[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); } // We should not be able to serialize a form with too many fillable fields. @@ -517,7 +514,7 @@ TEST_F(FormAutofillTest, WebFormElementToFormDataTooManyFields) { WebInputElement input_element = element.to<WebInputElement>(); FormData form; - FormField field; + FormFieldData field; EXPECT_FALSE(WebFormElementToFormData(forms[0], input_element, autofill::REQUIRE_NONE, @@ -564,24 +561,24 @@ TEST_F(FormAutofillTest, ExtractMultipleForms) { EXPECT_EQ(GURL(web_frame->document().url()), form.origin); EXPECT_EQ(GURL("http://cnn.com"), form.action); - const std::vector<FormField>& fields = form.fields; + const std::vector<FormFieldData>& fields = form.fields; ASSERT_EQ(3U, fields.size()); - FormField expected; + FormFieldData expected; expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); expected.name = ASCIIToUTF16("firstname"); expected.value = ASCIIToUTF16("John"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[0]); expected.name = ASCIIToUTF16("lastname"); expected.value = ASCIIToUTF16("Smith"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); expected.name = ASCIIToUTF16("email"); expected.value = ASCIIToUTF16("john@example.com"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); // Second form. const FormData& form2 = forms[1]; @@ -589,20 +586,20 @@ TEST_F(FormAutofillTest, ExtractMultipleForms) { EXPECT_EQ(GURL(web_frame->document().url()), form2.origin); EXPECT_EQ(GURL("http://zoo.com"), form2.action); - const std::vector<FormField>& fields2 = form2.fields; + const std::vector<FormFieldData>& fields2 = form2.fields; ASSERT_EQ(3U, fields2.size()); expected.name = ASCIIToUTF16("firstname"); expected.value = ASCIIToUTF16("Jack"); - EXPECT_FORM_FIELD_EQUALS(expected, fields2[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[0]); expected.name = ASCIIToUTF16("lastname"); expected.value = ASCIIToUTF16("Adams"); - EXPECT_FORM_FIELD_EQUALS(expected, fields2[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[1]); expected.name = ASCIIToUTF16("email"); expected.value = ASCIIToUTF16("jack@example.com"); - EXPECT_FORM_FIELD_EQUALS(expected, fields2[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[2]); } // We should not extract a form if it has too few fillable fields. @@ -679,24 +676,24 @@ TEST_F(FormAutofillTest, WebFormElementToFormDataAutocomplete) { EXPECT_EQ(GURL(web_frame->document().url()), form.origin); EXPECT_EQ(GURL("http://abc.com"), form.action); - const std::vector<FormField>& fields = form.fields; + const std::vector<FormFieldData>& fields = form.fields; ASSERT_EQ(3U, fields.size()); - FormField expected; + FormFieldData expected; expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); expected.name = ASCIIToUTF16("middlename"); expected.value = ASCIIToUTF16("Jack"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[0]); expected.name = ASCIIToUTF16("lastname"); expected.value = ASCIIToUTF16("Smith"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); expected.name = ASCIIToUTF16("email"); expected.value = ASCIIToUTF16("john@example.com"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); } } @@ -724,47 +721,47 @@ TEST_F(FormAutofillTest, FindForm) { // Find the form and verify it's the correct form. FormData form; - FormField field; + FormFieldData field; EXPECT_TRUE(FindFormAndFieldForInputElement(input_element, &form, &field, autofill::REQUIRE_NONE)); EXPECT_EQ(ASCIIToUTF16("TestForm"), form.name); EXPECT_EQ(GURL(web_frame->document().url()), form.origin); EXPECT_EQ(GURL("http://buh.com"), form.action); - const std::vector<FormField>& fields = form.fields; + const std::vector<FormFieldData>& fields = form.fields; ASSERT_EQ(4U, fields.size()); - FormField expected; + FormFieldData expected; expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); expected.name = ASCIIToUTF16("firstname"); expected.value = ASCIIToUTF16("John"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[0]); - EXPECT_FORM_FIELD_EQUALS(expected, field); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, field); expected.name = ASCIIToUTF16("lastname"); expected.value = ASCIIToUTF16("Smith"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); expected.name = ASCIIToUTF16("email"); expected.value = ASCIIToUTF16("john@example.com"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); expected.name = ASCIIToUTF16("phone"); expected.value = ASCIIToUTF16("1.800.555.1234"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[3]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[3]); // Try again, but require autocomplete. FormData form2; - FormField field2; + FormFieldData field2; EXPECT_TRUE(FindFormAndFieldForInputElement(input_element, &form2, &field2, autofill::REQUIRE_AUTOCOMPLETE)); EXPECT_EQ(ASCIIToUTF16("TestForm"), form2.name); EXPECT_EQ(GURL(web_frame->document().url()), form2.origin); EXPECT_EQ(GURL("http://buh.com"), form2.action); - const std::vector<FormField>& fields2 = form2.fields; + const std::vector<FormFieldData>& fields2 = form2.fields; ASSERT_EQ(3U, fields2.size()); expected.form_control_type = ASCIIToUTF16("text"); @@ -772,16 +769,16 @@ TEST_F(FormAutofillTest, FindForm) { expected.name = ASCIIToUTF16("firstname"); expected.value = ASCIIToUTF16("John"); - EXPECT_FORM_FIELD_EQUALS(expected, fields2[0]); - EXPECT_FORM_FIELD_EQUALS(expected, field); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, field); expected.name = ASCIIToUTF16("lastname"); expected.value = ASCIIToUTF16("Smith"); - EXPECT_FORM_FIELD_EQUALS(expected, fields2[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[1]); expected.name = ASCIIToUTF16("phone"); expected.value = ASCIIToUTF16("1.800.555.1234"); - EXPECT_FORM_FIELD_EQUALS(expected, fields2[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[2]); } TEST_F(FormAutofillTest, FillForm) { @@ -813,47 +810,47 @@ TEST_F(FormAutofillTest, FillForm) { // Find the form that contains the input element. FormData form; - FormField field; + FormFieldData field; EXPECT_TRUE(FindFormAndFieldForInputElement(input_element, &form, &field, autofill::REQUIRE_AUTOCOMPLETE)); EXPECT_EQ(ASCIIToUTF16("TestForm"), form.name); EXPECT_EQ(GURL(web_frame->document().url()), form.origin); EXPECT_EQ(GURL("http://buh.com"), form.action); - const std::vector<FormField>& fields = form.fields; + const std::vector<FormFieldData>& fields = form.fields; ASSERT_EQ(7U, fields.size()); - FormField expected; + FormFieldData expected; expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); expected.name = ASCIIToUTF16("firstname"); expected.value = string16(); - EXPECT_FORM_FIELD_EQUALS(expected, fields[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[0]); expected.name = ASCIIToUTF16("lastname"); expected.value = string16(); - EXPECT_FORM_FIELD_EQUALS(expected, fields[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); expected.name = ASCIIToUTF16("notempty"); expected.value = ASCIIToUTF16("Hi"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); expected.name = ASCIIToUTF16("notenabled"); expected.value = string16(); - EXPECT_FORM_FIELD_EQUALS(expected, fields[3]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[3]); expected.name = ASCIIToUTF16("readonly"); expected.value = string16(); - EXPECT_FORM_FIELD_EQUALS(expected, fields[4]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[4]); expected.name = ASCIIToUTF16("invisible"); expected.value = string16(); - EXPECT_FORM_FIELD_EQUALS(expected, fields[5]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[5]); expected.name = ASCIIToUTF16("displaynone"); expected.value = string16(); - EXPECT_FORM_FIELD_EQUALS(expected, fields[6]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[6]); // Fill the form. form.fields[0].value = ASCIIToUTF16("Wyatt"); @@ -940,35 +937,35 @@ TEST_F(FormAutofillTest, PreviewForm) { // Find the form that contains the input element. FormData form; - FormField field; + FormFieldData field; EXPECT_TRUE(FindFormAndFieldForInputElement(input_element, &form, &field, autofill::REQUIRE_AUTOCOMPLETE)); EXPECT_EQ(ASCIIToUTF16("TestForm"), form.name); EXPECT_EQ(GURL(web_frame->document().url()), form.origin); EXPECT_EQ(GURL("http://buh.com"), form.action); - const std::vector<FormField>& fields = form.fields; + const std::vector<FormFieldData>& fields = form.fields; ASSERT_EQ(4U, fields.size()); - FormField expected; + FormFieldData expected; expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); expected.name = ASCIIToUTF16("firstname"); expected.value = string16(); - EXPECT_FORM_FIELD_EQUALS(expected, fields[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[0]); expected.name = ASCIIToUTF16("lastname"); expected.value = string16(); - EXPECT_FORM_FIELD_EQUALS(expected, fields[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); expected.name = ASCIIToUTF16("notempty"); expected.value = ASCIIToUTF16("Hi"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); expected.name = ASCIIToUTF16("notenabled"); expected.value = string16(); - EXPECT_FORM_FIELD_EQUALS(expected, fields[3]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[3]); // Preview the form. form.fields[0].value = ASCIIToUTF16("Wyatt"); @@ -1891,33 +1888,33 @@ TEST_F(FormAutofillTest, FillFormMaxLength) { // Find the form that contains the input element. FormData form; - FormField field; + FormFieldData field; EXPECT_TRUE(FindFormAndFieldForInputElement(input_element, &form, &field, autofill::REQUIRE_NONE)); EXPECT_EQ(ASCIIToUTF16("TestForm"), form.name); EXPECT_EQ(GURL(web_frame->document().url()), form.origin); EXPECT_EQ(GURL("http://buh.com"), form.action); - const std::vector<FormField>& fields = form.fields; + const std::vector<FormFieldData>& fields = form.fields; ASSERT_EQ(3U, fields.size()); - FormField expected; + FormFieldData expected; expected.form_control_type = ASCIIToUTF16("text"); expected.name = ASCIIToUTF16("firstname"); expected.max_length = 5; expected.is_autofilled = false; - EXPECT_FORM_FIELD_EQUALS(expected, fields[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[0]); expected.name = ASCIIToUTF16("lastname"); expected.max_length = 7; expected.is_autofilled = false; - EXPECT_FORM_FIELD_EQUALS(expected, fields[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); expected.name = ASCIIToUTF16("email"); expected.max_length = 9; expected.is_autofilled = false; - EXPECT_FORM_FIELD_EQUALS(expected, fields[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); // Fill the form. form.fields[0].value = ASCIIToUTF16("Brother"); @@ -1927,7 +1924,7 @@ TEST_F(FormAutofillTest, FillFormMaxLength) { // Find the newly-filled form that contains the input element. FormData form2; - FormField field2; + FormFieldData field2; EXPECT_TRUE(FindFormAndFieldForInputElement(input_element, &form2, &field2, autofill::REQUIRE_NONE)); @@ -1935,7 +1932,7 @@ TEST_F(FormAutofillTest, FillFormMaxLength) { EXPECT_EQ(GURL(web_frame->document().url()), form2.origin); EXPECT_EQ(GURL("http://buh.com"), form2.action); - const std::vector<FormField>& fields2 = form2.fields; + const std::vector<FormFieldData>& fields2 = form2.fields; ASSERT_EQ(3U, fields2.size()); expected.form_control_type = ASCIIToUTF16("text"); @@ -1944,19 +1941,19 @@ TEST_F(FormAutofillTest, FillFormMaxLength) { expected.value = ASCIIToUTF16("Broth"); expected.max_length = 5; expected.is_autofilled = true; - EXPECT_FORM_FIELD_EQUALS(expected, fields2[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[0]); expected.name = ASCIIToUTF16("lastname"); expected.value = ASCIIToUTF16("Jonatha"); expected.max_length = 7; expected.is_autofilled = true; - EXPECT_FORM_FIELD_EQUALS(expected, fields2[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[1]); expected.name = ASCIIToUTF16("email"); expected.value = ASCIIToUTF16("brotherj@"); expected.max_length = 9; expected.is_autofilled = true; - EXPECT_FORM_FIELD_EQUALS(expected, fields2[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[2]); } // This test uses negative values of the maxlength attribute for input elements. @@ -1984,28 +1981,28 @@ TEST_F(FormAutofillTest, FillFormNegativeMaxLength) { // Find the form that contains the input element. FormData form; - FormField field; + FormFieldData field; EXPECT_TRUE(FindFormAndFieldForInputElement(input_element, &form, &field, autofill::REQUIRE_NONE)); EXPECT_EQ(ASCIIToUTF16("TestForm"), form.name); EXPECT_EQ(GURL(web_frame->document().url()), form.origin); EXPECT_EQ(GURL("http://buh.com"), form.action); - const std::vector<FormField>& fields = form.fields; + const std::vector<FormFieldData>& fields = form.fields; ASSERT_EQ(3U, fields.size()); - FormField expected; + FormFieldData expected; expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); expected.name = ASCIIToUTF16("firstname"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[0]); expected.name = ASCIIToUTF16("lastname"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); expected.name = ASCIIToUTF16("email"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); // Fill the form. form.fields[0].value = ASCIIToUTF16("Brother"); @@ -2015,7 +2012,7 @@ TEST_F(FormAutofillTest, FillFormNegativeMaxLength) { // Find the newly-filled form that contains the input element. FormData form2; - FormField field2; + FormFieldData field2; EXPECT_TRUE(FindFormAndFieldForInputElement(input_element, &form2, &field2, autofill::REQUIRE_NONE)); @@ -2023,20 +2020,20 @@ TEST_F(FormAutofillTest, FillFormNegativeMaxLength) { EXPECT_EQ(GURL(web_frame->document().url()), form2.origin); EXPECT_EQ(GURL("http://buh.com"), form2.action); - const std::vector<FormField>& fields2 = form2.fields; + const std::vector<FormFieldData>& fields2 = form2.fields; ASSERT_EQ(3U, fields2.size()); expected.name = ASCIIToUTF16("firstname"); expected.value = ASCIIToUTF16("Brother"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[0]); expected.name = ASCIIToUTF16("lastname"); expected.value = ASCIIToUTF16("Jonathan"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); expected.name = ASCIIToUTF16("email"); expected.value = ASCIIToUTF16("brotherj@example.com"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); } TEST_F(FormAutofillTest, FillFormEmptyName) { @@ -2061,28 +2058,28 @@ TEST_F(FormAutofillTest, FillFormEmptyName) { // Find the form that contains the input element. FormData form; - FormField field; + FormFieldData field; EXPECT_TRUE(FindFormAndFieldForInputElement(input_element, &form, &field, autofill::REQUIRE_NONE)); EXPECT_EQ(ASCIIToUTF16("TestForm"), form.name); EXPECT_EQ(GURL(web_frame->document().url()), form.origin); EXPECT_EQ(GURL("http://buh.com"), form.action); - const std::vector<FormField>& fields = form.fields; + const std::vector<FormFieldData>& fields = form.fields; ASSERT_EQ(3U, fields.size()); - FormField expected; + FormFieldData expected; expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); expected.name = ASCIIToUTF16("firstname"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[0]); expected.name = ASCIIToUTF16("lastname"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); expected.name = ASCIIToUTF16("email"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); // Fill the form. form.fields[0].value = ASCIIToUTF16("Wyatt"); @@ -2092,7 +2089,7 @@ TEST_F(FormAutofillTest, FillFormEmptyName) { // Find the newly-filled form that contains the input element. FormData form2; - FormField field2; + FormFieldData field2; EXPECT_TRUE(FindFormAndFieldForInputElement(input_element, &form2, &field2, autofill::REQUIRE_NONE)); @@ -2100,7 +2097,7 @@ TEST_F(FormAutofillTest, FillFormEmptyName) { EXPECT_EQ(GURL(web_frame->document().url()), form2.origin); EXPECT_EQ(GURL("http://buh.com"), form2.action); - const std::vector<FormField>& fields2 = form2.fields; + const std::vector<FormFieldData>& fields2 = form2.fields; ASSERT_EQ(3U, fields2.size()); expected.form_control_type = ASCIIToUTF16("text"); @@ -2108,15 +2105,15 @@ TEST_F(FormAutofillTest, FillFormEmptyName) { expected.name = ASCIIToUTF16("firstname"); expected.value = ASCIIToUTF16("Wyatt"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[0]); expected.name = ASCIIToUTF16("lastname"); expected.value = ASCIIToUTF16("Earp"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); expected.name = ASCIIToUTF16("email"); expected.value = ASCIIToUTF16("wyatt@example.com"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); } TEST_F(FormAutofillTest, FillFormEmptyFormNames) { @@ -2147,31 +2144,31 @@ TEST_F(FormAutofillTest, FillFormEmptyFormNames) { // Find the form that contains the input element. FormData form; - FormField field; + FormFieldData field; EXPECT_TRUE(FindFormAndFieldForInputElement(input_element, &form, &field, autofill::REQUIRE_NONE)); EXPECT_EQ(string16(), form.name); EXPECT_EQ(GURL(web_frame->document().url()), form.origin); EXPECT_EQ(GURL("http://abc.com"), form.action); - const std::vector<FormField>& fields = form.fields; + const std::vector<FormFieldData>& fields = form.fields; ASSERT_EQ(3U, fields.size()); - FormField expected; + FormFieldData expected; expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); expected.name = ASCIIToUTF16("apple"); expected.is_autofilled = false; - EXPECT_FORM_FIELD_EQUALS(expected, fields[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[0]); expected.name = ASCIIToUTF16("banana"); expected.is_autofilled = false; - EXPECT_FORM_FIELD_EQUALS(expected, fields[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); expected.name = ASCIIToUTF16("cantelope"); expected.is_autofilled = false; - EXPECT_FORM_FIELD_EQUALS(expected, fields[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); // Fill the form. form.fields[0].value = ASCIIToUTF16("Red"); @@ -2181,7 +2178,7 @@ TEST_F(FormAutofillTest, FillFormEmptyFormNames) { // Find the newly-filled form that contains the input element. FormData form2; - FormField field2; + FormFieldData field2; EXPECT_TRUE(FindFormAndFieldForInputElement(input_element, &form2, &field2, autofill::REQUIRE_NONE)); @@ -2189,23 +2186,23 @@ TEST_F(FormAutofillTest, FillFormEmptyFormNames) { EXPECT_EQ(GURL(web_frame->document().url()), form2.origin); EXPECT_EQ(GURL("http://abc.com"), form2.action); - const std::vector<FormField>& fields2 = form2.fields; + const std::vector<FormFieldData>& fields2 = form2.fields; ASSERT_EQ(3U, fields2.size()); expected.name = ASCIIToUTF16("apple"); expected.value = ASCIIToUTF16("Red"); expected.is_autofilled = true; - EXPECT_FORM_FIELD_EQUALS(expected, fields2[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[0]); expected.name = ASCIIToUTF16("banana"); expected.value = ASCIIToUTF16("Yellow"); expected.is_autofilled = true; - EXPECT_FORM_FIELD_EQUALS(expected, fields2[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[1]); expected.name = ASCIIToUTF16("cantelope"); expected.value = ASCIIToUTF16("Also Yellow"); expected.is_autofilled = true; - EXPECT_FORM_FIELD_EQUALS(expected, fields2[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[2]); } TEST_F(FormAutofillTest, ThreePartPhone) { @@ -2240,28 +2237,28 @@ TEST_F(FormAutofillTest, ThreePartPhone) { EXPECT_EQ(GURL(frame->document().url()), form.origin); EXPECT_EQ(GURL("http://cnn.com"), form.action); - const std::vector<FormField>& fields = form.fields; + const std::vector<FormFieldData>& fields = form.fields; ASSERT_EQ(4U, fields.size()); - FormField expected; + FormFieldData expected; expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); expected.label = ASCIIToUTF16("Phone:"); expected.name = ASCIIToUTF16("dayphone1"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[0]); expected.label = ASCIIToUTF16("-"); expected.name = ASCIIToUTF16("dayphone2"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); expected.label = ASCIIToUTF16("-"); expected.name = ASCIIToUTF16("dayphone3"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); expected.label = ASCIIToUTF16("ext.:"); expected.name = ASCIIToUTF16("dayphone4"); - EXPECT_FORM_FIELD_EQUALS(expected, fields[3]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[3]); } @@ -2299,43 +2296,43 @@ TEST_F(FormAutofillTest, MaxLengthFields) { EXPECT_EQ(GURL(frame->document().url()), form.origin); EXPECT_EQ(GURL("http://cnn.com"), form.action); - const std::vector<FormField>& fields = form.fields; + const std::vector<FormFieldData>& fields = form.fields; ASSERT_EQ(6U, fields.size()); - FormField expected; + FormFieldData expected; expected.form_control_type = ASCIIToUTF16("text"); expected.label = ASCIIToUTF16("Phone:"); expected.name = ASCIIToUTF16("dayphone1"); expected.max_length = 3; - EXPECT_FORM_FIELD_EQUALS(expected, fields[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[0]); expected.label = ASCIIToUTF16("-"); expected.name = ASCIIToUTF16("dayphone2"); expected.max_length = 3; - EXPECT_FORM_FIELD_EQUALS(expected, fields[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); expected.label = ASCIIToUTF16("-"); expected.name = ASCIIToUTF16("dayphone3"); expected.max_length = 4; - EXPECT_FORM_FIELD_EQUALS(expected, fields[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); expected.label = ASCIIToUTF16("ext.:"); expected.name = ASCIIToUTF16("dayphone4"); expected.max_length = 5; - EXPECT_FORM_FIELD_EQUALS(expected, fields[3]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[3]); // When unspecified |size|, default is returned. expected.label = string16(); expected.name = ASCIIToUTF16("default1"); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, fields[4]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[4]); // When invalid |size|, default is returned. expected.label = string16(); expected.name = ASCIIToUTF16("invalid1"); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, fields[5]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[5]); } // This test re-creates the experience of typing in a field then selecting a @@ -2366,34 +2363,34 @@ TEST_F(FormAutofillTest, FillFormNonEmptyField) { // Find the form that contains the input element. FormData form; - FormField field; + FormFieldData field; EXPECT_TRUE(FindFormAndFieldForInputElement(input_element, &form, &field, autofill::REQUIRE_NONE)); EXPECT_EQ(ASCIIToUTF16("TestForm"), form.name); EXPECT_EQ(GURL(web_frame->document().url()), form.origin); EXPECT_EQ(GURL("http://buh.com"), form.action); - const std::vector<FormField>& fields = form.fields; + const std::vector<FormFieldData>& fields = form.fields; ASSERT_EQ(3U, fields.size()); - FormField expected; + FormFieldData expected; expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); expected.name = ASCIIToUTF16("firstname"); expected.value = ASCIIToUTF16("Wy"); expected.is_autofilled = false; - EXPECT_FORM_FIELD_EQUALS(expected, fields[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[0]); expected.name = ASCIIToUTF16("lastname"); expected.value = string16(); expected.is_autofilled = false; - EXPECT_FORM_FIELD_EQUALS(expected, fields[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); expected.name = ASCIIToUTF16("email"); expected.value = string16(); expected.is_autofilled = false; - EXPECT_FORM_FIELD_EQUALS(expected, fields[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); // Preview the form and verify that the cursor position has been updated. form.fields[0].value = ASCIIToUTF16("Wyatt"); @@ -2408,7 +2405,7 @@ TEST_F(FormAutofillTest, FillFormNonEmptyField) { // Find the newly-filled form that contains the input element. FormData form2; - FormField field2; + FormFieldData field2; EXPECT_TRUE(FindFormAndFieldForInputElement(input_element, &form2, &field2, autofill::REQUIRE_NONE)); @@ -2416,23 +2413,23 @@ TEST_F(FormAutofillTest, FillFormNonEmptyField) { EXPECT_EQ(GURL(web_frame->document().url()), form2.origin); EXPECT_EQ(GURL("http://buh.com"), form2.action); - const std::vector<FormField>& fields2 = form2.fields; + const std::vector<FormFieldData>& fields2 = form2.fields; ASSERT_EQ(3U, fields2.size()); expected.name = ASCIIToUTF16("firstname"); expected.value = ASCIIToUTF16("Wyatt"); expected.is_autofilled = true; - EXPECT_FORM_FIELD_EQUALS(expected, fields2[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[0]); expected.name = ASCIIToUTF16("lastname"); expected.value = ASCIIToUTF16("Earp"); expected.is_autofilled = true; - EXPECT_FORM_FIELD_EQUALS(expected, fields2[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[1]); expected.name = ASCIIToUTF16("email"); expected.value = ASCIIToUTF16("wyatt@example.com"); expected.is_autofilled = true; - EXPECT_FORM_FIELD_EQUALS(expected, fields2[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[2]); // Verify that the cursor position has been updated. EXPECT_EQ(5, input_element.selectionStart()); @@ -2475,35 +2472,35 @@ TEST_F(FormAutofillTest, ClearFormWithNode) { // Verify the form is cleared. FormData form2; - FormField field2; + FormFieldData field2; EXPECT_TRUE(FindFormAndFieldForInputElement(firstname, &form2, &field2, autofill::REQUIRE_NONE)); EXPECT_EQ(ASCIIToUTF16("TestForm"), form2.name); EXPECT_EQ(GURL(web_frame->document().url()), form2.origin); EXPECT_EQ(GURL("http://buh.com"), form2.action); - const std::vector<FormField>& fields2 = form2.fields; + const std::vector<FormFieldData>& fields2 = form2.fields; ASSERT_EQ(4U, fields2.size()); - FormField expected; + FormFieldData expected; expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); expected.name = ASCIIToUTF16("firstname"); expected.value = string16(); - EXPECT_FORM_FIELD_EQUALS(expected, fields2[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[0]); expected.name = ASCIIToUTF16("lastname"); expected.value = string16(); - EXPECT_FORM_FIELD_EQUALS(expected, fields2[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[1]); expected.name = ASCIIToUTF16("noAC"); expected.value = string16(); - EXPECT_FORM_FIELD_EQUALS(expected, fields2[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[2]); expected.name = ASCIIToUTF16("notenabled"); expected.value = ASCIIToUTF16("no clear"); - EXPECT_FORM_FIELD_EQUALS(expected, fields2[3]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[3]); // Verify that the cursor position has been updated. EXPECT_EQ(0, firstname.selectionStart()); @@ -2550,35 +2547,35 @@ TEST_F(FormAutofillTest, ClearFormWithNodeContainingSelectOne) { // Verify the form is cleared. FormData form2; - FormField field2; + FormFieldData field2; EXPECT_TRUE(FindFormAndFieldForInputElement(firstname, &form2, &field2, autofill::REQUIRE_NONE)); EXPECT_EQ(ASCIIToUTF16("TestForm"), form2.name); EXPECT_EQ(GURL(web_frame->document().url()), form2.origin); EXPECT_EQ(GURL("http://buh.com"), form2.action); - const std::vector<FormField>& fields2 = form2.fields; + const std::vector<FormFieldData>& fields2 = form2.fields; ASSERT_EQ(3U, fields2.size()); - FormField expected; + FormFieldData expected; expected.name = ASCIIToUTF16("firstname"); expected.value = string16(); expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, fields2[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[0]); expected.name = ASCIIToUTF16("lastname"); expected.value = string16(); expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, fields2[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[1]); expected.name = ASCIIToUTF16("state"); expected.value = ASCIIToUTF16("?"); expected.form_control_type = ASCIIToUTF16("select-one"); expected.max_length = 0; - EXPECT_FORM_FIELD_EQUALS(expected, fields2[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[2]); // Verify that the cursor position has been updated. EXPECT_EQ(0, firstname.selectionStart()); @@ -2886,28 +2883,28 @@ TEST_F(FormAutofillTest, SelectOneAsText) { EXPECT_EQ(GURL(frame->document().url()), form.origin); EXPECT_EQ(GURL("http://cnn.com"), form.action); - const std::vector<FormField>& fields = form.fields; + const std::vector<FormFieldData>& fields = form.fields; ASSERT_EQ(3U, fields.size()); - FormField expected; + FormFieldData expected; expected.name = ASCIIToUTF16("firstname"); expected.value = ASCIIToUTF16("John"); expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, fields[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[0]); expected.name = ASCIIToUTF16("lastname"); expected.value = ASCIIToUTF16("Smith"); expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, fields[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); expected.name = ASCIIToUTF16("country"); expected.value = ASCIIToUTF16("Albania"); expected.form_control_type = ASCIIToUTF16("select-one"); expected.max_length = 0; - EXPECT_FORM_FIELD_EQUALS(expected, fields[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); form.fields.clear(); // Extract the country select-one value as value. @@ -2927,17 +2924,17 @@ TEST_F(FormAutofillTest, SelectOneAsText) { expected.value = ASCIIToUTF16("John"); expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, fields[0]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[0]); expected.name = ASCIIToUTF16("lastname"); expected.value = ASCIIToUTF16("Smith"); expected.form_control_type = ASCIIToUTF16("text"); expected.max_length = WebInputElement::defaultMaxLength(); - EXPECT_FORM_FIELD_EQUALS(expected, fields[1]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); expected.name = ASCIIToUTF16("country"); expected.value = ASCIIToUTF16("AL"); expected.form_control_type = ASCIIToUTF16("select-one"); expected.max_length = 0; - EXPECT_FORM_FIELD_EQUALS(expected, fields[2]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); } diff --git a/chrome/renderer/autofill/form_autofill_util.cc b/chrome/renderer/autofill/form_autofill_util.cc index 105c89d..42d6ffa 100644 --- a/chrome/renderer/autofill/form_autofill_util.cc +++ b/chrome/renderer/autofill/form_autofill_util.cc @@ -10,6 +10,8 @@ #include "base/memory/scoped_vector.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" +#include "chrome/common/form_data.h" +#include "chrome/common/form_field_data.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement.h" @@ -23,8 +25,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebSelectElement.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" -#include "webkit/forms/form_data.h" -#include "webkit/forms/form_field.h" using WebKit::WebElement; using WebKit::WebFormControlElement; @@ -38,8 +38,6 @@ using WebKit::WebOptionElement; using WebKit::WebSelectElement; using WebKit::WebString; using WebKit::WebVector; -using webkit::forms::FormData; -using webkit::forms::FormField; namespace { @@ -416,7 +414,7 @@ void GetOptionStringsFromElement(const WebSelectElement& select_element, // The callback type used by |ForEachMatchingFormField()|. typedef void (*Callback)(WebKit::WebFormControlElement*, - const webkit::forms::FormField*, + const FormFieldData*, bool); // For each autofillable field in |data| that matches a field in the |form|, @@ -478,7 +476,7 @@ void ForEachMatchingFormField(const WebFormElement& form_element, // Sets the |field|'s value to the value in |data|. // Also sets the "autofilled" attribute, causing the background to be yellow. void FillFormField(WebKit::WebFormControlElement* field, - const webkit::forms::FormField* data, + const FormFieldData* data, bool is_initiating_node) { // Nothing to fill. if (data->value.empty()) @@ -508,7 +506,7 @@ void FillFormField(WebKit::WebFormControlElement* field, // Sets the |field|'s "suggested" (non JS visible) value to the value in |data|. // Also sets the "autofilled" attribute, causing the background to be yellow. void PreviewFormField(WebKit::WebFormControlElement* field, - const webkit::forms::FormField* data, + const FormFieldData* data, bool is_initiating_node) { // Nothing to preview. if (data->value.empty()) @@ -587,7 +585,7 @@ void ExtractAutofillableElements( void WebFormControlElementToFormField(const WebFormControlElement& element, ExtractMask extract_mask, - FormField* field) { + FormFieldData* field) { DCHECK(field); DCHECK(!element.isNull()); @@ -663,8 +661,8 @@ bool WebFormElementToFormData( const WebKit::WebFormControlElement& form_control_element, RequirementsMask requirements, ExtractMask extract_mask, - webkit::forms::FormData* form, - webkit::forms::FormField* field) { + FormData* form, + FormFieldData* field) { const WebFrame* frame = form_element.document().frame(); if (!frame) return false; @@ -683,12 +681,12 @@ bool WebFormElementToFormData( if (!form->action.is_valid()) form->action = GURL(form_element.action()); - // A map from a FormField's name to the FormField itself. - std::map<string16, FormField*> name_map; + // A map from a FormFieldData's name to the FormFieldData itself. + std::map<string16, FormFieldData*> name_map; // The extracted FormFields. We use pointers so we can store them in // |name_map|. - ScopedVector<FormField> form_fields; + ScopedVector<FormFieldData> form_fields; WebVector<WebFormControlElement> control_elements; form_element.getFormControlElements(control_elements); @@ -708,8 +706,8 @@ bool WebFormElementToFormData( !input_element->autoComplete()) continue; - // Create a new FormField, fill it out and map it to the field's name. - FormField* form_field = new FormField; + // Create a new FormFieldData, fill it out and map it to the field's name. + FormFieldData* form_field = new FormFieldData; WebFormControlElementToFormField(control_element, extract_mask, form_field); form_fields.push_back(form_field); // TODO(jhawkins): A label element is mapped to a form control element's id. @@ -726,8 +724,8 @@ bool WebFormElementToFormData( // Loop through the label elements inside the form element. For each label // element, get the corresponding form control element, use the form control - // element's name as a key into the <name, FormField> map to find the - // previously created FormField and set the FormField's label to the + // element's name as a key into the <name, FormFieldData> map to find the + // previously created FormFieldData and set the FormFieldData's label to the // label.firstChild().nodeValue() of the label element. WebNodeList labels = form_element.getElementsByTagName("label"); for (unsigned i = 0; i < labels.length(); ++i) { @@ -748,7 +746,8 @@ bool WebFormElementToFormData( element_name = field_element.nameForAutofill(); } - std::map<string16, FormField*>::iterator iter = name_map.find(element_name); + std::map<string16, FormFieldData*>::iterator iter = + name_map.find(element_name); if (iter != name_map.end()) { string16 label_text = FindChildText(label); @@ -782,7 +781,7 @@ bool WebFormElementToFormData( } // Copy the created FormFields into the resulting FormData object. - for (ScopedVector<FormField>::const_iterator iter = form_fields.begin(); + for (ScopedVector<FormFieldData>::const_iterator iter = form_fields.begin(); iter != form_fields.end(); ++iter) { form->fields.push_back(**iter); } @@ -792,7 +791,7 @@ bool WebFormElementToFormData( bool FindFormAndFieldForInputElement(const WebInputElement& element, FormData* form, - webkit::forms::FormField* field, + FormFieldData* field, RequirementsMask requirements) { if (!IsAutofillableElement(element)) return false; diff --git a/chrome/renderer/autofill/form_autofill_util.h b/chrome/renderer/autofill/form_autofill_util.h index 99253b8..b63424f 100644 --- a/chrome/renderer/autofill/form_autofill_util.h +++ b/chrome/renderer/autofill/form_autofill_util.h @@ -9,12 +9,8 @@ #include "base/string16.h" -namespace webkit { -namespace forms { struct FormData; -struct FormField; -} -} +struct FormFieldData; namespace WebKit { class WebFormElement; @@ -72,7 +68,7 @@ void ExtractAutofillableElements( void WebFormControlElementToFormField( const WebKit::WebFormControlElement& element, ExtractMask extract_mask, - webkit::forms::FormField* field); + FormFieldData* field); // Fills |form| with the FormData object corresponding to the |form_element|. // If |field| is non-NULL, also fills |field| with the FormField object @@ -86,25 +82,25 @@ bool WebFormElementToFormData( const WebKit::WebFormControlElement& form_control_element, RequirementsMask requirements, ExtractMask extract_mask, - webkit::forms::FormData* form, - webkit::forms::FormField* field); + FormData* form, + FormFieldData* field); // Finds the form that contains |element| and returns it in |form|. Fills // |field| with the |FormField| representation for element. // Returns false if the form is not found or cannot be serialized. bool FindFormAndFieldForInputElement(const WebKit::WebInputElement& element, - webkit::forms::FormData* form, - webkit::forms::FormField* field, + FormData* form, + FormFieldData* field, RequirementsMask requirements); // Fills the form represented by |form|. |element| is the input element that // initiated the auto-fill process. -void FillForm(const webkit::forms::FormData& form, +void FillForm(const FormData& form, const WebKit::WebInputElement& element); // Previews the form represented by |form|. |element| is the input element that // initiated the preview process. -void PreviewForm(const webkit::forms::FormData& form, +void PreviewForm(const FormData& form, const WebKit::WebInputElement& element); // Clears the placeholder values and the auto-filled background for any fields diff --git a/chrome/renderer/autofill/form_cache.cc b/chrome/renderer/autofill/form_cache.cc index c5ff6d6..f7bec03 100644 --- a/chrome/renderer/autofill/form_cache.cc +++ b/chrome/renderer/autofill/form_cache.cc @@ -6,6 +6,10 @@ #include "base/logging.h" #include "base/utf_string_conversions.h" +#include "chrome/common/form_data.h" +#include "chrome/common/form_data_predictions.h" +#include "chrome/common/form_field_data.h" +#include "chrome/common/form_field_data_predictions.h" #include "chrome/renderer/autofill/form_autofill_util.h" #include "grit/generated_resources.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" @@ -17,10 +21,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" #include "ui/base/l10n/l10n_util.h" -#include "webkit/forms/form_data.h" -#include "webkit/forms/form_data_predictions.h" -#include "webkit/forms/form_field.h" -#include "webkit/forms/form_field_predictions.h" using WebKit::WebDocument; using WebKit::WebFormControlElement; @@ -30,8 +30,6 @@ using WebKit::WebInputElement; using WebKit::WebSelectElement; using WebKit::WebString; using WebKit::WebVector; -using webkit::forms::FormData; -using webkit::forms::FormDataPredictions; namespace { diff --git a/chrome/renderer/autofill/form_cache.h b/chrome/renderer/autofill/form_cache.h index 7acdec5..43bd651 100644 --- a/chrome/renderer/autofill/form_cache.h +++ b/chrome/renderer/autofill/form_cache.h @@ -11,12 +11,8 @@ #include "base/string16.h" -namespace webkit { -namespace forms { struct FormData; struct FormDataPredictions; -} -} namespace WebKit { class WebDocument; @@ -36,7 +32,7 @@ class FormCache { // Scans the DOM in |frame| extracting and storing forms. // Returns a vector of the extracted forms. void ExtractForms(const WebKit::WebFrame& frame, - std::vector<webkit::forms::FormData>* forms); + std::vector<FormData>* forms); // Resets the forms for the specified |frame|. void ResetFrame(const WebKit::WebFrame& frame); @@ -49,7 +45,7 @@ class FormCache { // field's overall predicted type. Also sets the title to include the field's // heuristic type, server type, and signature; as well as the form's signature // and the experiment id for the server predictions. - bool ShowPredictions(const webkit::forms::FormDataPredictions& form); + bool ShowPredictions(const FormDataPredictions& form); private: // The cached web frames. diff --git a/chrome/renderer/autofill/password_autofill_manager.cc b/chrome/renderer/autofill/password_autofill_manager.cc index 2d86597..413411f 100644 --- a/chrome/renderer/autofill/password_autofill_manager.cc +++ b/chrome/renderer/autofill/password_autofill_manager.cc @@ -8,7 +8,11 @@ #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "chrome/common/autofill_messages.h" +#include "chrome/common/form_field_data.h" +#include "chrome/common/password_form_fill_data.h" #include "chrome/renderer/autofill/form_autofill_util.h" +#include "content/public/common/password_form.h" +#include "content/public/renderer/password_form_conversion_utils.h" #include "content/public/renderer/render_view.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" @@ -20,9 +24,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" #include "ui/base/keycodes/keyboard_codes.h" -#include "webkit/forms/form_field.h" -#include "webkit/forms/password_form.h" -#include "webkit/forms/password_form_dom_manager.h" namespace { @@ -48,7 +49,7 @@ typedef std::vector<FormElements*> FormElementsList; // Helper to search the given form element for the specified input elements // in |data|, and add results to |result|. static bool FindFormInputElements(WebKit::WebFormElement* fe, - const webkit::forms::FormData& data, + const FormData& data, FormElements* result) { // Loop through the list of elements we need to find on the form in order to // autofill it. If we don't find any one of them, abort processing this @@ -96,7 +97,7 @@ static bool FindFormInputElements(WebKit::WebFormElement* fe, // Helper to locate form elements identified by |data|. void FindFormElements(WebKit::WebView* view, - const webkit::forms::FormData& data, + const FormData& data, FormElementsList* results) { DCHECK(view); DCHECK(results); @@ -150,7 +151,7 @@ bool IsElementEditable(const WebKit::WebInputElement& element) { return element.isEnabled() && !element.isReadOnly(); } -void FillForm(FormElements* fe, const webkit::forms::FormData& data) { +void FillForm(FormElements* fe, const FormData& data) { if (!fe->form_element.autoComplete()) return; @@ -220,7 +221,7 @@ bool PasswordAutofillManager::TextFieldDidEndEditing( if (iter == login_to_password_info_.end()) return false; - const webkit::forms::PasswordFormFillData& fill_data = + const PasswordFormFillData& fill_data = iter->second.fill_data; // If wait_for_username is false, we should have filled when the text changed. @@ -343,7 +344,7 @@ void PasswordAutofillManager::SendPasswordForms(WebKit::WebFrame* frame, WebKit::WebVector<WebKit::WebFormElement> forms; frame->document().forms(forms); - std::vector<webkit::forms::PasswordForm> password_forms; + std::vector<content::PasswordForm> password_forms; for (size_t i = 0; i < forms.size(); ++i) { const WebKit::WebFormElement& form = forms[i]; @@ -356,8 +357,8 @@ void PasswordAutofillManager::SendPasswordForms(WebKit::WebFrame* frame, if (only_visible && !form.hasNonEmptyBoundingBox()) continue; - scoped_ptr<webkit::forms::PasswordForm> password_form( - webkit::forms::PasswordFormDomManager::CreatePasswordForm(form)); + scoped_ptr<content::PasswordForm> password_form( + content::CreatePasswordForm(form)); if (password_form.get()) password_forms.push_back(*password_form); } @@ -426,7 +427,7 @@ bool PasswordAutofillManager::InputElementLostFocus() { } void PasswordAutofillManager::OnFillPasswordForm( - const webkit::forms::PasswordFormFillData& form_data, + const PasswordFormFillData& form_data, bool disable_popup) { disable_popup_ = disable_popup; @@ -463,8 +464,8 @@ void PasswordAutofillManager::OnFillPasswordForm( password_info.password_field = password_element; login_to_password_info_[username_element] = password_info; - webkit::forms::FormData form; - webkit::forms::FormField field; + FormData form; + FormFieldData field; FindFormAndFieldForInputElement( username_element, &form, &field, REQUIRE_NONE); Send(new AutofillHostMsg_AddPasswordFormMapping( @@ -478,13 +479,13 @@ void PasswordAutofillManager::OnFillPasswordForm( // PasswordAutofillManager, private: void PasswordAutofillManager::GetSuggestions( - const webkit::forms::PasswordFormFillData& fill_data, + const PasswordFormFillData& fill_data, const string16& input, std::vector<string16>* suggestions) { if (StartsWith(fill_data.basic_data.fields[0].value, input, false)) suggestions->push_back(fill_data.basic_data.fields[0].value); - webkit::forms::PasswordFormFillData::LoginCollection::const_iterator iter; + PasswordFormFillData::LoginCollection::const_iterator iter; for (iter = fill_data.additional_logins.begin(); iter != fill_data.additional_logins.end(); ++iter) { if (StartsWith(iter->first, input, false)) @@ -493,7 +494,7 @@ void PasswordAutofillManager::GetSuggestions( } bool PasswordAutofillManager::ShowSuggestionPopup( - const webkit::forms::PasswordFormFillData& fill_data, + const PasswordFormFillData& fill_data, const WebKit::WebInputElement& user_input) { WebKit::WebFrame* frame = user_input.document().frame(); if (!frame) @@ -507,8 +508,8 @@ bool PasswordAutofillManager::ShowSuggestionPopup( GetSuggestions(fill_data, user_input.value(), &suggestions); if (disable_popup_) { - webkit::forms::FormData form; - webkit::forms::FormField field; + FormData form; + FormFieldData field; FindFormAndFieldForInputElement( user_input, &form, &field, REQUIRE_NONE); @@ -539,7 +540,7 @@ bool PasswordAutofillManager::ShowSuggestionPopup( bool PasswordAutofillManager::FillUserNameAndPassword( WebKit::WebInputElement* username_element, WebKit::WebInputElement* password_element, - const webkit::forms::PasswordFormFillData& fill_data, + const PasswordFormFillData& fill_data, bool exact_username_match, bool set_selection) { string16 current_username = username_element->value(); @@ -554,7 +555,7 @@ bool PasswordAutofillManager::FillUserNameAndPassword( password = fill_data.basic_data.fields[1].value; } else { // Scan additional logins for a match. - webkit::forms::PasswordFormFillData::LoginCollection::const_iterator iter; + PasswordFormFillData::LoginCollection::const_iterator iter; for (iter = fill_data.additional_logins.begin(); iter != fill_data.additional_logins.end(); ++iter) { if (DoUsernamesMatch(iter->first, current_username, @@ -586,7 +587,7 @@ bool PasswordAutofillManager::FillUserNameAndPassword( void PasswordAutofillManager::PerformInlineAutocomplete( const WebKit::WebInputElement& username_input, const WebKit::WebInputElement& password_input, - const webkit::forms::PasswordFormFillData& fill_data) { + const PasswordFormFillData& fill_data) { DCHECK(!fill_data.wait_for_username); // We need non-const versions of the username and password inputs. diff --git a/chrome/renderer/autofill/password_autofill_manager.h b/chrome/renderer/autofill/password_autofill_manager.h index 6d35416..8b407f3 100644 --- a/chrome/renderer/autofill/password_autofill_manager.h +++ b/chrome/renderer/autofill/password_autofill_manager.h @@ -9,10 +9,10 @@ #include <vector> #include "base/memory/weak_ptr.h" +#include "chrome/common/password_form_fill_data.h" #include "chrome/renderer/page_click_listener.h" #include "content/public/renderer/render_view_observer.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" -#include "webkit/forms/password_form_dom_manager.h" namespace WebKit { class WebInputElement; @@ -54,7 +54,7 @@ class PasswordAutofillManager : public content::RenderViewObserver, struct PasswordInfo { WebKit::WebInputElement password_field; - webkit::forms::PasswordFormFillData fill_data; + PasswordFormFillData fill_data; bool backspace_pressed_last; PasswordInfo() : backspace_pressed_last(false) {} }; @@ -74,24 +74,24 @@ class PasswordAutofillManager : public content::RenderViewObserver, virtual bool InputElementLostFocus() OVERRIDE; // RenderView IPC handlers: - void OnFillPasswordForm(const webkit::forms::PasswordFormFillData& form_data, + void OnFillPasswordForm(const PasswordFormFillData& form_data, bool disable_popup); // Scans the given frame for password forms and sends them up to the browser. // If |only_visible| is true, only forms visible in the layout are sent. void SendPasswordForms(WebKit::WebFrame* frame, bool only_visible); - void GetSuggestions(const webkit::forms::PasswordFormFillData& fill_data, + void GetSuggestions(const PasswordFormFillData& fill_data, const string16& input, std::vector<string16>* suggestions); - bool ShowSuggestionPopup(const webkit::forms::PasswordFormFillData& fill_data, + bool ShowSuggestionPopup(const PasswordFormFillData& fill_data, const WebKit::WebInputElement& user_input); bool FillUserNameAndPassword( WebKit::WebInputElement* username_element, WebKit::WebInputElement* password_element, - const webkit::forms::PasswordFormFillData& fill_data, + const PasswordFormFillData& fill_data, bool exact_username_match, bool set_selection); @@ -100,7 +100,7 @@ class PasswordAutofillManager : public content::RenderViewObserver, void PerformInlineAutocomplete( const WebKit::WebInputElement& username, const WebKit::WebInputElement& password, - const webkit::forms::PasswordFormFillData& fill_data); + const PasswordFormFillData& fill_data); // Invoked when the passed frame is closing. Gives us a chance to clear any // reference we may have to elements in that frame. diff --git a/chrome/renderer/autofill/password_autofill_manager_browsertest.cc b/chrome/renderer/autofill/password_autofill_manager_browsertest.cc index d242e6d..529cdd8 100644 --- a/chrome/renderer/autofill/password_autofill_manager_browsertest.cc +++ b/chrome/renderer/autofill/password_autofill_manager_browsertest.cc @@ -5,6 +5,8 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/common/autofill_messages.h" +#include "chrome/common/form_data.h" +#include "chrome/common/form_field_data.h" #include "chrome/renderer/autofill/autofill_agent.h" #include "chrome/renderer/autofill/password_autofill_manager.h" #include "chrome/test/base/chrome_render_view_test.h" @@ -17,13 +19,8 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" #include "ui/base/keycodes/keyboard_codes.h" -#include "webkit/forms/form_data.h" -#include "webkit/forms/form_field.h" -using webkit::forms::FormField; -using webkit::forms::PasswordFormFillData; -using webkit::forms::PasswordForm; -using webkit::forms::PasswordFormDomManager; +using content::PasswordForm; using WebKit::WebDocument; using WebKit::WebElement; using WebKit::WebFrame; @@ -80,12 +77,12 @@ class PasswordAutofillManagerTest : public ChromeRenderViewTest { username3_ = ASCIIToUTF16(kCarolUsername); password3_ = ASCIIToUTF16(kCarolPassword); - FormField username_field; + FormFieldData username_field; username_field.name = ASCIIToUTF16(kUsernameName); username_field.value = username1_; fill_data_.basic_data.fields.push_back(username_field); - FormField password_field; + FormFieldData password_field; password_field.name = ASCIIToUTF16(kPasswordName); password_field.value = password1_; fill_data_.basic_data.fields.push_back(password_field); diff --git a/chrome/renderer/autofill/password_generation_manager.cc b/chrome/renderer/autofill/password_generation_manager.cc index 2ac682e..ac6202e 100644 --- a/chrome/renderer/autofill/password_generation_manager.cc +++ b/chrome/renderer/autofill/password_generation_manager.cc @@ -7,6 +7,7 @@ #include "base/logging.h" #include "chrome/common/autofill_messages.h" #include "chrome/common/password_generation_util.h" +#include "content/public/renderer/password_form_conversion_utils.h" #include "content/public/renderer/render_view.h" #include "google_apis/gaia/gaia_urls.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h" @@ -110,8 +111,8 @@ void PasswordGenerationManager::DidFinishLoad(WebKit::WebFrame* frame) { // If we can't get a valid PasswordForm, we skip this form because the // the password won't get saved even if we generate it. - scoped_ptr<webkit::forms::PasswordForm> password_form( - webkit::forms::PasswordFormDomManager::CreatePasswordForm(forms[i])); + scoped_ptr<content::PasswordForm> password_form( + content::CreatePasswordForm(forms[i])); if (!password_form.get()) { DVLOG(2) << "Skipping form as it would not be saved"; continue; @@ -175,9 +176,8 @@ WebKit::WebCString PasswordGenerationManager::imageNameForReadOnlyState() { void PasswordGenerationManager::handleClick(WebKit::WebInputElement& element) { gfx::Rect rect(element.decorationElementFor(this).boundsInViewportSpace()); - scoped_ptr<webkit::forms::PasswordForm> password_form( - webkit::forms::PasswordFormDomManager::CreatePasswordForm( - element.form())); + scoped_ptr<content::PasswordForm> password_form( + content::CreatePasswordForm(element.form())); // We should not have shown the icon we can't create a valid PasswordForm. DCHECK(password_form.get()); @@ -209,7 +209,7 @@ bool PasswordGenerationManager::OnMessageReceived(const IPC::Message& message) { } void PasswordGenerationManager::OnFormNotBlacklisted( - const webkit::forms::PasswordForm& form) { + const content::PasswordForm& form) { not_blacklisted_password_form_origins_.push_back(form.origin); MaybeShowIcon(); } diff --git a/chrome/renderer/autofill/password_generation_manager.h b/chrome/renderer/autofill/password_generation_manager.h index 0e72a71..cd930d9 100644 --- a/chrome/renderer/autofill/password_generation_manager.h +++ b/chrome/renderer/autofill/password_generation_manager.h @@ -19,11 +19,9 @@ class WebCString; class WebDocument; } -namespace webkit { -namespace forms { +namespace content { struct PasswordForm; -} // namespace forms -} // namespace webkit +} namespace autofill { @@ -60,7 +58,7 @@ class PasswordGenerationManager : public content::RenderViewObserver, virtual void willDetach(const WebKit::WebInputElement& element) OVERRIDE; // Message handlers. - void OnFormNotBlacklisted(const webkit::forms::PasswordForm& form); + void OnFormNotBlacklisted(const content::PasswordForm& form); void OnPasswordAccepted(const string16& password); void OnPasswordGenerationEnabled(bool enabled); diff --git a/chrome/renderer/autofill/password_generation_manager_browsertest.cc b/chrome/renderer/autofill/password_generation_manager_browsertest.cc index 6b434e8..2dddb9c 100644 --- a/chrome/renderer/autofill/password_generation_manager_browsertest.cc +++ b/chrome/renderer/autofill/password_generation_manager_browsertest.cc @@ -80,7 +80,7 @@ class PasswordGenerationManagerTest : public ChromeRenderViewTest { } void SetNotBlacklistedMessage(const char* form_str) { - webkit::forms::PasswordForm form; + content::PasswordForm form; form.origin = GURL(StringPrintf("data:text/html;charset=utf-8,%s",form_str)); AutofillMsg_FormNotBlacklisted msg(0, form); diff --git a/content/browser/renderer_host/test_render_view_host.cc b/content/browser/renderer_host/test_render_view_host.cc index af106f2..1f56095 100644 --- a/content/browser/renderer_host/test_render_view_host.cc +++ b/content/browser/renderer_host/test_render_view_host.cc @@ -14,15 +14,12 @@ #include "content/public/browser/navigation_controller.h" #include "content/public/browser/storage_partition.h" #include "content/public/common/content_client.h" +#include "content/public/common/password_form.h" #include "ui/gfx/rect.h" #include "webkit/dom_storage/dom_storage_types.h" -#include "webkit/forms/password_form.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/webpreferences.h" -using content::NativeWebKeyboardEvent; -using webkit::forms::PasswordForm; - namespace content { namespace { diff --git a/content/browser/web_contents/test_web_contents.cc b/content/browser/web_contents/test_web_contents.cc index 100c518..3a7e41a 100644 --- a/content/browser/web_contents/test_web_contents.cc +++ b/content/browser/web_contents/test_web_contents.cc @@ -16,8 +16,8 @@ #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" #include "content/public/common/page_transition_types.h" +#include "content/public/common/password_form.h" #include "content/public/test/mock_render_process_host.h" -#include "webkit/forms/password_form.h" #include "webkit/glue/webkit_glue.h" namespace content { @@ -77,7 +77,7 @@ void TestWebContents::TestDidNavigateWithReferrer( params.should_update_history = false; params.searchable_form_url = GURL(); params.searchable_form_encoding = std::string(); - params.password_form = webkit::forms::PasswordForm(); + params.password_form = content::PasswordForm(); params.security_info = std::string(); params.gesture = NavigationGestureUser; params.was_within_same_page = false; diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc index ff80b14..8de109b 100644 --- a/content/browser/web_contents/web_contents_impl_unittest.cc +++ b/content/browser/web_contents/web_contents_impl_unittest.cc @@ -36,6 +36,7 @@ using content::InterstitialPage; using content::MockRenderProcessHost; using content::NavigationEntry; using content::NavigationEntryImpl; +using content::PasswordForm; using content::SiteInstance; using content::RenderViewHost; using content::RenderViewHostImplTestHarness; @@ -45,7 +46,6 @@ using content::TestWebContents; using content::WebContents; using content::WebUI; using content::WebUIController; -using webkit::forms::PasswordForm; namespace { diff --git a/content/content_common.gypi b/content/content_common.gypi index c246a2e..feaa39e 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -62,6 +62,8 @@ 'public/common/page_transition_types.h', 'public/common/page_type.h', 'public/common/page_zoom.h', + 'public/common/password_form.cc', + 'public/common/password_form.h', 'public/common/pepper_plugin_info.cc', 'public/common/pepper_plugin_info.h', 'public/common/process_type.h', @@ -412,7 +414,6 @@ '../webkit/support/webkit_support.gyp:blob', '../webkit/support/webkit_support.gyp:database', '../webkit/support/webkit_support.gyp:fileapi', - '../webkit/support/webkit_support.gyp:forms', '../webkit/support/webkit_support.gyp:webkit_base', ], }], diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi index 6e09766..139b125 100644 --- a/content/content_renderer.gypi +++ b/content/content_renderer.gypi @@ -19,7 +19,6 @@ '<(webkit_src_dir)/Source/WebKit/chromium/WebKit.gyp:webkit', '../ui/surface/surface.gyp:surface', '../v8/tools/gyp/v8.gyp:v8', - '../webkit/support/webkit_support.gyp:forms', '../webkit/support/webkit_support.gyp:glue', '../webkit/support/webkit_support.gyp:webkit_media', '../webkit/support/webkit_support.gyp:webkit_gpu', @@ -34,6 +33,7 @@ 'public/renderer/document_state.h', 'public/renderer/navigation_state.cc', 'public/renderer/navigation_state.h', + 'public/renderer/password_form_conversion_utils.h', 'public/renderer/render_process_observer.cc', 'public/renderer/render_process_observer.h', 'public/renderer/render_thread.cc', @@ -158,6 +158,7 @@ 'renderer/notification_provider.h', 'renderer/paint_aggregator.cc', 'renderer/paint_aggregator.h', + 'renderer/password_form_conversion_utils.cc', 'renderer/pepper/content_renderer_pepper_host_factory.cc', 'renderer/pepper/content_renderer_pepper_host_factory.h', 'renderer/pepper/pepper_broker_impl.cc', diff --git a/content/content_tests.gypi b/content/content_tests.gypi index ca5da85..c7a903c 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -489,7 +489,6 @@ '../webkit/support/webkit_support.gyp:database', '../webkit/support/webkit_support.gyp:dom_storage', '../webkit/support/webkit_support.gyp:fileapi', - '../webkit/support/webkit_support.gyp:forms', '../webkit/support/webkit_support.gyp:glue', '../webkit/support/webkit_support.gyp:quota', '../webkit/support/webkit_support.gyp:webkit_base', @@ -601,6 +600,7 @@ 'type': 'executable', 'defines!': ['CONTENT_IMPLEMENTATION'], 'dependencies': [ + 'content_common', 'content_gpu', 'content_plugin', 'content_renderer', @@ -621,7 +621,6 @@ '../third_party/mesa/mesa.gyp:osmesa', '../ui/ui.gyp:ui', '../webkit/support/webkit_support.gyp:clearkeycdmplugin', - '../webkit/support/webkit_support.gyp:forms', '../webkit/support/webkit_support.gyp:glue', ], 'include_dirs': [ diff --git a/content/public/common/common_param_traits_macros.h b/content/public/common/common_param_traits_macros.h index 1e4fb1b..2fec59f6 100644 --- a/content/public/common/common_param_traits_macros.h +++ b/content/public/common/common_param_traits_macros.h @@ -9,12 +9,12 @@ #define CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ #include "content/public/common/console_message_level.h" +#include "content/public/common/password_form.h" #include "content/public/common/security_style.h" #include "ipc/ipc_message_macros.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebPoint.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebReferrerPolicy.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" -#include "webkit/forms/password_form.h" #include "webkit/glue/window_open_disposition.h" #include "webkit/plugins/webplugininfo.h" @@ -38,7 +38,7 @@ IPC_STRUCT_TRAITS_BEGIN(WebKit::WebRect) IPC_STRUCT_TRAITS_MEMBER(height) IPC_STRUCT_TRAITS_END() -IPC_STRUCT_TRAITS_BEGIN(webkit::forms::PasswordForm) +IPC_STRUCT_TRAITS_BEGIN(content::PasswordForm) IPC_STRUCT_TRAITS_MEMBER(signon_realm) IPC_STRUCT_TRAITS_MEMBER(origin) IPC_STRUCT_TRAITS_MEMBER(action) diff --git a/content/public/common/frame_navigate_params.h b/content/public/common/frame_navigate_params.h index 82d6c2a..f3f686c 100644 --- a/content/public/common/frame_navigate_params.h +++ b/content/public/common/frame_navigate_params.h @@ -10,10 +10,10 @@ #include "content/common/content_export.h" #include "content/public/common/page_transition_types.h" +#include "content/public/common/password_form.h" #include "content/public/common/referrer.h" #include "googleurl/src/gurl.h" #include "net/base/host_port_pair.h" -#include "webkit/forms/password_form.h" namespace content { @@ -60,7 +60,7 @@ struct CONTENT_EXPORT FrameNavigateParams { std::string searchable_form_encoding; // See password_form.h. - webkit::forms::PasswordForm password_form; + content::PasswordForm password_form; // Contents MIME type of main frame. std::string contents_mime_type; diff --git a/content/public/common/password_form.cc b/content/public/common/password_form.cc new file mode 100644 index 0000000..f220828 --- /dev/null +++ b/content/public/common/password_form.cc @@ -0,0 +1,20 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/public/common/password_form.h" + +namespace content { + +PasswordForm::PasswordForm() + : scheme(SCHEME_HTML), + ssl_valid(false), + preferred(false), + blacklisted_by_user(false), + type(TYPE_MANUAL) { +} + +PasswordForm::~PasswordForm() { +} + +} // namespace content diff --git a/webkit/forms/password_form.h b/content/public/common/password_form.h index 045792e..2b0eb0e 100644 --- a/webkit/forms/password_form.h +++ b/content/public/common/password_form.h @@ -2,19 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_FORMS_PASSWORD_FORM_H__ -#define WEBKIT_FORMS_PASSWORD_FORM_H__ +#ifndef CONTENT_PUBLIC_COMMON_PASSWORD_FORM_H__ +#define CONTENT_PUBLIC_COMMON_PASSWORD_FORM_H__ #include <map> #include <string> #include "base/time.h" +#include "content/common/content_export.h" #include "googleurl/src/gurl.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebPasswordFormData.h" -#include "webkit/forms/webkit_forms_export.h" -namespace webkit { -namespace forms { +namespace content { // The PasswordForm struct encapsulates information about a login form, // which can be an HTML form or a dialog with username/password text fields. @@ -38,7 +36,7 @@ namespace forms { // describe which fields are not strictly required when adding a saved password // entry to the database and how they can affect the matching process. -struct WEBKIT_FORMS_EXPORT PasswordForm { +struct CONTENT_EXPORT PasswordForm { // Enum to differentiate between HTML form based authentication, and dialogs // using basic or digest schemes. Default is SCHEME_HTML. Only PasswordForms // of the same Scheme will be matched/autofilled against each other. @@ -148,14 +146,12 @@ struct WEBKIT_FORMS_EXPORT PasswordForm { Type type; PasswordForm(); - PasswordForm(const WebKit::WebPasswordFormData& web_password_form); ~PasswordForm(); }; // Map username to PasswordForm* for convenience. See password_form_manager.h. typedef std::map<string16, PasswordForm*> PasswordFormMap; -} // namespace forms -} // namespace webkit +} // namespace content -#endif // WEBKIT_FORMS_PASSWORD_FORM_H__ +#endif // CONTENT_PUBLIC_COMMON_PASSWORD_FORM_H__ diff --git a/content/public/renderer/document_state.cc b/content/public/renderer/document_state.cc index af7bc05..2aa9ffb 100644 --- a/content/public/renderer/document_state.cc +++ b/content/public/renderer/document_state.cc @@ -4,8 +4,8 @@ #include "content/public/renderer/document_state.h" +#include "content/public/common/password_form.h" #include "content/public/renderer/navigation_state.h" -#include "webkit/forms/password_form.h" #include "webkit/glue/alt_error_page_resource_fetcher.h" namespace content { @@ -33,7 +33,7 @@ DocumentState::DocumentState() DocumentState::~DocumentState() {} void DocumentState::set_password_form_data( - scoped_ptr<webkit::forms::PasswordForm> data) { + scoped_ptr<PasswordForm> data) { password_form_data_.reset(data.release()); } diff --git a/content/public/renderer/document_state.h b/content/public/renderer/document_state.h index b9adb22..d9dbb89 100644 --- a/content/public/renderer/document_state.h +++ b/content/public/renderer/document_state.h @@ -14,12 +14,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRequest.h" -namespace webkit { -namespace forms { -struct PasswordForm; -} -} - namespace webkit_glue { class AltErrorPageResourceFetcher; } @@ -27,6 +21,7 @@ class AltErrorPageResourceFetcher; namespace content { class NavigationState; +struct PasswordForm; // The RenderView stores an instance of this class in the "extra data" of each // WebDataSource (see RenderView::DidCreateDataSource). @@ -174,10 +169,10 @@ class DocumentState : public WebKit::WebDataSource::ExtraData { searchable_form_encoding_ = encoding; } - webkit::forms::PasswordForm* password_form_data() const { + PasswordForm* password_form_data() const { return password_form_data_.get(); } - void set_password_form_data(scoped_ptr<webkit::forms::PasswordForm> data); + void set_password_form_data(scoped_ptr<PasswordForm> data); const std::string& security_info() const { return security_info_; } void set_security_info(const std::string& security_info) { @@ -282,7 +277,7 @@ class DocumentState : public WebKit::WebDataSource::ExtraData { GURL searchable_form_url_; std::string searchable_form_encoding_; - scoped_ptr<webkit::forms::PasswordForm> password_form_data_; + scoped_ptr<PasswordForm> password_form_data_; std::string security_info_; bool use_error_page_; diff --git a/content/public/renderer/password_form_conversion_utils.h b/content/public/renderer/password_form_conversion_utils.h new file mode 100644 index 0000000..986963c --- /dev/null +++ b/content/public/renderer/password_form_conversion_utils.h @@ -0,0 +1,28 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_PUBLIC_RENDERER_PASSWORD_FORM_CONVERSION_UTILS_H_ +#define CONTENT_PUBLIC_RENDERER_PASSWORD_FORM_CONVERSION_UTILS_H_ + +#include "base/memory/scoped_ptr.h" +#include "content/common/content_export.h" + +namespace WebKit { +class WebFormElement; +} + +namespace content { + +struct PasswordForm; + +// Create a PasswordForm from DOM form. Webkit doesn't allow storing +// custom metadata to DOM nodes, so we have to do this every time an event +// happens with a given form and compare against previously Create'd forms +// to identify..which sucks. +CONTENT_EXPORT scoped_ptr<PasswordForm> CreatePasswordForm( + const WebKit::WebFormElement& form); + +} // namespace content + +#endif // CONTENT_PUBLIC_RENDERER_PASSWORD_FORM_CONVERSION_UTILS_H__ diff --git a/content/renderer/password_form_conversion_utils.cc b/content/renderer/password_form_conversion_utils.cc new file mode 100644 index 0000000..27687bf --- /dev/null +++ b/content/renderer/password_form_conversion_utils.cc @@ -0,0 +1,47 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/public/renderer/password_form_conversion_utils.h" + +#include "content/public/common/password_form.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebPasswordFormData.h" + +using WebKit::WebFormElement; +using WebKit::WebPasswordFormData; + +namespace { + +scoped_ptr<content::PasswordForm> InitPasswordFormFromWebPasswordForm( + const WebKit::WebPasswordFormData& web_password_form) { + content::PasswordForm* password_form = new content::PasswordForm(); + password_form->signon_realm = web_password_form.signonRealm.utf8(); + password_form->origin = web_password_form.origin; + password_form->action = web_password_form.action; + password_form->submit_element = web_password_form.submitElement; + password_form->username_element = web_password_form.userNameElement; + password_form->username_value = web_password_form.userNameValue; + password_form->password_element = web_password_form.passwordElement; + password_form->password_value = web_password_form.passwordValue; + password_form->old_password_element = web_password_form.oldPasswordElement; + password_form->old_password_value = web_password_form.oldPasswordValue; + password_form->scheme = content::PasswordForm::SCHEME_HTML; + password_form->ssl_valid = false; + password_form->preferred = false; + password_form->blacklisted_by_user = false; + password_form->type = content::PasswordForm::TYPE_MANUAL; + return scoped_ptr<content::PasswordForm>(password_form); +} + +} // namespace + +namespace content { + +scoped_ptr<PasswordForm> CreatePasswordForm(const WebFormElement& webform) { + WebPasswordFormData web_password_form(webform); + if (web_password_form.isValid()) + return InitPasswordFormFromWebPasswordForm(web_password_form); + return scoped_ptr<PasswordForm>(new PasswordForm()); +} + +} // namespace content diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 014a693..70c4543 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -57,6 +57,7 @@ #include "content/public/renderer/content_renderer_client.h" #include "content/public/renderer/document_state.h" #include "content/public/renderer/navigation_state.h" +#include "content/public/renderer/password_form_conversion_utils.h" #include "content/public/renderer/render_view_observer.h" #include "content/public/renderer/render_view_visitor.h" #include "content/renderer/browser_plugin/browser_plugin.h" @@ -182,9 +183,6 @@ #include "v8/include/v8.h" #include "webkit/appcache/web_application_cache_host_impl.h" #include "webkit/dom_storage/dom_storage_types.h" -#include "webkit/forms/form_data.h" -#include "webkit/forms/form_field.h" -#include "webkit/forms/password_form_dom_manager.h" #include "webkit/glue/alt_error_page_resource_fetcher.h" #include "webkit/glue/dom_operations.h" #include "webkit/glue/glue_serialize.h" @@ -322,6 +320,7 @@ using base::Time; using base::TimeDelta; using content::DocumentState; using content::NavigationState; +using content::PasswordForm; using content::Referrer; using content::RenderThread; using content::RenderViewObserver; @@ -329,9 +328,6 @@ using content::RenderViewVisitor; using content::RendererAccessibilityComplete; using content::RendererAccessibilityFocusOnly; using content::V8ValueConverter; -using webkit::forms::FormField; -using webkit::forms::PasswordForm; -using webkit::forms::PasswordFormDomManager; using webkit_glue::AltErrorPageResourceFetcher; using webkit_glue::ResourceFetcher; using webkit_glue::WebPreferences; @@ -2941,8 +2937,7 @@ void RenderViewImpl::willSendSubmitEvent(WebKit::WebFrame* frame, // a copy of the password in case it gets lost. DocumentState* document_state = DocumentState::FromDataSource(frame->dataSource()); - document_state->set_password_form_data( - PasswordFormDomManager::CreatePasswordForm(form)); + document_state->set_password_form_data(content::CreatePasswordForm(form)); } void RenderViewImpl::willSubmitForm(WebFrame* frame, @@ -2960,7 +2955,7 @@ void RenderViewImpl::willSubmitForm(WebFrame* frame, document_state->set_searchable_form_encoding( web_searchable_form_data.encoding().utf8()); scoped_ptr<PasswordForm> password_form_data = - PasswordFormDomManager::CreatePasswordForm(form); + content::CreatePasswordForm(form); // In order to save the password that the user actually typed and not one // that may have gotten transformed by the site prior to submit, recover it diff --git a/webkit/forms/OWNERS b/webkit/forms/OWNERS deleted file mode 100644 index 27f4c6e..0000000 --- a/webkit/forms/OWNERS +++ /dev/null @@ -1,2 +0,0 @@ -dhollowa@chromium.org -isherman@chromium.org diff --git a/webkit/forms/form_field_predictions.h b/webkit/forms/form_field_predictions.h deleted file mode 100644 index 95f2d82..0000000 --- a/webkit/forms/form_field_predictions.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WEBKIT_FORMS_FORM_FIELD_PREDICTIONS_H_ -#define WEBKIT_FORMS_FORM_FIELD_PREDICTIONS_H_ - -#include <string> -#include <vector> - -#include "webkit/forms/form_field.h" -#include "webkit/forms/webkit_forms_export.h" - -namespace webkit { -namespace forms { - -// Stores information about a field in a form. -struct WEBKIT_FORMS_EXPORT FormFieldPredictions { - FormFieldPredictions(); - FormFieldPredictions(const FormFieldPredictions& other); - ~FormFieldPredictions(); - - FormField field; - std::string signature; - std::string heuristic_type; - std::string server_type; - std::string overall_type; -}; - -} // namespace forms -} // namespace webkit - -#endif // WEBKIT_FORMS_FORM_FIELD_PREDICTIONS_H_ diff --git a/webkit/forms/password_form.cc b/webkit/forms/password_form.cc deleted file mode 100644 index 8e91500..0000000 --- a/webkit/forms/password_form.cc +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "webkit/forms/password_form.h" - -namespace webkit { -namespace forms { - -PasswordForm::PasswordForm() - : scheme(SCHEME_HTML), - ssl_valid(false), - preferred(false), - blacklisted_by_user(false), - type(TYPE_MANUAL) { -} - -PasswordForm::PasswordForm(const WebKit::WebPasswordFormData& web_password_form) - : scheme(SCHEME_HTML), - signon_realm(web_password_form.signonRealm.utf8()), - origin(web_password_form.origin), - action(web_password_form.action), - submit_element(web_password_form.submitElement), - username_element(web_password_form.userNameElement), - username_value(web_password_form.userNameValue), - password_element(web_password_form.passwordElement), - password_value(web_password_form.passwordValue), - old_password_element(web_password_form.oldPasswordElement), - old_password_value(web_password_form.oldPasswordValue), - ssl_valid(false), - preferred(false), - blacklisted_by_user(false), - type(TYPE_MANUAL) { -} - -PasswordForm::~PasswordForm() { -} - -} // namespace forms -} // namespace webkit diff --git a/webkit/forms/password_form_dom_manager.h b/webkit/forms/password_form_dom_manager.h deleted file mode 100644 index 30abb74..0000000 --- a/webkit/forms/password_form_dom_manager.h +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WEBKIT_FORMS_PASSWORD_FORM_DOM_MANAGER_H_ -#define WEBKIT_FORMS_PASSWORD_FORM_DOM_MANAGER_H_ - -#include <map> - -#include "base/memory/scoped_ptr.h" -#include "webkit/forms/form_data.h" -#include "webkit/forms/password_form.h" -#include "webkit/forms/webkit_forms_export.h" - -namespace WebKit { -class WebForm; -} - -namespace webkit { -namespace forms { - -// Structure used for autofilling password forms. -// basic_data identifies the HTML form on the page and preferred username/ -// password for login, while -// additional_logins is a list of other matching user/pass pairs for the form. -// wait_for_username tells us whether we need to wait for the user to enter -// a valid username before we autofill the password. By default, this is off -// unless the PasswordManager determined there is an additional risk -// associated with this form. This can happen, for example, if action URI's -// of the observed form and our saved representation don't match up. -struct WEBKIT_FORMS_EXPORT PasswordFormFillData { - typedef std::map<string16, string16> LoginCollection; - - FormData basic_data; - LoginCollection additional_logins; - bool wait_for_username; - PasswordFormFillData(); - ~PasswordFormFillData(); -}; - -class PasswordFormDomManager { - public: - // Create a PasswordForm from DOM form. Webkit doesn't allow storing - // custom metadata to DOM nodes, so we have to do this every time an event - // happens with a given form and compare against previously Create'd forms - // to identify..which sucks. - WEBKIT_FORMS_EXPORT static scoped_ptr<PasswordForm> CreatePasswordForm( - const WebKit::WebFormElement& form); - - // Create a FillData structure in preparation for autofilling a form, - // from basic_data identifying which form to fill, and a collection of - // matching stored logins to use as username/password values. - // preferred_match should equal (address) one of matches. - // wait_for_username_before_autofill is true if we should not autofill - // anything until the user typed in a valid username and blurred the field. - WEBKIT_FORMS_EXPORT static void InitFillData(const PasswordForm& form_on_page, - const PasswordFormMap& matches, - const PasswordForm* const preferred_match, - bool wait_for_username_before_autofill, - PasswordFormFillData* result); - private: - DISALLOW_IMPLICIT_CONSTRUCTORS(PasswordFormDomManager); -}; - -} // namespace forms -} // namespace webkit - -#endif // WEBKIT_FORMS_PASSWORD_FORM_DOM_MANAGER_H__ diff --git a/webkit/forms/webkit_forms.gypi b/webkit/forms/webkit_forms.gypi deleted file mode 100644 index 7d97b28..0000000 --- a/webkit/forms/webkit_forms.gypi +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (c) 2012 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -{ - 'targets': [ - { - 'target_name': 'forms', - 'type': '<(component)', - 'variables': { 'enable_wexit_time_destructors': 1, }, - 'defines': ['WEBKIT_FORMS_IMPLEMENTATION'], - 'dependencies': [ - '<(DEPTH)/base/base.gyp:base', - '<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', - '<(DEPTH)/build/temp_gyp/googleurl.gyp:googleurl', - '<(webkit_src_dir)/Source/WebKit/chromium/WebKit.gyp:webkit', - ], - 'sources': [ - 'form_data.cc', - 'form_data.h', - 'form_data_predictions.cc', - 'form_data_predictions.h', - 'form_field.cc', - 'form_field.h', - 'form_field_predictions.cc', - 'form_field_predictions.h', - 'password_form.cc', - 'password_form.h', - 'password_form_dom_manager.cc', - 'password_form_dom_manager.h', - 'webkit_forms_export.h', - ], - 'conditions': [ - ['inside_chromium_build==0', { - 'dependencies': [ - '<(DEPTH)/webkit/support/setup_third_party.gyp:third_party_headers', - ], - }], - ], - }, - ], -} diff --git a/webkit/forms/webkit_forms_export.h b/webkit/forms/webkit_forms_export.h deleted file mode 100644 index 99c5d7e..0000000 --- a/webkit/forms/webkit_forms_export.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WEBKIT_FORMS_WEBKIT_FORMS_EXPORT_H_ -#define WEBKIT_FORMS_WEBKIT_FORMS_EXPORT_H_ - -#if defined(COMPONENT_BUILD) -#if defined(WIN32) - -#if defined(WEBKIT_FORMS_IMPLEMENTATION) -#define WEBKIT_FORMS_EXPORT __declspec(dllexport) -#else -#define WEBKIT_FORMS_EXPORT __declspec(dllimport) -#endif // defined(WEBKIT_FORMS_IMPLEMENTATION) - -#else // defined(WIN32) -#if defined(WEBKIT_FORMS_IMPLEMENTATION) -#define WEBKIT_FORMS_EXPORT __attribute__((visibility("default"))) -#else -#define WEBKIT_FORMS_EXPORT -#endif -#endif - -#else // defined(COMPONENT_BUILD) -#define WEBKIT_FORMS_EXPORT -#endif - -#endif // WEBKIT_FORMS_WEBKIT_FORMS_EXPORT_H_ diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index b4d7bff..0adca67 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -98,7 +98,6 @@ '<(webkit_src_dir)/Source/WebKit/chromium/WebKit.gyp:webkit', 'blob', 'fileapi', - 'forms', 'user_agent', 'webkit_base', 'webkit_media', diff --git a/webkit/support/webkit_support.gyp b/webkit/support/webkit_support.gyp index 2a3bb49..15fe854 100644 --- a/webkit/support/webkit_support.gyp +++ b/webkit/support/webkit_support.gyp @@ -19,7 +19,6 @@ '../database/webkit_database.gypi', '../dom_storage/webkit_dom_storage.gypi', '../fileapi/webkit_fileapi.gypi', - '../forms/webkit_forms.gypi', '../glue/webkit_glue.gypi', '../gpu/webkit_gpu.gypi', '../media/webkit_media.gypi', diff --git a/webkit/support/webkit_support.gypi b/webkit/support/webkit_support.gypi index c54f97a..86861b9 100644 --- a/webkit/support/webkit_support.gypi +++ b/webkit/support/webkit_support.gypi @@ -24,7 +24,6 @@ 'database', 'dom_storage', 'fileapi', - 'forms', 'glue', 'user_agent', 'webkit_base', diff --git a/webkit/tools/test_shell/test_shell.gypi b/webkit/tools/test_shell/test_shell.gypi index 01de611..eec779c 100644 --- a/webkit/tools/test_shell/test_shell.gypi +++ b/webkit/tools/test_shell/test_shell.gypi @@ -52,7 +52,6 @@ '<(DEPTH)/webkit/support/webkit_support.gyp:database', '<(DEPTH)/webkit/support/webkit_support.gyp:dom_storage', '<(DEPTH)/webkit/support/webkit_support.gyp:fileapi', - '<(DEPTH)/webkit/support/webkit_support.gyp:forms', '<(DEPTH)/webkit/support/webkit_support.gyp:glue', '<(DEPTH)/webkit/support/webkit_support.gyp:quota', '<(DEPTH)/webkit/support/webkit_support.gyp:user_agent', |