Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(566)

Side by Side Diff: chrome/browser/password_manager/password_store_mac.h

Issue 2323893002: Stop using the Keychain for passwords finally and clean up the Chrome entries there. (Closed)
Patch Set: add a comment Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/password_manager/password_store_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 17 matching lines...) Expand all
28 // PasswordStoreProxyMac wrapper. 28 // PasswordStoreProxyMac wrapper.
29 // Implements PasswordStore on top of the OS X Keychain, with an internal 29 // Implements PasswordStore on top of the OS X Keychain, with an internal
30 // database for extra metadata. For an overview of the interactions with the 30 // database for extra metadata. For an overview of the interactions with the
31 // Keychain, as well as the rationale for some of the behaviors, see the 31 // Keychain, as well as the rationale for some of the behaviors, see the
32 // Keychain integration design doc: 32 // Keychain integration design doc:
33 // http://dev.chromium.org/developers/design-documents/os-x-password-manager-key chain-integration 33 // http://dev.chromium.org/developers/design-documents/os-x-password-manager-key chain-integration
34 class PasswordStoreMac : public password_manager::PasswordStore { 34 class PasswordStoreMac : public password_manager::PasswordStore {
35 public: 35 public:
36 enum MigrationResult { 36 enum MigrationResult {
37 MIGRATION_OK, 37 MIGRATION_OK,
38 LOGIN_DB_UNAVAILABLE,
39 LOGIN_DB_FAILURE, 38 LOGIN_DB_FAILURE,
40 ENCRYPTOR_FAILURE, 39 ENCRYPTOR_FAILURE,
41 KEYCHAIN_BLOCKED, 40 // Chrome has read whatever it had access to. Not all the passwords were
41 // accessible.
42 MIGRATION_PARTIAL,
42 }; 43 };
43 44
44 PasswordStoreMac( 45 PasswordStoreMac(
45 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner, 46 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner,
46 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner, 47 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner,
47 std::unique_ptr<crypto::AppleKeychain> keychain); 48 std::unique_ptr<crypto::AppleKeychain> keychain);
48 49
49 // Sets the background thread. 50 // Sets the background thread.
50 void InitWithTaskRunner( 51 void InitWithTaskRunner(
51 scoped_refptr<base::SingleThreadTaskRunner> background_task_runner); 52 scoped_refptr<base::SingleThreadTaskRunner> background_task_runner);
52 53
53 // Reads all the passwords from the Keychain and stores them in LoginDatabase. 54 // For all the entries in LoginDatabase reads the password value from the
54 // After the successful migration PasswordStoreMac should not be used. If the 55 // Keychain and updates the database.
55 // migration fails, PasswordStoreMac remains the active backend for 56 // The method conducts "best effort" migration without the UI prompt.
56 // PasswordStoreProxyMac. 57 // Inaccessible entries are deleted.
57 MigrationResult ImportFromKeychain(); 58 static MigrationResult ImportFromKeychain(
59 password_manager::LoginDatabase* login_db,
60 crypto::AppleKeychain* keychain);
61
62 // Delete Chrome-owned entries matching |forms| from the Keychain.
63 static void CleanUpKeychain(
64 crypto::AppleKeychain* keychain,
65 const std::vector<std::unique_ptr<autofill::PasswordForm>>& forms);
58 66
59 // To be used for testing. 67 // To be used for testing.
60 password_manager::LoginDatabase* login_metadata_db() const { 68 password_manager::LoginDatabase* login_metadata_db() const {
61 return login_metadata_db_; 69 return login_metadata_db_;
62 } 70 }
63 71
64 void set_login_metadata_db(password_manager::LoginDatabase* login_db); 72 void set_login_metadata_db(password_manager::LoginDatabase* login_db);
65 73
66 // To be used for testing. 74 // To be used for testing.
67 crypto::AppleKeychain* keychain() const { return keychain_.get(); } 75 crypto::AppleKeychain* keychain() const { return keychain_.get(); }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 std::unique_ptr<crypto::AppleKeychain> keychain_; 140 std::unique_ptr<crypto::AppleKeychain> keychain_;
133 141
134 // The login metadata SQL database. The caller is resonsible for initializing 142 // The login metadata SQL database. The caller is resonsible for initializing
135 // it. 143 // it.
136 password_manager::LoginDatabase* login_metadata_db_; 144 password_manager::LoginDatabase* login_metadata_db_;
137 145
138 DISALLOW_COPY_AND_ASSIGN(PasswordStoreMac); 146 DISALLOW_COPY_AND_ASSIGN(PasswordStoreMac);
139 }; 147 };
140 148
141 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_H_ 149 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/password_manager/password_store_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698