| 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 CHROME_BROWSER_CHROMEOS_CRYPTOHOME_ASYNC_METHOD_CALLER_H_ | 5 #ifndef CHROMEOS_CRYPTOHOME_ASYNC_METHOD_CALLER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_CRYPTOHOME_ASYNC_METHOD_CALLER_H_ | 6 #define CHROMEOS_CRYPTOHOME_ASYNC_METHOD_CALLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback_forward.h" |
| 11 #include "chromeos/chromeos_export.h" |
| 11 #include "third_party/cros_system_api/dbus/service_constants.h" | 12 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 12 | 13 |
| 13 namespace cryptohome { | 14 namespace cryptohome { |
| 14 | 15 |
| 15 // This class manages calls to Cryptohome service's 'async' methods. | 16 // This class manages calls to Cryptohome service's 'async' methods. |
| 16 // Note: This class is placed in ::cryptohome instead of ::chromeos::cryptohome | 17 // Note: This class is placed in ::cryptohome instead of ::chromeos::cryptohome |
| 17 // since there is already a namespace ::cryptohome which holds the error code | 18 // since there is already a namespace ::cryptohome which holds the error code |
| 18 // enum (MountError) and referencing ::chromeos::cryptohome and ::cryptohome | 19 // enum (MountError) and referencing ::chromeos::cryptohome and ::cryptohome |
| 19 // within the same code is confusing. | 20 // within the same code is confusing. |
| 20 class AsyncMethodCaller { | 21 class CHROMEOS_EXPORT AsyncMethodCaller { |
| 21 public: | 22 public: |
| 22 // A callback type which is called back on the UI thread when the results of | 23 // A callback type which is called back on the UI thread when the results of |
| 23 // method calls are ready. | 24 // method calls are ready. |
| 24 typedef base::Callback<void(bool success, MountError return_code)> Callback; | 25 typedef base::Callback<void(bool success, MountError return_code)> Callback; |
| 25 | 26 |
| 26 virtual ~AsyncMethodCaller() {} | 27 virtual ~AsyncMethodCaller() {} |
| 27 | 28 |
| 28 // Asks cryptohomed to asynchronously try to find the cryptohome for | 29 // Asks cryptohomed to asynchronously try to find the cryptohome for |
| 29 // |user_email| and then use |passhash| to unlock the key. | 30 // |user_email| and then use |passhash| to unlock the key. |
| 30 // |callback| will be called with status info on completion. | 31 // |callback| will be called with status info on completion. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // Destroys the global AsyncMethodCaller instance if it exists. | 77 // Destroys the global AsyncMethodCaller instance if it exists. |
| 77 static void Shutdown(); | 78 static void Shutdown(); |
| 78 | 79 |
| 79 // Returns a pointer to the global AsyncMethodCaller instance. | 80 // Returns a pointer to the global AsyncMethodCaller instance. |
| 80 // Initialize() should already have been called. | 81 // Initialize() should already have been called. |
| 81 static AsyncMethodCaller* GetInstance(); | 82 static AsyncMethodCaller* GetInstance(); |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 } // namespace cryptohome | 85 } // namespace cryptohome |
| 85 | 86 |
| 86 #endif // CHROME_BROWSER_CHROMEOS_CRYPTOHOME_ASYNC_METHOD_CALLER_H_ | 87 #endif // CHROMEOS_CRYPTOHOME_ASYNC_METHOD_CALLER_H_ |
| OLD | NEW |