Chromium Code Reviews| 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 // Calls KeychainReauthorize, but only if it's determined that it's necessary. | |
|
Mark Mentovai
2017/03/02 02:59:32
KeychainReauthorize is a hidden function, an imple
Greg K
2017/03/02 18:54:14
Done.
| |
| 17 // pref_key is looked up in the system's standard user defaults (preferences) | |
| 18 // and if its integer value is less than max_tries, KeychainReauthorize is | |
| 19 // attempted. Before the attempt, the preference is incremented, allowing a | |
| 20 // finite number of incomplete attempts at performing the KeychainReauthorize | |
| 21 // operation. When the step completes successfully, the preference is set to | |
| 22 // max_tries to prevent further attempts, and the preference name with the | |
|
Mark Mentovai
2017/03/02 02:59:32
It doesn’t set it to max_tries, it just sets the s
Greg K
2017/03/02 18:54:14
Done.
| |
| 23 // word "Success" appended is also stored with a boolean value of YES, | |
| 24 // disambiguating between the cases where the step completed successfully and | |
| 25 // the step completed unsuccessfully while reaching the maximum number of | |
| 26 // tries. | |
| 27 // | |
| 28 // The system's standard user defaults for the application are used | |
| 29 // (~/Library/Preferences/com.google.Chrome.plist, | |
| 30 // com.google.Chrome.canary.plist, etc.) instead of Chrome preferences because | |
| 31 // Keychain access is tied more closely to the bundle identifier and signed | |
| 32 // product than it is to any specific profile (--user-data-dir). | |
| 33 void KeychainReauthorizeIfNeeded(NSString* pref_key, int max_tries); | |
| 34 | |
| 35 } // namespace chrome | |
| 36 | |
| 37 #endif // CHROME_BROWSER_MAC_KEYCHAIN_REAUTHORIZE_H_ | |
| OLD | NEW |