| 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_AFFILIATION_DATABASE_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_DATABASE_H_ |
| 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_DATABASE_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_DATABASE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 bool Store(const AffiliatedFacetsWithUpdateTime& affiliated_facets); | 63 bool Store(const AffiliatedFacetsWithUpdateTime& affiliated_facets); |
| 64 | 64 |
| 65 // Stores the equivalence class defined by |affiliated_facets| to the DB, | 65 // Stores the equivalence class defined by |affiliated_facets| to the DB, |
| 66 // database, and removes any other equivalence classes that are in conflict | 66 // database, and removes any other equivalence classes that are in conflict |
| 67 // with |affiliated_facets|, i.e. those that are neither equal nor disjoint to | 67 // with |affiliated_facets|, i.e. those that are neither equal nor disjoint to |
| 68 // it. Removed equivalence classes are stored into |removed_affiliations|. | 68 // it. Removed equivalence classes are stored into |removed_affiliations|. |
| 69 void StoreAndRemoveConflicting( | 69 void StoreAndRemoveConflicting( |
| 70 const AffiliatedFacetsWithUpdateTime& affiliated_facets, | 70 const AffiliatedFacetsWithUpdateTime& affiliated_facets, |
| 71 std::vector<AffiliatedFacetsWithUpdateTime>* removed_affiliations); | 71 std::vector<AffiliatedFacetsWithUpdateTime>* removed_affiliations); |
| 72 | 72 |
| 73 // Deletes the database file at |path| along with all its auxiliary files. The |
| 74 // database must be closed before calling this. |
| 75 static void Delete(const base::FilePath& path); |
| 76 |
| 73 private: | 77 private: |
| 74 // Creates any tables and indices that do not already exist in the database. | 78 // Creates any tables and indices that do not already exist in the database. |
| 75 bool CreateTablesAndIndicesIfNeeded(); | 79 bool CreateTablesAndIndicesIfNeeded(); |
| 76 | 80 |
| 77 // Called when SQLite encounters an error. | 81 // Called when SQLite encounters an error. |
| 78 void SQLErrorCallback(int error_number, sql::Statement* statement); | 82 void SQLErrorCallback(int error_number, sql::Statement* statement); |
| 79 | 83 |
| 80 // The SQL connection to the database. | 84 // The SQL connection to the database. |
| 81 scoped_ptr<sql::Connection> sql_connection_; | 85 scoped_ptr<sql::Connection> sql_connection_; |
| 82 | 86 |
| 83 DISALLOW_COPY_AND_ASSIGN(AffiliationDatabase); | 87 DISALLOW_COPY_AND_ASSIGN(AffiliationDatabase); |
| 84 }; | 88 }; |
| 85 | 89 |
| 86 } // namespace password_manager | 90 } // namespace password_manager |
| 87 | 91 |
| 88 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_DATABASE_H_ | 92 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_DATABASE_H_ |
| OLD | NEW |