OLD | NEW |
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 CHROMEOS_CRYPTOHOME_SYSTEM_SALT_GETTER_H_ | 5 #ifndef CHROMEOS_CRYPTOHOME_SYSTEM_SALT_GETTER_H_ |
6 #define CHROMEOS_CRYPTOHOME_SYSTEM_SALT_GETTER_H_ | 6 #define CHROMEOS_CRYPTOHOME_SYSTEM_SALT_GETTER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 // Returns system hash in hex encoded ascii format. Note: this may return | 33 // Returns system hash in hex encoded ascii format. Note: this may return |
34 // an empty string (e.g. if cryptohome is not running). It is up to the | 34 // an empty string (e.g. if cryptohome is not running). It is up to the |
35 // calling function to try again after a delay if desired. | 35 // calling function to try again after a delay if desired. |
36 void GetSystemSalt(const GetSystemSaltCallback& callback); | 36 void GetSystemSalt(const GetSystemSaltCallback& callback); |
37 | 37 |
38 // Synchronous version of GetSystemSalt(). | 38 // Synchronous version of GetSystemSalt(). |
39 // Blocks the UI thread until the Cryptohome service returns the result. | 39 // Blocks the UI thread until the Cryptohome service returns the result. |
40 // DEPRECATED: DO NOT USE. | 40 // DEPRECATED: DO NOT USE. |
41 std::string GetSystemSaltSync(); | 41 std::string GetSystemSaltSync(); |
42 | 42 |
43 // Returns system hash in hex encoded ascii format, cached by a prior call | |
44 // to GetSystemSalt(). Note: this may return an empty string (e.g. if | |
45 // GetSystemSalt() is not yet called). | |
46 std::string GetCachedSystemSalt(); | |
47 | |
48 protected: | 43 protected: |
49 SystemSaltGetter(); | 44 SystemSaltGetter(); |
50 ~SystemSaltGetter(); | 45 ~SystemSaltGetter(); |
51 | 46 |
52 private: | 47 private: |
53 // Used to implement GetSystemSalt(). | 48 // Used to implement GetSystemSalt(). |
54 void GetSystemSaltInternal(const GetSystemSaltCallback& callback, | 49 void GetSystemSaltInternal(const GetSystemSaltCallback& callback, |
55 bool service_is_available); | 50 bool service_is_available); |
56 | 51 |
57 // Loads the system salt from cryptohome and caches it. | 52 // Loads the system salt from cryptohome and caches it. |
58 void LoadSystemSalt(); | 53 void LoadSystemSalt(); |
59 | 54 |
60 std::string system_salt_; | 55 std::string system_salt_; |
61 | 56 |
62 base::WeakPtrFactory<SystemSaltGetter> weak_ptr_factory_; | 57 base::WeakPtrFactory<SystemSaltGetter> weak_ptr_factory_; |
63 | 58 |
64 DISALLOW_COPY_AND_ASSIGN(SystemSaltGetter); | 59 DISALLOW_COPY_AND_ASSIGN(SystemSaltGetter); |
65 }; | 60 }; |
66 | 61 |
67 } // namespace chromeos | 62 } // namespace chromeos |
68 | 63 |
69 #endif // CHROMEOS_CRYPTOHOME_SYSTEM_SALT_GETTER_H_ | 64 #endif // CHROMEOS_CRYPTOHOME_SYSTEM_SALT_GETTER_H_ |
OLD | NEW |