| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 typedef base::Callback<void(bool success, MountError return_code)> Callback; | 27 typedef base::Callback<void(bool success, MountError return_code)> Callback; |
| 28 typedef base::Callback<void( | 28 typedef base::Callback<void( |
| 29 bool success, | 29 bool success, |
| 30 MountError return_code, | 30 MountError return_code, |
| 31 const std::vector<KeyDefinition>& key_definitions)> GetKeyDataCallback; | 31 const std::vector<KeyDefinition>& key_definitions)> GetKeyDataCallback; |
| 32 typedef base::Callback< | 32 typedef base::Callback< |
| 33 void(bool success, MountError return_code, const std::string& mount_hash)> | 33 void(bool success, MountError return_code, const std::string& mount_hash)> |
| 34 MountCallback; | 34 MountCallback; |
| 35 typedef base::Callback<void(bool success, int64_t size)> | 35 typedef base::Callback<void(bool success, int64_t size)> |
| 36 GetAccountDiskUsageCallback; | 36 GetAccountDiskUsageCallback; |
| 37 typedef base::Callback<void(bool success)> DBusResultCallback; |
| 37 | 38 |
| 38 virtual ~HomedirMethods() {} | 39 virtual ~HomedirMethods() {} |
| 39 | 40 |
| 40 // Asks cryptohomed to return data about the key identified by |label| for the | 41 // Asks cryptohomed to return data about the key identified by |label| for the |
| 41 // user identified by |id|. At present, this does not return any secret | 42 // user identified by |id|. At present, this does not return any secret |
| 42 // information and the request does not need to be authenticated. | 43 // information and the request does not need to be authenticated. |
| 43 virtual void GetKeyDataEx(const Identification& id, | 44 virtual void GetKeyDataEx(const Identification& id, |
| 44 const std::string& label, | 45 const std::string& label, |
| 45 const GetKeyDataCallback& callback) = 0; | 46 const GetKeyDataCallback& callback) = 0; |
| 46 | 47 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 virtual void RenameCryptohome(const Identification& id_from, | 99 virtual void RenameCryptohome(const Identification& id_from, |
| 99 const Identification& id_to, | 100 const Identification& id_to, |
| 100 const Callback& callback) = 0; | 101 const Callback& callback) = 0; |
| 101 | 102 |
| 102 // Asks cryptohomed to compute the size of cryptohome for user identified by | 103 // Asks cryptohomed to compute the size of cryptohome for user identified by |
| 103 // |id|. | 104 // |id|. |
| 104 virtual void GetAccountDiskUsage( | 105 virtual void GetAccountDiskUsage( |
| 105 const Identification& id, | 106 const Identification& id, |
| 106 const GetAccountDiskUsageCallback& callback) = 0; | 107 const GetAccountDiskUsageCallback& callback) = 0; |
| 107 | 108 |
| 109 // Asks cryptohomed to migrate the cryptohome to the new encryption method |
| 110 // for the user specified by |id|, using |auth| to unlock the key. |
| 111 virtual void MigrateToDircrypto(const Identification& id, |
| 112 const Authorization& auth, |
| 113 const DBusResultCallback& callback) = 0; |
| 114 |
| 108 // Creates the global HomedirMethods instance. | 115 // Creates the global HomedirMethods instance. |
| 109 static void Initialize(); | 116 static void Initialize(); |
| 110 | 117 |
| 111 // Similar to Initialize(), but can inject an alternative | 118 // Similar to Initialize(), but can inject an alternative |
| 112 // HomedirMethods such as MockHomedirMethods for testing. | 119 // HomedirMethods such as MockHomedirMethods for testing. |
| 113 // The injected object will be owned by the internal pointer and deleted | 120 // The injected object will be owned by the internal pointer and deleted |
| 114 // by Shutdown(). | 121 // by Shutdown(). |
| 115 static void InitializeForTesting(HomedirMethods* homedir_methods); | 122 static void InitializeForTesting(HomedirMethods* homedir_methods); |
| 116 | 123 |
| 117 // Destroys the global HomedirMethods instance if it exists. | 124 // Destroys the global HomedirMethods instance if it exists. |
| 118 static void Shutdown(); | 125 static void Shutdown(); |
| 119 | 126 |
| 120 // Returns a pointer to the global HomedirMethods instance. | 127 // Returns a pointer to the global HomedirMethods instance. |
| 121 // Initialize() should already have been called. | 128 // Initialize() should already have been called. |
| 122 static HomedirMethods* GetInstance(); | 129 static HomedirMethods* GetInstance(); |
| 123 }; | 130 }; |
| 124 | 131 |
| 125 } // namespace cryptohome | 132 } // namespace cryptohome |
| 126 | 133 |
| 127 #endif // CHROMEOS_CRYPTOHOME_HOMEDIR_METHODS_H_ | 134 #endif // CHROMEOS_CRYPTOHOME_HOMEDIR_METHODS_H_ |
| OLD | NEW |