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

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

Issue 2318303002: Remove stl_util's STLDeleteContainerPairSecondPointers. (Closed)
Patch Set: fix 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
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>
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 autofill::PasswordForm::Scheme scheme, 84 autofill::PasswordForm::Scheme scheme,
85 const char* path, 85 const char* path,
86 const char* username); 86 const char* username);
87 87
88 // Returns the Keychain SecAuthenticationType type corresponding to |scheme|. 88 // Returns the Keychain SecAuthenticationType type corresponding to |scheme|.
89 SecAuthenticationType AuthTypeForScheme( 89 SecAuthenticationType AuthTypeForScheme(
90 autofill::PasswordForm::Scheme scheme); 90 autofill::PasswordForm::Scheme scheme);
91 91
92 // Changes the password for keychain_item to |password|; returns true if the 92 // Changes the password for keychain_item to |password|; returns true if the
93 // password was successfully changed. 93 // password was successfully changed.
94 bool SetKeychainItemPassword(const SecKeychainItemRef& keychain_item, 94 bool SetKeychainItemPassword(SecKeychainItemRef keychain_item,
95 const std::string& password); 95 const std::string& password);
96 96
97 // Sets the creator code of keychain_item to creator_code; returns true if the 97 // Sets the creator code of keychain_item to creator_code; returns true if the
98 // creator code was successfully set. 98 // creator code was successfully set.
99 bool SetKeychainItemCreatorCode(const SecKeychainItemRef& keychain_item, 99 bool SetKeychainItemCreatorCode(SecKeychainItemRef keychain_item,
100 OSType creator_code); 100 OSType creator_code);
101 101
102 // Returns the creator code to be used for a Keychain search, depending on 102 // Returns the creator code to be used for a Keychain search, depending on
103 // whether this object was instructed to search only for items it created. 103 // whether this object was instructed to search only for items it created.
104 // If searches should be restricted in this way, the application-specific 104 // If searches should be restricted in this way, the application-specific
105 // creator code will be returned. Otherwise, 0 will be returned, indicating 105 // creator code will be returned. Otherwise, 0 will be returned, indicating
106 // a search of all items, regardless of creator. 106 // a search of all items, regardless of creator.
107 OSType CreatorCodeForSearch(); 107 OSType CreatorCodeForSearch();
108 108
109 const AppleKeychain* keychain_; 109 const AppleKeychain* keychain_;
110 110
111 // If true, Keychain searches are restricted to items created by Chrome. 111 // If true, Keychain searches are restricted to items created by Chrome.
112 bool finds_only_owned_; 112 bool finds_only_owned_;
113 113
114 DISALLOW_COPY_AND_ASSIGN(MacKeychainPasswordFormAdapter); 114 DISALLOW_COPY_AND_ASSIGN(MacKeychainPasswordFormAdapter);
115 }; 115 };
116 116
117 namespace internal_keychain_helpers { 117 namespace internal_keychain_helpers {
118 118
119 // Pair of pointers to a SecKeychainItemRef and a corresponding PasswordForm. 119 // Pair of pointers to a SecKeychainItemRef and a corresponding PasswordForm.
120 typedef std::pair<SecKeychainItemRef*, autofill::PasswordForm*> ItemFormPair; 120 typedef std::pair<SecKeychainItemRef, std::unique_ptr<autofill::PasswordForm>>
121 ItemFormPair;
121 122
122 // Sets the fields of |form| based on the keychain data from |keychain_item|. 123 // Sets the fields of |form| based on the keychain data from |keychain_item|.
123 // Fields that can't be determined from |keychain_item| will be unchanged. If 124 // Fields that can't be determined from |keychain_item| will be unchanged. If
124 // |extract_password_data| is true, the password data will be copied from 125 // |extract_password_data| is true, the password data will be copied from
125 // |keychain_item| in addition to its attributes, and the |blacklisted_by_user| 126 // |keychain_item| in addition to its attributes, and the |blacklisted_by_user|
126 // field will be set to true for empty passwords ("" or " "). 127 // field will be set to true for empty passwords ("" or " ").
127 // If |extract_password_data| is false, only the password attributes will be 128 // If |extract_password_data| is false, only the password attributes will be
128 // copied, and the |blacklisted_by_user| field will always be false. 129 // copied, and the |blacklisted_by_user| field will always be false.
129 // 130 //
130 // IMPORTANT: If |extract_password_data| is true, this function can cause the OS 131 // IMPORTANT: If |extract_password_data| is true, this function can cause the OS
131 // to trigger UI (to allow access to the keychain item if we aren't trusted for 132 // to trigger UI (to allow access to the keychain item if we aren't trusted for
132 // the item), and block until the UI is dismissed. 133 // the item), and block until the UI is dismissed.
133 // 134 //
134 // If excessive prompting for access to other applications' keychain items 135 // If excessive prompting for access to other applications' keychain items
135 // becomes an issue, the password storage API will need to intially call this 136 // becomes an issue, the password storage API will need to intially call this
136 // function with |extract_password_data| set to false, and retrieve the password 137 // function with |extract_password_data| set to false, and retrieve the password
137 // later (accessing other fields doesn't require authorization). 138 // later (accessing other fields doesn't require authorization).
138 bool FillPasswordFormFromKeychainItem(const AppleKeychain& keychain, 139 bool FillPasswordFormFromKeychainItem(const AppleKeychain& keychain,
139 const SecKeychainItemRef& keychain_item, 140 SecKeychainItemRef keychain_item,
140 autofill::PasswordForm* form, 141 autofill::PasswordForm* form,
141 bool extract_password_data); 142 bool extract_password_data);
142 143
143 // Returns true if |keychain_item| has the application-specific creator code in 144 // Returns true if |keychain_item| has the application-specific creator code in
144 // its attributes. 145 // its attributes.
145 bool HasCreatorCode(const AppleKeychain& keychain, 146 bool HasCreatorCode(const AppleKeychain& keychain,
146 const SecKeychainItemRef& keychain_item); 147 SecKeychainItemRef keychain_item);
147 148
148 // Use FormMatchStrictness to configure which forms are considered a match by 149 // Use FormMatchStrictness to configure which forms are considered a match by
149 // FormsMatchForMerge: 150 // FormsMatchForMerge:
150 enum FormMatchStrictness { 151 enum FormMatchStrictness {
151 STRICT_FORM_MATCH, // Match only forms with the same scheme, signon realm and 152 STRICT_FORM_MATCH, // Match only forms with the same scheme, signon realm and
152 // username value. 153 // username value.
153 FUZZY_FORM_MATCH, // Also match cases where the first form's 154 FUZZY_FORM_MATCH, // Also match cases where the first form's
154 // original_signon_realm is nonempty and matches the 155 // original_signon_realm is nonempty and matches the
155 // second form's signon_realm. 156 // second form's signon_realm.
156 }; 157 };
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // Returns PasswordForm instances populated with password data for each keychain 214 // Returns PasswordForm instances populated with password data for each keychain
214 // entry in |item_form_pairs| that could be merged with |query_form|. 215 // entry in |item_form_pairs| that could be merged with |query_form|.
215 ScopedVector<autofill::PasswordForm> ExtractPasswordsMergeableWithForm( 216 ScopedVector<autofill::PasswordForm> ExtractPasswordsMergeableWithForm(
216 const AppleKeychain& keychain, 217 const AppleKeychain& keychain,
217 const std::vector<ItemFormPair>& item_form_pairs, 218 const std::vector<ItemFormPair>& item_form_pairs,
218 const autofill::PasswordForm& query_form); 219 const autofill::PasswordForm& query_form);
219 220
220 } // namespace internal_keychain_helpers 221 } // namespace internal_keychain_helpers
221 222
222 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_INTERNAL_H_ 223 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_INTERNAL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698