| 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 "components/password_manager/core/common/sync_state.h" |
| 16 #include "sql/connection.h" | 17 #include "sql/connection.h" |
| 17 #include "sql/meta_table.h" | 18 #include "sql/meta_table.h" |
| 18 | 19 |
| 20 class ProfileSyncService; |
| 21 class SigninManagerBase; |
| 22 |
| 19 namespace password_manager { | 23 namespace password_manager { |
| 20 | 24 |
| 21 // Interface to the database storage of login information, intended as a helper | 25 // Interface to the database storage of login information, intended as a helper |
| 22 // for PasswordStore on platforms that need internal storage of some or all of | 26 // for PasswordStore on platforms that need internal storage of some or all of |
| 23 // the login information. | 27 // the login information. |
| 24 class LoginDatabase { | 28 class LoginDatabase { |
| 25 public: | 29 public: |
| 26 LoginDatabase(); | 30 LoginDatabase(); |
| 27 virtual ~LoginDatabase(); | 31 virtual ~LoginDatabase(); |
| 28 | 32 |
| 29 // Initialize the database with an sqlite file at the given path. | 33 // Initialize the database with an sqlite file at the given path. |
| 30 // If false is returned, no other method should be called. | 34 // If false is returned, no other method should be called. |
| 31 bool Init(const base::FilePath& db_path); | 35 bool Init(const base::FilePath& db_path); |
| 32 | 36 |
| 33 // Reports usage metrics to UMA. | 37 // Reports usage metrics to UMA. |
| 34 void ReportMetrics(); | 38 void ReportMetrics(const std::string& sync_username, |
| 39 password_manager::SyncState sync_state); |
| 35 | 40 |
| 36 // Adds |form| to the list of remembered password forms. Returns the list of | 41 // Adds |form| to the list of remembered password forms. Returns the list of |
| 37 // changes applied ({}, {ADD}, {REMOVE, ADD}). If it returns {REMOVE, ADD} | 42 // changes applied ({}, {ADD}, {REMOVE, ADD}). If it returns {REMOVE, ADD} |
| 38 // then the REMOVE is associated with the form that was added. Thus only the | 43 // then the REMOVE is associated with the form that was added. Thus only the |
| 39 // primary key columns contain the values associated with the removed form. | 44 // primary key columns contain the values associated with the removed form. |
| 40 PasswordStoreChangeList AddLogin(const autofill::PasswordForm& form); | 45 PasswordStoreChangeList AddLogin(const autofill::PasswordForm& form); |
| 41 | 46 |
| 42 // Updates existing password form. Returns the list of applied changes | 47 // Updates existing password form. Returns the list of applied changes |
| 43 // ({}, {UPDATE}). The password is looked up by the tuple {origin, | 48 // ({}, {UPDATE}). The password is looked up by the tuple {origin, |
| 44 // username_element, username_value, password_element, signon_realm}. | 49 // username_element, username_value, password_element, signon_realm}. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 sql::MetaTable meta_table_; | 152 sql::MetaTable meta_table_; |
| 148 | 153 |
| 149 PSLMatchingHelper psl_helper_; | 154 PSLMatchingHelper psl_helper_; |
| 150 | 155 |
| 151 DISALLOW_COPY_AND_ASSIGN(LoginDatabase); | 156 DISALLOW_COPY_AND_ASSIGN(LoginDatabase); |
| 152 }; | 157 }; |
| 153 | 158 |
| 154 } // namespace password_manager | 159 } // namespace password_manager |
| 155 | 160 |
| 156 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOGIN_DATABASE_H_ | 161 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LOGIN_DATABASE_H_ |
| OLD | NEW |