OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_HOMEDIR_METHODS_H_ | 5 #ifndef CHROMEOS_CRYPTOHOME_HOMEDIR_METHODS_H_ |
6 #define CHROMEOS_CRYPTOHOME_HOMEDIR_METHODS_H_ | 6 #define CHROMEOS_CRYPTOHOME_HOMEDIR_METHODS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... | |
23 // Callbacks that are called back on the UI thread when the results of the | 23 // Callbacks that are called back on the UI thread when the results of the |
24 // respective method calls are ready. | 24 // respective method calls are ready. |
25 typedef base::Callback<void(bool success, MountError return_code)> Callback; | 25 typedef base::Callback<void(bool success, MountError return_code)> Callback; |
26 typedef base::Callback<void( | 26 typedef base::Callback<void( |
27 bool success, | 27 bool success, |
28 MountError return_code, | 28 MountError return_code, |
29 const std::vector<KeyDefinition>& key_definitions)> GetKeyDataCallback; | 29 const std::vector<KeyDefinition>& key_definitions)> GetKeyDataCallback; |
30 typedef base::Callback< | 30 typedef base::Callback< |
31 void(bool success, MountError return_code, const std::string& mount_hash)> | 31 void(bool success, MountError return_code, const std::string& mount_hash)> |
32 MountCallback; | 32 MountCallback; |
33 typedef base::Callback<void(bool success, int64_t size)> | |
Dan Beam
2016/06/30 23:24:09
nit: #include <stddef.h> for int64_t
fukino
2016/06/30 23:59:03
Done.
| |
34 GetAccountDiskUsageCallback; | |
33 | 35 |
34 virtual ~HomedirMethods() {} | 36 virtual ~HomedirMethods() {} |
35 | 37 |
36 // Asks cryptohomed to return data about the key identified by |label| for the | 38 // Asks cryptohomed to return data about the key identified by |label| for the |
37 // user identified by |id|. At present, this does not return any secret | 39 // user identified by |id|. At present, this does not return any secret |
38 // information and the request does not need to be authenticated. | 40 // information and the request does not need to be authenticated. |
39 virtual void GetKeyDataEx(const Identification& id, | 41 virtual void GetKeyDataEx(const Identification& id, |
40 const std::string& label, | 42 const std::string& label, |
41 const GetKeyDataCallback& callback) = 0; | 43 const GetKeyDataCallback& callback) = 0; |
42 | 44 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 const Authorization& auth, | 90 const Authorization& auth, |
89 const std::string& label, | 91 const std::string& label, |
90 const Callback& callback) = 0; | 92 const Callback& callback) = 0; |
91 | 93 |
92 // Asks cryptohomed to change cryptohome identification |id_from| to |id_to|, | 94 // Asks cryptohomed to change cryptohome identification |id_from| to |id_to|, |
93 // which results in cryptohome directory renaming. | 95 // which results in cryptohome directory renaming. |
94 virtual void RenameCryptohome(const Identification& id_from, | 96 virtual void RenameCryptohome(const Identification& id_from, |
95 const Identification& id_to, | 97 const Identification& id_to, |
96 const Callback& callback) = 0; | 98 const Callback& callback) = 0; |
97 | 99 |
100 // Asks cryptohomed to compute the size of cryptohome for user identified by | |
101 // |id|. | |
102 virtual void GetAccountDiskUsage( | |
103 const Identification& id, | |
104 const GetAccountDiskUsageCallback& callback) = 0; | |
105 | |
98 // Creates the global HomedirMethods instance. | 106 // Creates the global HomedirMethods instance. |
99 static void Initialize(); | 107 static void Initialize(); |
100 | 108 |
101 // Similar to Initialize(), but can inject an alternative | 109 // Similar to Initialize(), but can inject an alternative |
102 // HomedirMethods such as MockHomedirMethods for testing. | 110 // HomedirMethods such as MockHomedirMethods for testing. |
103 // The injected object will be owned by the internal pointer and deleted | 111 // The injected object will be owned by the internal pointer and deleted |
104 // by Shutdown(). | 112 // by Shutdown(). |
105 static void InitializeForTesting(HomedirMethods* homedir_methods); | 113 static void InitializeForTesting(HomedirMethods* homedir_methods); |
106 | 114 |
107 // Destroys the global HomedirMethods instance if it exists. | 115 // Destroys the global HomedirMethods instance if it exists. |
108 static void Shutdown(); | 116 static void Shutdown(); |
109 | 117 |
110 // Returns a pointer to the global HomedirMethods instance. | 118 // Returns a pointer to the global HomedirMethods instance. |
111 // Initialize() should already have been called. | 119 // Initialize() should already have been called. |
112 static HomedirMethods* GetInstance(); | 120 static HomedirMethods* GetInstance(); |
113 }; | 121 }; |
114 | 122 |
115 } // namespace cryptohome | 123 } // namespace cryptohome |
116 | 124 |
117 #endif // CHROMEOS_CRYPTOHOME_HOMEDIR_METHODS_H_ | 125 #endif // CHROMEOS_CRYPTOHOME_HOMEDIR_METHODS_H_ |
OLD | NEW |