From 1ecbe866c38fb6c781d337393b7ff62d0c662f4e Mon Sep 17 00:00:00 2001 From: "blundell@chromium.org" Date: Fri, 5 Oct 2012 01:29:14 +0000 Subject: Move forms/ out of webkit/. The motivation for this CL is to move PasswordForm and friends (which are totally unrelated to WebKit) out of webkit/ and into a target that platforms that do not use WebKit (such as iOS) can logically depend on. As such, this CL does three things: 1. Separates the WebKit-related code in webkit/forms from the non-WebKit-related code. Concretely, this means having the WebKit::WebFormElement->PasswordForm conversion function in its own file. 2. Moves the core, non-WebKit-related forms code to chrome/common and content/public/common depending on where its usage points are. 3. Moves the above-mentioned conversion function to content/public/renderer. It cannot stay in webkit/ as it (now) has a dependency on content/, and as it is used only in chrome/renderer and content/renderer, this is a good place for it. The rest of this CL is churn due to namespace, file location, and GYP target changes. BUG= Review URL: https://chromiumcodereview.appspot.com/11000016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160280 0039d316-1c4b-4281-b951-d872f2087c98 --- .../browser/importer/external_process_importer_bridge.cc | 4 ++-- chrome/browser/importer/external_process_importer_bridge.h | 2 +- .../browser/importer/external_process_importer_client.cc | 2 +- chrome/browser/importer/external_process_importer_client.h | 2 +- chrome/browser/importer/firefox2_importer.cc | 4 ++-- chrome/browser/importer/firefox3_importer.cc | 4 ++-- chrome/browser/importer/firefox_importer_unittest.cc | 6 +++--- chrome/browser/importer/ie_importer.cc | 4 ++-- chrome/browser/importer/ie_importer_unittest_win.cc | 6 +++--- chrome/browser/importer/importer_bridge.h | 2 +- chrome/browser/importer/in_process_importer_bridge.cc | 4 ++-- chrome/browser/importer/in_process_importer_bridge.h | 2 +- chrome/browser/importer/nss_decryptor.cc | 14 +++++++------- chrome/browser/importer/nss_decryptor_mac.h | 8 +++----- chrome/browser/importer/nss_decryptor_null.h | 8 +++----- chrome/browser/importer/nss_decryptor_system_nss.h | 8 +++----- chrome/browser/importer/nss_decryptor_win.h | 8 +++----- chrome/browser/importer/profile_import_process_messages.h | 4 ++-- chrome/browser/importer/profile_writer.cc | 2 +- chrome/browser/importer/profile_writer.h | 6 ++---- 20 files changed, 45 insertions(+), 55 deletions(-) (limited to 'chrome/browser/importer') 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& 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& 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[] = "
forms; + std::vector 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 forms; + std::vector 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 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 { virtual void SetKeywords(const std::vector& 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 @@ -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* forms) { + std::vector* 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* forms) { + std::vector* 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* forms); + std::vector* 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* forms); + std::vector* 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* forms) {} + std::vector* forms) {} bool ReadAndParseSignons(const FilePath& sqlite_file, - std::vector* forms) { + std::vector* 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* forms); + std::vector* 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* forms); + std::vector* 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* forms); + std::vector* 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* forms); + std::vector* 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) 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 { 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); -- cgit v1.1