| 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_MAC_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_H_ |
| 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 // TODO(vasilii): Deprecate this class. The class should be used by | 25 // TODO(vasilii): Deprecate this class. The class should be used by |
| 26 // PasswordStoreProxyMac wrapper. | 26 // PasswordStoreProxyMac wrapper. |
| 27 // Implements PasswordStore on top of the OS X Keychain, with an internal | 27 // Implements PasswordStore on top of the OS X Keychain, with an internal |
| 28 // database for extra metadata. For an overview of the interactions with the | 28 // database for extra metadata. For an overview of the interactions with the |
| 29 // Keychain, as well as the rationale for some of the behaviors, see the | 29 // Keychain, as well as the rationale for some of the behaviors, see the |
| 30 // Keychain integration design doc: | 30 // Keychain integration design doc: |
| 31 // http://dev.chromium.org/developers/design-documents/os-x-password-manager-key
chain-integration | 31 // http://dev.chromium.org/developers/design-documents/os-x-password-manager-key
chain-integration |
| 32 class PasswordStoreMac : public password_manager::PasswordStore { | 32 class PasswordStoreMac : public password_manager::PasswordStore { |
| 33 public: | 33 public: |
| 34 enum MigrationResult { |
| 35 MIGRATION_OK, |
| 36 LOGIN_DB_UNAVAILABLE, |
| 37 LOGIN_DB_FAILURE, |
| 38 ENCRYPTOR_FAILURE, |
| 39 KEYCHAIN_BLOCKED, |
| 40 }; |
| 41 |
| 34 PasswordStoreMac( | 42 PasswordStoreMac( |
| 35 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner, | 43 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner, |
| 36 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner, | 44 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner, |
| 37 scoped_ptr<crypto::AppleKeychain> keychain, | 45 scoped_ptr<crypto::AppleKeychain> keychain, |
| 38 password_manager::LoginDatabase* login_db); | 46 password_manager::LoginDatabase* login_db); |
| 39 | 47 |
| 40 // Sets the background thread. | 48 // Sets the background thread. |
| 41 void InitWithTaskRunner( | 49 void InitWithTaskRunner( |
| 42 scoped_refptr<base::SingleThreadTaskRunner> background_task_runner); | 50 scoped_refptr<base::SingleThreadTaskRunner> background_task_runner); |
| 43 | 51 |
| 52 // Reads all the passwords from the Keychain and stores them in LoginDatabase. |
| 53 // After the successful migration PasswordStoreMac should not be used. If the |
| 54 // migration fails, PasswordStoreMac remains the active backend for |
| 55 // PasswordStoreProxyMac. |
| 56 MigrationResult ImportFromKeychain(); |
| 57 |
| 44 // To be used for testing. | 58 // To be used for testing. |
| 45 password_manager::LoginDatabase* login_metadata_db() const { | 59 password_manager::LoginDatabase* login_metadata_db() const { |
| 46 return login_metadata_db_; | 60 return login_metadata_db_; |
| 47 } | 61 } |
| 48 | 62 |
| 49 // To be used for testing. | 63 // To be used for testing. |
| 50 crypto::AppleKeychain* keychain() const { return keychain_.get(); } | 64 crypto::AppleKeychain* keychain() const { return keychain_.get(); } |
| 51 | 65 |
| 52 protected: | 66 protected: |
| 53 ~PasswordStoreMac() override; | 67 ~PasswordStoreMac() override; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 scoped_ptr<crypto::AppleKeychain> keychain_; | 122 scoped_ptr<crypto::AppleKeychain> keychain_; |
| 109 | 123 |
| 110 // The login metadata SQL database. The caller is resonsible for initializing | 124 // The login metadata SQL database. The caller is resonsible for initializing |
| 111 // it. | 125 // it. |
| 112 password_manager::LoginDatabase* login_metadata_db_; | 126 password_manager::LoginDatabase* login_metadata_db_; |
| 113 | 127 |
| 114 DISALLOW_COPY_AND_ASSIGN(PasswordStoreMac); | 128 DISALLOW_COPY_AND_ASSIGN(PasswordStoreMac); |
| 115 }; | 129 }; |
| 116 | 130 |
| 117 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_H_ | 131 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_H_ |
| OLD | NEW |