Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Unified Diff: components/password_manager/core/browser/login_database.h

Issue 283563002: Password Login Database: report correct changes from AddLogin(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/password_manager/core/browser/login_database.h
diff --git a/components/password_manager/core/browser/login_database.h b/components/password_manager/core/browser/login_database.h
index 70da32831ead9e9c03b56191e8f2514cd8cdacfe..e9e5fb304a3162c163af245e7dc3b27fa4a7c959 100644
--- a/components/password_manager/core/browser/login_database.h
+++ b/components/password_manager/core/browser/login_database.h
@@ -11,14 +11,11 @@
#include "base/files/file_path.h"
#include "base/pickle.h"
#include "base/strings/string16.h"
+#include "components/password_manager/core/browser/password_store_change.h"
#include "components/password_manager/core/browser/psl_matching_helper.h"
#include "sql/connection.h"
#include "sql/meta_table.h"
-namespace autofill {
-struct PasswordForm;
-} // namespace autofill
-
namespace password_manager {
// Interface to the database storage of login information, intended as a helper
@@ -36,8 +33,11 @@ class LoginDatabase {
// Reports usage metrics to UMA.
void ReportMetrics();
- // Adds |form| to the list of remembered password forms.
- bool AddLogin(const autofill::PasswordForm& form);
+ // Adds |form| to the list of remembered password forms. Returns the list of
+ // changes applied ({}, {ADD}, {REMOVE, ADD}). If it returns {REMOVE, ADD}
+ // then the REMOVE is associated with the form that was added. Thus only the
+ // primary key columns contain the values associated with the removed form.
+ PasswordStoreChangeList AddLogin(const autofill::PasswordForm& form);
// Updates remembered password form. Returns true on success and sets
// items_changed (if non-NULL) to the number of logins updated.
@@ -82,9 +82,11 @@ class LoginDatabase {
// whether further use of this login database will succeed is unspecified.
bool DeleteAndRecreateDatabaseFile();
- private:
- friend class LoginDatabaseTest;
+ // Serialization routines for vectors.
Garrett Casto 2014/05/14 18:34:48 These routines really shouldn't be externally visi
vasilii 2014/05/15 08:36:52 Done.
+ static Pickle SerializeVector(const std::vector<base::string16>& vec);
+ static std::vector<base::string16> DeserializeVector(const Pickle& pickle);
+ private:
// Result values for encryption/decryption actions.
enum EncryptionResult {
// Success.
@@ -128,10 +130,6 @@ class LoginDatabase {
bool GetAllLoginsWithBlacklistSetting(
bool blacklisted, std::vector<autofill::PasswordForm*>* forms) const;
- // Serialization routines for vectors.
- Pickle SerializeVector(const std::vector<base::string16>& vec) const;
- std::vector<base::string16> DeserializeVector(const Pickle& pickle) const;
-
base::FilePath db_path_;
mutable sql::Connection db_;
sql::MetaTable meta_table_;

Powered by Google App Engine
This is Rietveld 408576698