diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-16 19:50:56 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-16 19:50:56 +0000 |
commit | ed3fb034eb4b7da69bbc4f3e3da47093dabc481e (patch) | |
tree | d08b2837ab8b05b98fef6990edd26a9d00465589 /chrome/browser/password_manager | |
parent | 5eb55c2f42f70fe544a04d200cdd059377d310f7 (diff) | |
download | chromium_src-ed3fb034eb4b7da69bbc4f3e3da47093dabc481e.zip chromium_src-ed3fb034eb4b7da69bbc4f3e3da47093dabc481e.tar.gz chromium_src-ed3fb034eb4b7da69bbc4f3e3da47093dabc481e.tar.bz2 |
Extract load times from WebDataSource. Move them to NavigationState.
Move PasswordForm into the webkit_glue namespace.
TEST=none
BUG=10041
R=brettw
Review URL: http://codereview.chromium.org/126190
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18515 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/password_manager')
18 files changed, 76 insertions, 53 deletions
diff --git a/chrome/browser/password_manager/login_database.cc b/chrome/browser/password_manager/login_database.cc index a8eebab..d455300 100644 --- a/chrome/browser/password_manager/login_database.cc +++ b/chrome/browser/password_manager/login_database.cc @@ -10,6 +10,8 @@ #include "base/time.h" #include "chrome/common/sqlite_utils.h" +using webkit_glue::PasswordForm; + static const int kCurrentVersionNumber = 1; static const int kCompatibleVersionNumber = 1; diff --git a/chrome/browser/password_manager/login_database.h b/chrome/browser/password_manager/login_database.h index bc067dd..ce53993 100644 --- a/chrome/browser/password_manager/login_database.h +++ b/chrome/browser/password_manager/login_database.h @@ -28,13 +28,13 @@ class LoginDatabase { bool Init(const std::string& db_name); // Adds |form| to the list of remembered password forms. - bool AddLogin(const PasswordForm& form); + bool AddLogin(const webkit_glue::PasswordForm& form); // Updates remembered password form. - bool UpdateLogin(const PasswordForm& form); + bool UpdateLogin(const webkit_glue::PasswordForm& form); // Removes |form| from the list of remembered password forms. - bool RemoveLogin(const PasswordForm& form); + bool RemoveLogin(const webkit_glue::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 @@ -45,14 +45,14 @@ 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 PasswordForm& form, - std::vector<PasswordForm*>* forms) const; + bool GetLogins(const webkit_glue::PasswordForm& form, + std::vector<webkit_glue::PasswordForm*>* forms) const; // Loads the complete list of password forms into the specified vector |forms| // if include_blacklisted is true, otherwise only loads those which are // actually autofillable; i.e haven't been blacklisted by the user selecting // the 'Never for this site' button. - bool GetAllLogins(std::vector<PasswordForm*>* forms, + bool GetAllLogins(std::vector<webkit_glue::PasswordForm*>* forms, bool include_blacklisted) const; protected: @@ -69,7 +69,7 @@ class LoginDatabase { private: // Fills |form| from the values in the given statement (which is assumed to // be of the form used by GetLogins/GetAllLogins). - void InitPasswordFormFromStatement(PasswordForm* form, + void InitPasswordFormFromStatement(webkit_glue::PasswordForm* form, SQLStatement* s) const; sqlite3* db_; diff --git a/chrome/browser/password_manager/login_database_unittest.cc b/chrome/browser/password_manager/login_database_unittest.cc index 9e8be84..6c6322f 100644 --- a/chrome/browser/password_manager/login_database_unittest.cc +++ b/chrome/browser/password_manager/login_database_unittest.cc @@ -16,6 +16,8 @@ #include "chrome/common/chrome_paths.h" #include "webkit/glue/password_form.h" +using webkit_glue::PasswordForm; + class LoginDatabaseTest : public testing::Test { protected: virtual void SetUp() { diff --git a/chrome/browser/password_manager/password_form_manager.cc b/chrome/browser/password_manager/password_form_manager.cc index 8122f28..94d0c93 100644 --- a/chrome/browser/password_manager/password_form_manager.cc +++ b/chrome/browser/password_manager/password_form_manager.cc @@ -12,6 +12,8 @@ #include "webkit/glue/password_form_dom_manager.h" using base::Time; +using webkit_glue::PasswordForm; +using webkit_glue::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 90ffc86..78229de 100644 --- a/chrome/browser/password_manager/password_form_manager.h +++ b/chrome/browser/password_manager/password_form_manager.h @@ -26,12 +26,12 @@ class PasswordFormManager : public PasswordStoreConsumer { // used to filter login results from database. PasswordFormManager(Profile* profile, PasswordManager* password_manager, - const PasswordForm& observed_form, + const webkit_glue::PasswordForm& observed_form, bool ssl_valid); virtual ~PasswordFormManager(); // Compare basic data of observed_form_ with argument. - bool DoesManage(const PasswordForm& form) const; + bool DoesManage(const webkit_glue::PasswordForm& form) const; // Retrieves potential matching logins from the database. void FetchMatchingLoginsFromWebDatabase(); @@ -59,11 +59,12 @@ class PasswordFormManager : public PasswordStoreConsumer { bool IsNewLogin(); // Determines if we need to autofill given the results of the query. - void OnRequestDone(int handle, const std::vector<PasswordForm*>& result); + void OnRequestDone( + int handle, const std::vector<webkit_glue::PasswordForm*>& result); // PasswordStoreConsumer implementation. virtual void OnPasswordStoreRequestDone( - int handle, const std::vector<PasswordForm*>& result); + int handle, const std::vector<webkit_glue::PasswordForm*>& result); // A user opted to 'never remember' passwords for this form. // Blacklist it so that from now on when it is seen we ignore it. @@ -72,7 +73,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 PasswordForm& credentials); + void ProvisionallySave(const webkit_glue::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 @@ -87,7 +88,7 @@ class PasswordFormManager : public PasswordStoreConsumer { // Helper for OnWebDataServiceRequestDone to determine whether or not // the given result form is worth scoring. - bool IgnoreResult(const PasswordForm& form) const; + bool IgnoreResult(const webkit_glue::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 @@ -96,7 +97,7 @@ class PasswordFormManager : public PasswordStoreConsumer { // Helper for OnWebDataServiceRequestDone to score an individual result // against the observed_form_. - int ScoreResult(const PasswordForm& form) const; + int ScoreResult(const webkit_glue::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 @@ -108,13 +109,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. - PasswordFormMap best_matches_; + webkit_glue::PasswordFormMap best_matches_; // Cleans up when best_matches_ goes out of scope. - STLValueDeleter<PasswordFormMap> best_matches_deleter_; + STLValueDeleter<webkit_glue::PasswordFormMap> best_matches_deleter_; // The PasswordForm from the page or dialog managed by this. - PasswordForm observed_form_; + webkit_glue::PasswordForm observed_form_; // The origin url path of observed_form_ tokenized, for convenience when // scoring. @@ -122,7 +123,7 @@ class PasswordFormManager : public PasswordStoreConsumer { // Stores updated credentials when the form was submitted but success is // still unknown. - PasswordForm pending_credentials_; + webkit_glue::PasswordForm pending_credentials_; // Whether pending_credentials_ stores a new login or is an update // to an existing one. @@ -138,7 +139,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 PasswordForm* preferred_match_; + const webkit_glue::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 092cfd9..30c4faa 100644 --- a/chrome/browser/password_manager/password_form_manager_unittest.cc +++ b/chrome/browser/password_manager/password_form_manager_unittest.cc @@ -10,6 +10,8 @@ #include "chrome/test/testing_profile.h" #include "webkit/glue/password_form.h" +using webkit_glue::PasswordForm; + class PasswordFormManagerTest : public testing::Test { public: PasswordFormManagerTest() { diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc index 5566e99..58c4afd 100644 --- a/chrome/browser/password_manager/password_manager.cc +++ b/chrome/browser/password_manager/password_manager.cc @@ -19,6 +19,9 @@ #include "grit/generated_resources.h" #include "grit/theme_resources.h" +using webkit_glue::PasswordForm; +using webkit_glue::PasswordFormMap; + // After a successful *new* login attempt, we take the PasswordFormManager in // provisional_save_manager_ and move it to a SavePasswordInfoBarDelegate while // the user makes up their mind with the "save password" infobar. Note if the diff --git a/chrome/browser/password_manager/password_manager.h b/chrome/browser/password_manager/password_manager.h index 175e4cd..5487da3 100644 --- a/chrome/browser/password_manager/password_manager.h +++ b/chrome/browser/password_manager/password_manager.h @@ -30,9 +30,9 @@ class PasswordManager : public views::LoginModel { // Called by a PasswordFormManager when it decides a form can be autofilled // on the page. - void Autofill(const PasswordForm& form_for_autofill, - const PasswordFormMap& best_matches, - const PasswordForm* const preferred_match) const; + void Autofill(const webkit_glue::PasswordForm& form_for_autofill, + const webkit_glue::PasswordFormMap& best_matches, + const webkit_glue::PasswordForm* const preferred_match) const; // Notification that the user navigated away from the current page. // Unless this is a password form submission, for our purposes this @@ -44,12 +44,12 @@ class PasswordManager : public views::LoginModel { void DidStopLoading(); // Notifies the password manager that password forms were parsed on the page. - void PasswordFormsSeen(const std::vector<PasswordForm>& forms); + void PasswordFormsSeen(const std::vector<webkit_glue::PasswordForm>& forms); // 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(PasswordForm form); + void ProvisionallySavePassword(webkit_glue::PasswordForm form); // Clear any pending saves void ClearProvisionalSave(); diff --git a/chrome/browser/password_manager/password_store.cc b/chrome/browser/password_manager/password_store.cc index d84b788..ba258bf 100644 --- a/chrome/browser/password_manager/password_store.cc +++ b/chrome/browser/password_manager/password_store.cc @@ -8,6 +8,7 @@ #include "base/task.h" using std::vector; +using webkit_glue::PasswordForm; PasswordStore::PasswordStore() : handle_(0) { } diff --git a/chrome/browser/password_manager/password_store.h b/chrome/browser/password_manager/password_store.h index 1850e48..d63f099 100644 --- a/chrome/browser/password_manager/password_store.h +++ b/chrome/browser/password_manager/password_store.h @@ -22,7 +22,7 @@ class PasswordStoreConsumer { // Call this when the request is finished. If there are no results, call it // anyway with an empty vector. virtual void OnPasswordStoreRequestDone( - int handle, const std::vector<PasswordForm*>& result) = 0; + int handle, const std::vector<webkit_glue::PasswordForm*>& result) = 0; }; // Interface for storing form passwords in a platform-specific secure way. @@ -39,15 +39,15 @@ class PasswordStore : public base::RefCountedThreadSafe<PasswordStore> { // password_store_default; once that is fixed, they can become non-virtual. // Adds the given PasswordForm to the secure password store asynchronously. - virtual void AddLogin(const PasswordForm& form); + virtual void AddLogin(const webkit_glue::PasswordForm& form); // Updates the matching PasswordForm in the secure password store (async). - virtual void UpdateLogin(const PasswordForm& form); + virtual void UpdateLogin(const webkit_glue::PasswordForm& form); // Removes the matching PasswordForm from the secure password store (async). - virtual void RemoveLogin(const PasswordForm& form); + virtual void RemoveLogin(const webkit_glue::PasswordForm& form); // 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 int GetLogins(const PasswordForm& form, + virtual int GetLogins(const webkit_glue::PasswordForm& form, PasswordStoreConsumer* consumer); // Cancels a previous GetLogins query (async) @@ -57,12 +57,12 @@ class PasswordStore : public base::RefCountedThreadSafe<PasswordStore> { // Simple container class that represents a GetLogins request. // Created in GetLogins and passed to GetLoginsImpl. struct GetLoginsRequest { - GetLoginsRequest(const PasswordForm& f, + GetLoginsRequest(const webkit_glue::PasswordForm& f, PasswordStoreConsumer* c, int handle); // The query form that was originally passed to GetLogins - PasswordForm form; + webkit_glue::PasswordForm form; // The consumer to notify when this GetLogins request is complete PasswordStoreConsumer* consumer; // A unique handle for the request @@ -79,11 +79,11 @@ class PasswordStore : public base::RefCountedThreadSafe<PasswordStore> { // These will be run in PasswordStore's own thread. // Synchronous implementation to add the given login. - virtual void AddLoginImpl(const PasswordForm& form) = 0; + virtual void AddLoginImpl(const webkit_glue::PasswordForm& form) = 0; // Synchronous implementation to update the given login. - virtual void UpdateLoginImpl(const PasswordForm& form) = 0; + virtual void UpdateLoginImpl(const webkit_glue::PasswordForm& form) = 0; // Synchronous implementation to remove the given login. - virtual void RemoveLoginImpl(const PasswordForm& form) = 0; + virtual void RemoveLoginImpl(const webkit_glue::PasswordForm& form) = 0; // Should find all PasswordForms with the same signon_realm. The results // will then be scored by the PasswordFormManager. Once they are found // (or not), the consumer should be notified. @@ -91,7 +91,7 @@ class PasswordStore : public base::RefCountedThreadSafe<PasswordStore> { // Notifies the consumer that GetLoginsImpl() is complete. void NotifyConsumer(GetLoginsRequest* request, - const std::vector<PasswordForm*> forms); + const std::vector<webkit_glue::PasswordForm*> forms); // Next handle to return from GetLogins() to allow callers to track // their request. @@ -106,7 +106,7 @@ class PasswordStore : public base::RefCountedThreadSafe<PasswordStore> { // that PasswordStoreConsumer doesn't have to be reference counted (we assume // consumers will cancel their requests before they are destroyed). void NotifyConsumerImpl(PasswordStoreConsumer* consumer, int handle, - const std::vector<PasswordForm*> forms); + const std::vector<webkit_glue::PasswordForm*> forms); // List of pending request handles. Handles are removed from the set when // they finish or are canceled. diff --git a/chrome/browser/password_manager/password_store_default.cc b/chrome/browser/password_manager/password_store_default.cc index 33895b5..050fe46 100644 --- a/chrome/browser/password_manager/password_store_default.cc +++ b/chrome/browser/password_manager/password_store_default.cc @@ -9,6 +9,8 @@ #include "base/logging.h" #include "base/task.h" +using webkit_glue::PasswordForm; + PasswordStoreDefault::PasswordStoreDefault(WebDataService* web_data_service) : web_data_service_(web_data_service) { } diff --git a/chrome/browser/password_manager/password_store_default.h b/chrome/browser/password_manager/password_store_default.h index 5529502..2434900 100644 --- a/chrome/browser/password_manager/password_store_default.h +++ b/chrome/browser/password_manager/password_store_default.h @@ -29,18 +29,18 @@ class PasswordStoreDefault : public PasswordStore, // Overridden to bypass the threading logic in PasswordStore, since // WebDataService's API is not threadsafe. - virtual void AddLogin(const PasswordForm& form); - virtual void UpdateLogin(const PasswordForm& form); - virtual void RemoveLogin(const PasswordForm& form); - virtual int GetLogins(const PasswordForm& form, + virtual void AddLogin(const webkit_glue::PasswordForm& form); + virtual void UpdateLogin(const webkit_glue::PasswordForm& form); + virtual void RemoveLogin(const webkit_glue::PasswordForm& form); + virtual int GetLogins(const webkit_glue::PasswordForm& form, PasswordStoreConsumer* consumer); virtual void CancelLoginsQuery(int handle); protected: // Implements PasswordStore interface. - void AddLoginImpl(const PasswordForm& form); - void UpdateLoginImpl(const PasswordForm& form); - void RemoveLoginImpl(const PasswordForm& form); + void AddLoginImpl(const webkit_glue::PasswordForm& form); + void UpdateLoginImpl(const webkit_glue::PasswordForm& form); + void RemoveLoginImpl(const webkit_glue::PasswordForm& form); void GetLoginsImpl(GetLoginsRequest* request); // Called when a WebDataService method finishes. diff --git a/chrome/browser/password_manager/password_store_mac.cc b/chrome/browser/password_manager/password_store_mac.cc index 760e5dc5..07032de 100644 --- a/chrome/browser/password_manager/password_store_mac.cc +++ b/chrome/browser/password_manager/password_store_mac.cc @@ -14,6 +14,8 @@ #include "base/time.h" #include "chrome/browser/keychain_mac.h" +using webkit_glue::PasswordForm; + namespace internal_keychain_helpers { // Utility class to handle the details of constructing and running a keychain diff --git a/chrome/browser/password_manager/password_store_mac.h b/chrome/browser/password_manager/password_store_mac.h index 61bce2d..425081f 100644 --- a/chrome/browser/password_manager/password_store_mac.h +++ b/chrome/browser/password_manager/password_store_mac.h @@ -17,9 +17,9 @@ class PasswordStoreMac : public PasswordStore { virtual ~PasswordStoreMac() {} private: - void AddLoginImpl(const PasswordForm& form); - void UpdateLoginImpl(const PasswordForm& form); - void RemoveLoginImpl(const PasswordForm& form); + void AddLoginImpl(const webkit_glue::PasswordForm& form); + void UpdateLoginImpl(const webkit_glue::PasswordForm& form); + void RemoveLoginImpl(const webkit_glue::PasswordForm& form); void GetLoginsImpl(GetLoginsRequest* request); scoped_ptr<MacKeychain> keychain_; diff --git a/chrome/browser/password_manager/password_store_mac_internal.h b/chrome/browser/password_manager/password_store_mac_internal.h index 53113d4..09da925 100644 --- a/chrome/browser/password_manager/password_store_mac_internal.h +++ b/chrome/browser/password_manager/password_store_mac_internal.h @@ -38,24 +38,26 @@ bool TimeFromKeychainTimeString(const char* time_string_bytes, base::Time* time); // Returns the Keychain SecAuthenticationType type corresponding to |scheme|. -SecAuthenticationType AuthTypeForScheme(PasswordForm::Scheme scheme); +SecAuthenticationType AuthTypeForScheme( + webkit_glue::PasswordForm::Scheme scheme); // Returns the PasswordForm Scheme corresponding to |auth_type|. -PasswordForm::Scheme SchemeForAuthType(SecAuthenticationType auth_type); +webkit_glue::PasswordForm::Scheme SchemeForAuthType( + SecAuthenticationType auth_type); // Searches |keychain| for all items usable for the given signon_realm, and // puts them in |items|. The caller is responsible for calling keychain->Free // on each of them when it is finished with them. void FindMatchingKeychainItems(const MacKeychain& keychain, const std::string& signon_realm, - PasswordForm::Scheme scheme, + webkit_glue::PasswordForm::Scheme scheme, std::vector<SecKeychainItemRef>* items); // Searches |keychain| for the specific keychain entry matching the given form. // If no match is found, |match| will be NULL on return. // The caller is responsible for calling keychain->Free on |match|. void FindMatchingKeychainItem(const MacKeychain& keychain, - const PasswordForm& form, + const webkit_glue::PasswordForm& form, SecKeychainItemRef* match); // Sets the fields of |form| based on the keychain data from |keychain_item|. @@ -71,7 +73,7 @@ void FindMatchingKeychainItem(const MacKeychain& keychain, // require authorization). bool FillPasswordFormFromKeychainItem(const MacKeychain& keychain, const SecKeychainItemRef& keychain_item, - PasswordForm* form); + webkit_glue::PasswordForm* form); } // 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 1c352fe..f7ce02d 100644 --- a/chrome/browser/password_manager/password_store_mac_unittest.cc +++ b/chrome/browser/password_manager/password_store_mac_unittest.cc @@ -8,6 +8,8 @@ #include "chrome/browser/password_manager/password_store_mac.h" #include "chrome/browser/password_manager/password_store_mac_internal.h" +using webkit_glue::PasswordForm; + #pragma mark Mock Keychain // TODO(stuartmorgan): Replace this with gMock. You know, once we have it. diff --git a/chrome/browser/password_manager/password_store_win.cc b/chrome/browser/password_manager/password_store_win.cc index fa5e4ab..c8bd867 100644 --- a/chrome/browser/password_manager/password_store_win.cc +++ b/chrome/browser/password_manager/password_store_win.cc @@ -12,6 +12,7 @@ using std::map; using std::vector; +using webkit_glue::PasswordForm; PasswordStoreWin::PasswordStoreWin(WebDataService* web_data_service) : PasswordStoreDefault(web_data_service) { diff --git a/chrome/browser/password_manager/password_store_win.h b/chrome/browser/password_manager/password_store_win.h index a56b416..ad59d8a 100644 --- a/chrome/browser/password_manager/password_store_win.h +++ b/chrome/browser/password_manager/password_store_win.h @@ -30,8 +30,9 @@ class PasswordStoreWin : public PasswordStoreDefault { // Gets logins from IE7 if no others are found. Also copies them into // Chrome's WebDatabase so we don't need to look next time. - PasswordForm* GetIE7Result(const WDTypedResult* result, - const PasswordForm& form); + webkit_glue::PasswordForm* GetIE7Result( + const WDTypedResult* result, + const webkit_glue::PasswordForm& form); DISALLOW_COPY_AND_ASSIGN(PasswordStoreWin); }; |