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

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

Issue 454083002: Fix a memory leak in PasswordStoreMac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
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_INTERNAL_H_ 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_INTERNAL_H_
6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_INTERNAL_H_ 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_INTERNAL_H_
7 7
8 #include <Security/Security.h> 8 #include <Security/Security.h>
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/memory/scoped_ptr.h"
13 #include "components/autofill/core/common/password_form.h" 14 #include "components/autofill/core/common/password_form.h"
14 #include "crypto/apple_keychain.h" 15 #include "crypto/apple_keychain.h"
15 16
16 using crypto::AppleKeychain; 17 using crypto::AppleKeychain;
17 18
18 // Adapter that wraps a AppleKeychain and provides interaction in terms of 19 // Adapter that wraps a AppleKeychain and provides interaction in terms of
19 // PasswordForms instead of Keychain items. 20 // PasswordForms instead of Keychain items.
20 class MacKeychainPasswordFormAdapter { 21 class MacKeychainPasswordFormAdapter {
21 public: 22 public:
22 // Creates an adapter for |keychain|. This class does not take ownership of 23 // Creates an adapter for |keychain|. This class does not take ownership of
23 // |keychain|, so the caller must make sure that the keychain outlives the 24 // |keychain|, so the caller must make sure that the keychain outlives the
24 // created object. 25 // created object.
25 explicit MacKeychainPasswordFormAdapter(const AppleKeychain* keychain); 26 explicit MacKeychainPasswordFormAdapter(const AppleKeychain* keychain);
26 27
27 // Returns PasswordForms for each keychain entry that could be used to fill 28 // Returns PasswordForms for each keychain entry that could be used to fill
28 // |form|. Caller is responsible for deleting the returned forms. 29 // |form|. Caller is responsible for deleting the returned forms.
29 std::vector<autofill::PasswordForm*> PasswordsFillingForm( 30 std::vector<autofill::PasswordForm*> PasswordsFillingForm(
30 const std::string& signon_realm, 31 const std::string& signon_realm,
31 autofill::PasswordForm::Scheme scheme); 32 autofill::PasswordForm::Scheme scheme);
32 33
33 // Returns the PasswordForm for the Keychain entry that matches |form| on all 34 // Returns the PasswordForm for the Keychain entry that matches |form| on all
34 // of the fields that uniquely identify a Keychain item, or NULL if there is 35 // of the fields that uniquely identify a Keychain item, or NULL if there is
35 // no such entry. 36 // no such entry.
36 // Caller is responsible for deleting the returned form. 37 scoped_ptr<autofill::PasswordForm> PasswordExactlyMatchingForm(
37 autofill::PasswordForm* PasswordExactlyMatchingForm(
38 const autofill::PasswordForm& query_form); 38 const autofill::PasswordForm& query_form);
39 39
40 // Returns true if the keychain contains any items that are mergeable with 40 // Returns true if the keychain contains any items that are mergeable with
41 // |query_form|. This is different from actually extracting the passwords 41 // |query_form|. This is different from actually extracting the passwords
42 // and checking the return count, since doing that would require reading the 42 // and checking the return count, since doing that would require reading the
43 // passwords from the keychain, thus potentially triggering authorizaiton UI, 43 // passwords from the keychain, thus potentially triggering authorizaiton UI,
44 // whereas this won't. 44 // whereas this won't.
45 bool HasPasswordsMergeableWithForm( 45 bool HasPasswordsMergeableWithForm(
46 const autofill::PasswordForm& query_form); 46 const autofill::PasswordForm& query_form);
47 47
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // in |item_form_pairs| that could be merged with |query_form|. 213 // in |item_form_pairs| that could be merged with |query_form|.
214 // Caller is responsible for deleting the returned forms. 214 // Caller is responsible for deleting the returned forms.
215 std::vector<autofill::PasswordForm*> ExtractPasswordsMergeableWithForm( 215 std::vector<autofill::PasswordForm*> ExtractPasswordsMergeableWithForm(
216 const AppleKeychain& keychain, 216 const AppleKeychain& keychain,
217 const std::vector<ItemFormPair>& item_form_pairs, 217 const std::vector<ItemFormPair>& item_form_pairs,
218 const autofill::PasswordForm& query_form); 218 const autofill::PasswordForm& query_form);
219 219
220 } // namespace internal_keychain_helpers 220 } // namespace internal_keychain_helpers
221 221
222 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_INTERNAL_H_ 222 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_INTERNAL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698