OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOGIN_DATABASE_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOGIN_DATABASE_H_ |
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOGIN_DATABASE_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOGIN_DATABASE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/pickle.h" | 12 #include "base/pickle.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "components/password_manager/core/browser/password_store_change.h" | 14 #include "components/password_manager/core/browser/password_store_change.h" |
15 #include "components/password_manager/core/browser/psl_matching_helper.h" | 15 #include "components/password_manager/core/browser/psl_matching_helper.h" |
16 #include "sql/connection.h" | 16 #include "sql/connection.h" |
17 #include "sql/meta_table.h" | 17 #include "sql/meta_table.h" |
18 | 18 |
19 namespace password_manager { | 19 namespace password_manager { |
20 | 20 |
21 extern const int kCurrentVersionNumber; | 21 extern const int kCurrentVersionNumber; |
22 | 22 |
23 // Interface to the database storage of login information, intended as a helper | 23 // Interface to the database storage of login information, intended as a helper |
24 // for PasswordStore on platforms that need internal storage of some or all of | 24 // for PasswordStore on platforms that need internal storage of some or all of |
25 // the login information. | 25 // the login information. |
26 class LoginDatabase { | 26 class LoginDatabase { |
27 public: | 27 public: |
28 LoginDatabase(); | 28 LoginDatabase(const base::FilePath& db_path); |
29 virtual ~LoginDatabase(); | 29 virtual ~LoginDatabase(); |
30 | 30 |
31 // Initialize the database with an sqlite file at the given path. | 31 // Actually creates/opens the database. If false is returned, no other method |
32 // If false is returned, no other method should be called. | 32 // should be called. |
33 bool Init(const base::FilePath& db_path); | 33 virtual bool Init(); |
34 | 34 |
35 // Reports usage metrics to UMA. | 35 // Reports usage metrics to UMA. |
36 void ReportMetrics(const std::string& sync_username, | 36 void ReportMetrics(const std::string& sync_username, |
37 bool custom_passphrase_sync_enabled); | 37 bool custom_passphrase_sync_enabled); |
38 | 38 |
39 // Adds |form| to the list of remembered password forms. Returns the list of | 39 // Adds |form| to the list of remembered password forms. Returns the list of |
40 // changes applied ({}, {ADD}, {REMOVE, ADD}). If it returns {REMOVE, ADD} | 40 // changes applied ({}, {ADD}, {REMOVE, ADD}). If it returns {REMOVE, ADD} |
41 // then the REMOVE is associated with the form that was added. Thus only the | 41 // then the REMOVE is associated with the form that was added. Thus only the |
42 // primary key columns contain the values associated with the removed form. | 42 // primary key columns contain the values associated with the removed form. |
43 PasswordStoreChangeList AddLogin(const autofill::PasswordForm& form); | 43 PasswordStoreChangeList AddLogin(const autofill::PasswordForm& form); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 base::FilePath db_path_; | 148 base::FilePath db_path_; |
149 mutable sql::Connection db_; | 149 mutable sql::Connection db_; |
150 sql::MetaTable meta_table_; | 150 sql::MetaTable meta_table_; |
151 | 151 |
152 DISALLOW_COPY_AND_ASSIGN(LoginDatabase); | 152 DISALLOW_COPY_AND_ASSIGN(LoginDatabase); |
153 }; | 153 }; |
154 | 154 |
155 } // namespace password_manager | 155 } // namespace password_manager |
156 | 156 |
157 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOGIN_DATABASE_H_ | 157 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOGIN_DATABASE_H_ |
OLD | NEW |