| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PASSWORD_STORE_X_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_X_H_ |
| 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_X_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_X_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "components/password_manager/core/browser/password_store_default.h" | 16 #include "components/password_manager/core/browser/password_store_default.h" |
| 17 | 17 |
| 18 class PrefService; | 18 class PrefService; |
| 19 | 19 |
| 20 namespace user_prefs { | 20 namespace user_prefs { |
| 21 class PrefRegistrySyncable; | 21 class PrefRegistrySyncable; |
| 22 } | 22 } |
| 23 | 23 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 virtual bool GetBlacklistLogins(ScopedVector<autofill::PasswordForm>* forms) | 84 virtual bool GetBlacklistLogins(ScopedVector<autofill::PasswordForm>* forms) |
| 85 WARN_UNUSED_RESULT = 0; | 85 WARN_UNUSED_RESULT = 0; |
| 86 virtual bool GetAllLogins(ScopedVector<autofill::PasswordForm>* forms) | 86 virtual bool GetAllLogins(ScopedVector<autofill::PasswordForm>* forms) |
| 87 WARN_UNUSED_RESULT = 0; | 87 WARN_UNUSED_RESULT = 0; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 // Takes ownership of |login_db| and |backend|. |backend| may be NULL in which | 90 // Takes ownership of |login_db| and |backend|. |backend| may be NULL in which |
| 91 // case this PasswordStoreX will act the same as PasswordStoreDefault. | 91 // case this PasswordStoreX will act the same as PasswordStoreDefault. |
| 92 PasswordStoreX(scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner, | 92 PasswordStoreX(scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner, |
| 93 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner, | 93 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner, |
| 94 scoped_ptr<password_manager::LoginDatabase> login_db, | 94 std::unique_ptr<password_manager::LoginDatabase> login_db, |
| 95 NativeBackend* backend); | 95 NativeBackend* backend); |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 friend class PasswordStoreXTest; | 98 friend class PasswordStoreXTest; |
| 99 | 99 |
| 100 ~PasswordStoreX() override; | 100 ~PasswordStoreX() override; |
| 101 | 101 |
| 102 // Implements PasswordStore interface. | 102 // Implements PasswordStore interface. |
| 103 password_manager::PasswordStoreChangeList AddLoginImpl( | 103 password_manager::PasswordStoreChangeList AddLoginImpl( |
| 104 const autofill::PasswordForm& form) override; | 104 const autofill::PasswordForm& form) override; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 135 // time we call it when falling back is necessary. See |allow_fallback_|. | 135 // time we call it when falling back is necessary. See |allow_fallback_|. |
| 136 bool allow_default_store(); | 136 bool allow_default_store(); |
| 137 | 137 |
| 138 // Synchronously migrates all the passwords stored in the login database to | 138 // Synchronously migrates all the passwords stored in the login database to |
| 139 // the native backend. If successful, the login database will be left with no | 139 // the native backend. If successful, the login database will be left with no |
| 140 // stored passwords, and the number of passwords migrated will be returned. | 140 // stored passwords, and the number of passwords migrated will be returned. |
| 141 // (This might be 0 if migration was not necessary.) Returns < 0 on failure. | 141 // (This might be 0 if migration was not necessary.) Returns < 0 on failure. |
| 142 ssize_t MigrateLogins(); | 142 ssize_t MigrateLogins(); |
| 143 | 143 |
| 144 // The native backend in use, or NULL if none. | 144 // The native backend in use, or NULL if none. |
| 145 scoped_ptr<NativeBackend> backend_; | 145 std::unique_ptr<NativeBackend> backend_; |
| 146 // Whether we have already attempted migration to the native store. | 146 // Whether we have already attempted migration to the native store. |
| 147 bool migration_checked_; | 147 bool migration_checked_; |
| 148 // Whether we should allow falling back to the default store. If there is | 148 // Whether we should allow falling back to the default store. If there is |
| 149 // nothing to migrate, then the first attempt to use the native store will | 149 // nothing to migrate, then the first attempt to use the native store will |
| 150 // be the first time we try to use it and we should allow falling back. If | 150 // be the first time we try to use it and we should allow falling back. If |
| 151 // we have migrated successfully, then we do not allow falling back. | 151 // we have migrated successfully, then we do not allow falling back. |
| 152 bool allow_fallback_; | 152 bool allow_fallback_; |
| 153 | 153 |
| 154 DISALLOW_COPY_AND_ASSIGN(PasswordStoreX); | 154 DISALLOW_COPY_AND_ASSIGN(PasswordStoreX); |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_X_H_ | 157 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_X_H_ |
| OLD | NEW |