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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/scoped_vector.h" |
12 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
13 #include "components/password_manager/core/browser/login_database.h" | 14 #include "components/password_manager/core/browser/login_database.h" |
14 #include "components/password_manager/core/browser/password_store.h" | 15 #include "components/password_manager/core/browser/password_store.h" |
15 | 16 |
16 namespace crypto { | 17 namespace crypto { |
17 class AppleKeychain; | 18 class AppleKeychain; |
18 } | 19 } |
19 | 20 |
20 namespace password_manager { | 21 namespace password_manager { |
21 class LoginDatabase; | 22 class LoginDatabase; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 base::Time delete_end) override; | 74 base::Time delete_end) override; |
74 password_manager::PasswordStoreChangeList RemoveLoginsSyncedBetweenImpl( | 75 password_manager::PasswordStoreChangeList RemoveLoginsSyncedBetweenImpl( |
75 base::Time delete_begin, | 76 base::Time delete_begin, |
76 base::Time delete_end) override; | 77 base::Time delete_end) override; |
77 void GetLoginsImpl(const autofill::PasswordForm& form, | 78 void GetLoginsImpl(const autofill::PasswordForm& form, |
78 AuthorizationPromptPolicy prompt_policy, | 79 AuthorizationPromptPolicy prompt_policy, |
79 const ConsumerCallbackRunner& callback_runner) override; | 80 const ConsumerCallbackRunner& callback_runner) override; |
80 void GetAutofillableLoginsImpl(GetLoginsRequest* request) override; | 81 void GetAutofillableLoginsImpl(GetLoginsRequest* request) override; |
81 void GetBlacklistLoginsImpl(GetLoginsRequest* request) override; | 82 void GetBlacklistLoginsImpl(GetLoginsRequest* request) override; |
82 bool FillAutofillableLogins( | 83 bool FillAutofillableLogins( |
83 std::vector<autofill::PasswordForm*>* forms) override; | 84 ScopedVector<autofill::PasswordForm>* forms) override; |
84 bool FillBlacklistLogins( | 85 bool FillBlacklistLogins( |
85 std::vector<autofill::PasswordForm*>* forms) override; | 86 ScopedVector<autofill::PasswordForm>* forms) override; |
86 | 87 |
87 // Adds the given form to the Keychain if it's something we want to store | 88 // Adds the given form to the Keychain if it's something we want to store |
88 // there (i.e., not a blacklist entry). Returns true if the operation | 89 // there (i.e., not a blacklist entry). Returns true if the operation |
89 // succeeded (either we added successfully, or we didn't need to). | 90 // succeeded (either we added successfully, or we didn't need to). |
90 bool AddToKeychainIfNecessary(const autofill::PasswordForm& form); | 91 bool AddToKeychainIfNecessary(const autofill::PasswordForm& form); |
91 | 92 |
92 // Returns true if our database contains a form that exactly matches the given | 93 // Returns true if our database contains a form that exactly matches the given |
93 // keychain form. | 94 // keychain form. |
94 bool DatabaseHasFormMatchingKeychainForm( | 95 bool DatabaseHasFormMatchingKeychainForm( |
95 const autofill::PasswordForm& form); | 96 const autofill::PasswordForm& form); |
96 | 97 |
97 // Removes the given forms from the database. | 98 // Removes the given forms from the database. |
98 void RemoveDatabaseForms( | 99 void RemoveDatabaseForms( |
99 const std::vector<autofill::PasswordForm*>& forms); | 100 const std::vector<autofill::PasswordForm*>& forms); |
100 | 101 |
101 // Removes the given forms from the Keychain. | 102 // Removes the given forms from the Keychain. |
102 void RemoveKeychainForms( | 103 void RemoveKeychainForms( |
103 const std::vector<autofill::PasswordForm*>& forms); | 104 const std::vector<autofill::PasswordForm*>& forms); |
104 | 105 |
105 // Searches the database for forms without a corresponding entry in the | 106 // Searches the database for forms without a corresponding entry in the |
106 // keychain. Removes those forms from the database, and returns them in | 107 // keychain. Removes those forms from the database, and adds them to |
107 // |forms|. Ownership of |forms| is passed to the caller. | 108 // |orphaned_forms|. |
108 void CleanOrphanedForms(std::vector<autofill::PasswordForm*>* forms); | 109 void CleanOrphanedForms(ScopedVector<autofill::PasswordForm>* orphaned_forms); |
109 | 110 |
110 scoped_ptr<crypto::AppleKeychain> keychain_; | 111 scoped_ptr<crypto::AppleKeychain> keychain_; |
111 | 112 |
112 // The login metadata SQL database. The LoginDatabase instance is received via | 113 // The login metadata SQL database. The LoginDatabase instance is received via |
113 // the in an uninitialized state, so as to allow injecting mocks, then Init() | 114 // the in an uninitialized state, so as to allow injecting mocks, then Init() |
114 // is called on the DB thread in a deferred manner. If opening the DB fails, | 115 // is called on the DB thread in a deferred manner. If opening the DB fails, |
115 // |login_metadata_db_| will be reset to NULL for the lifetime of |this|. | 116 // |login_metadata_db_| will be reset to NULL for the lifetime of |this|. |
116 scoped_ptr<password_manager::LoginDatabase> login_metadata_db_; | 117 scoped_ptr<password_manager::LoginDatabase> login_metadata_db_; |
117 | 118 |
118 // Thread that the synchronous methods are run on. | 119 // Thread that the synchronous methods are run on. |
119 scoped_ptr<base::Thread> thread_; | 120 scoped_ptr<base::Thread> thread_; |
120 | 121 |
121 DISALLOW_COPY_AND_ASSIGN(PasswordStoreMac); | 122 DISALLOW_COPY_AND_ASSIGN(PasswordStoreMac); |
122 }; | 123 }; |
123 | 124 |
124 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_H_ | 125 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_H_ |
OLD | NEW |