| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_LOGIN_DATABASE_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_LOGIN_DATABASE_H_ |
| 6 #define CHROME_BROWSER_PASSWORD_MANAGER_LOGIN_DATABASE_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_LOGIN_DATABASE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "app/sql/connection.h" |
| 12 #include "app/sql/meta_table.h" |
| 11 #include "base/string16.h" | 13 #include "base/string16.h" |
| 12 #include "chrome/browser/meta_table_helper.h" | |
| 13 #include "webkit/glue/password_form.h" | 14 #include "webkit/glue/password_form.h" |
| 14 | 15 |
| 15 class FilePath; | 16 class FilePath; |
| 16 struct sqlite3; | 17 struct sqlite3; |
| 17 | 18 |
| 18 // Interface to the database storage of login information, intended as a helper | 19 // Interface to the database storage of login information, intended as a helper |
| 19 // for PasswordStore on platforms that need internal storage of some or all of | 20 // for PasswordStore on platforms that need internal storage of some or all of |
| 20 // the login information. | 21 // the login information. |
| 21 class LoginDatabase { | 22 class LoginDatabase { |
| 22 public: | 23 public: |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 const base::Time begin, | 57 const base::Time begin, |
| 57 const base::Time end, | 58 const base::Time end, |
| 58 std::vector<webkit_glue::PasswordForm*>* forms) const; | 59 std::vector<webkit_glue::PasswordForm*>* forms) const; |
| 59 | 60 |
| 60 // Loads the complete list of autofillable password forms (i.e., not blacklist | 61 // Loads the complete list of autofillable password forms (i.e., not blacklist |
| 61 // entries) into |forms|. | 62 // entries) into |forms|. |
| 62 bool GetAutofillableLogins( | 63 bool GetAutofillableLogins( |
| 63 std::vector<webkit_glue::PasswordForm*>* forms) const; | 64 std::vector<webkit_glue::PasswordForm*>* forms) const; |
| 64 | 65 |
| 65 // Loads the complete list of blacklist forms into |forms|. | 66 // Loads the complete list of blacklist forms into |forms|. |
| 66 bool GetBlacklistLogins( | 67 bool GetBlacklistLogins(std::vector<webkit_glue::PasswordForm*>* forms) const; |
| 67 std::vector<webkit_glue::PasswordForm*>* forms) const; | |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 // Returns an encrypted version of plain_text. | 70 // Returns an encrypted version of plain_text. |
| 71 std::string EncryptedString(const string16& plain_text) const; | 71 std::string EncryptedString(const string16& plain_text) const; |
| 72 | 72 |
| 73 // Returns a decrypted version of cipher_text. | 73 // Returns a decrypted version of cipher_text. |
| 74 string16 DecryptedString(const std::string& cipher_text) const; | 74 string16 DecryptedString(const std::string& cipher_text) const; |
| 75 | 75 |
| 76 bool InitLoginsTable(); | 76 bool InitLoginsTable(); |
| 77 void MigrateOldVersionsAsNeeded(); | 77 void MigrateOldVersionsAsNeeded(); |
| 78 | 78 |
| 79 // Fills |form| from the values in the given statement (which is assumed to | 79 // Fills |form| from the values in the given statement (which is assumed to |
| 80 // be of the form used by the Get*Logins methods). | 80 // be of the form used by the Get*Logins methods). |
| 81 void InitPasswordFormFromStatement(webkit_glue::PasswordForm* form, | 81 void InitPasswordFormFromStatement(webkit_glue::PasswordForm* form, |
| 82 SQLStatement* s) const; | 82 sql::Statement& s) const; |
| 83 | 83 |
| 84 // Loads all logins whose blacklist setting matches |blacklisted| into | 84 // Loads all logins whose blacklist setting matches |blacklisted| into |
| 85 // |forms|. | 85 // |forms|. |
| 86 bool GetAllLoginsWithBlacklistSetting( | 86 bool GetAllLoginsWithBlacklistSetting( |
| 87 bool blacklisted, std::vector<webkit_glue::PasswordForm*>* forms) const; | 87 bool blacklisted, std::vector<webkit_glue::PasswordForm*>* forms) const; |
| 88 | 88 |
| 89 sqlite3* db_; | 89 mutable sql::Connection db_; |
| 90 MetaTableHelper meta_table_; | 90 sql::MetaTable meta_table_; |
| 91 | 91 |
| 92 DISALLOW_COPY_AND_ASSIGN(LoginDatabase); | 92 DISALLOW_COPY_AND_ASSIGN(LoginDatabase); |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 | 95 |
| 96 #endif // CHROME_BROWSER_PASSWORD_MANAGER_LOGIN_DATABASE_H_ | 96 #endif // CHROME_BROWSER_PASSWORD_MANAGER_LOGIN_DATABASE_H_ |
| OLD | NEW |