| 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 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/memory/scoped_vector.h" |
| 12 #include "chromeos/chromeos_export.h" | 13 #include "chromeos/chromeos_export.h" |
| 13 #include "chromeos/cryptohome/cryptohome_parameters.h" | 14 #include "chromeos/cryptohome/cryptohome_parameters.h" |
| 14 #include "chromeos/dbus/cryptohome_client.h" | 15 #include "chromeos/dbus/cryptohome_client.h" |
| 15 #include "third_party/cros_system_api/dbus/service_constants.h" | 16 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 16 | 17 |
| 17 namespace cryptohome { | 18 namespace cryptohome { |
| 19 |
| 18 // This class manages calls to Cryptohome service's home directory methods: | 20 // This class manages calls to Cryptohome service's home directory methods: |
| 19 // Mount, CheckKey, Add/UpdateKey. | 21 // Mount, CheckKey, Add/UpdateKey. |
| 20 class CHROMEOS_EXPORT HomedirMethods { | 22 class CHROMEOS_EXPORT HomedirMethods { |
| 21 public: | 23 public: |
| 22 // A callback type which is called back on the UI thread when the results of | 24 // Callbacks that are called back on the UI thread when the results of the |
| 23 // method calls are ready. | 25 // respective method calls are ready. |
| 24 typedef base::Callback<void(bool success, MountError return_code)> Callback; | 26 typedef base::Callback<void(bool success, MountError return_code)> Callback; |
| 27 typedef base::Callback<void( |
| 28 bool success, |
| 29 MountError return_code, |
| 30 ScopedVector<RetrievedKeyData> key_data)> GetKeyDataCallback; |
| 25 typedef base::Callback< | 31 typedef base::Callback< |
| 26 void(bool success, MountError return_code, const std::string& mount_hash)> | 32 void(bool success, MountError return_code, const std::string& mount_hash)> |
| 27 MountCallback; | 33 MountCallback; |
| 28 | 34 |
| 29 virtual ~HomedirMethods() {} | 35 virtual ~HomedirMethods() {} |
| 30 | 36 |
| 37 // Asks cryptohomed to return data about the key identified by |label| for the |
| 38 // user identified by |id|. At present, this does not return any secret |
| 39 // information and the request does not need to be authenticated. |
| 40 virtual void GetKeyDataEx(const Identification& id, |
| 41 const std::string& label, |
| 42 const GetKeyDataCallback& callback) = 0; |
| 43 |
| 31 // Asks cryptohomed to attempt authorization for user identified by |id| using | 44 // Asks cryptohomed to attempt authorization for user identified by |id| using |
| 32 // |auth|. This can be used to unlock a user session. | 45 // |auth|. This can be used to unlock a user session. |
| 33 virtual void CheckKeyEx(const Identification& id, | 46 virtual void CheckKeyEx(const Identification& id, |
| 34 const Authorization& auth, | 47 const Authorization& auth, |
| 35 const Callback& callback) = 0; | 48 const Callback& callback) = 0; |
| 36 | 49 |
| 37 // Asks cryptohomed to find the cryptohome for user identified by |id| and | 50 // Asks cryptohomed to find the cryptohome for user identified by |id| and |
| 38 // then mount it using |auth| to unlock the key. | 51 // then mount it using |auth| to unlock the key. |
| 39 // If the |create_keys| are not given and no cryptohome exists for |id|, | 52 // If the |create_keys| are not given and no cryptohome exists for |id|, |
| 40 // the expected result is | 53 // the expected result is |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 static void Shutdown(); | 103 static void Shutdown(); |
| 91 | 104 |
| 92 // Returns a pointer to the global HomedirMethods instance. | 105 // Returns a pointer to the global HomedirMethods instance. |
| 93 // Initialize() should already have been called. | 106 // Initialize() should already have been called. |
| 94 static HomedirMethods* GetInstance(); | 107 static HomedirMethods* GetInstance(); |
| 95 }; | 108 }; |
| 96 | 109 |
| 97 } // namespace cryptohome | 110 } // namespace cryptohome |
| 98 | 111 |
| 99 #endif // CHROMEOS_CRYPTOHOME_HOMEDIR_METHODS_H_ | 112 #endif // CHROMEOS_CRYPTOHOME_HOMEDIR_METHODS_H_ |
| OLD | NEW |