Roll src/third_party/WebKit f298044:aa8346d (svn 202628:202629)
[chromium-blink-merge.git] / components / os_crypt / keychain_password_mac.h
blobf044f04e3e1f6018f4258047458373ee60415075
1 // Copyright 2014 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.
5 #ifndef COMPONENTS_OS_CRYPT_KEYCHAIN_PASSWORD_MAC_H_
6 #define COMPONENTS_OS_CRYPT_KEYCHAIN_PASSWORD_MAC_H_
8 #include <string>
10 #include "base/macros.h"
12 namespace crypto {
13 class AppleKeychain;
16 class KeychainPassword {
17 public:
18 explicit KeychainPassword(const crypto::AppleKeychain& keychain)
19 : keychain_(keychain) {
22 // Get the OSCrypt password for this system. If no password exists
23 // in the Keychain then one is generated, stored in the Mac keychain, and
24 // returned.
25 // If one exists then it is fetched from the Keychain and returned.
26 // If the user disallows access to the Keychain (or an error occurs) then an
27 // empty string is returned.
28 std::string GetPassword() const;
30 private:
31 const crypto::AppleKeychain& keychain_;
33 DISALLOW_COPY_AND_ASSIGN(KeychainPassword);
36 #endif // COMPONENTS_OS_CRYPT_KEYCHAIN_PASSWORD_MAC_H_