OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_MAC_KEYCHAIN_REAUTHORIZE_H_ |
| 6 #define CHROME_BROWSER_MAC_KEYCHAIN_REAUTHORIZE_H_ |
| 7 |
| 8 #ifdef __OBJC__ |
| 9 @class NSString; |
| 10 #else |
| 11 class NSString; |
| 12 #endif |
| 13 |
| 14 namespace chrome { |
| 15 |
| 16 // Reauthorizes the keychain entry, but only if it's determined that it's |
| 17 // necessary. pref_key is looked up in the system's standard user defaults |
| 18 // (preferences) and it is associated with both the number of previous attempts, |
| 19 // and whether a previous attempt succeeded. Only if a previous attempt did not |
| 20 // succeed, and the number of previous tries is less than max_tries, is |
| 21 // reauthorization attempted. Before the attempt, the preference is |
| 22 // incremented, allowing a finite number of incomplete attempts at performing |
| 23 // the operation. |
| 24 |
| 25 // The system's standard user defaults for the application are used |
| 26 // (~/Library/Preferences/com.google.Chrome.plist, |
| 27 // com.google.Chrome.canary.plist, etc.) instead of Chrome preferences because |
| 28 // Keychain access is tied more closely to the bundle identifier and signed |
| 29 // product than it is to any specific profile (--user-data-dir). |
| 30 void KeychainReauthorizeIfNeeded(NSString* pref_key, int max_tries); |
| 31 |
| 32 } // namespace chrome |
| 33 |
| 34 #endif // CHROME_BROWSER_MAC_KEYCHAIN_REAUTHORIZE_H_ |
OLD | NEW |