| 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_DBUS_IMAGE_BURNER_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_IMAGE_BURNER_CLIENT_H_ |
| 6 #define CHROMEOS_DBUS_IMAGE_BURNER_CLIENT_H_ | 6 #define CHROMEOS_DBUS_IMAGE_BURNER_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <string> | 10 #include <string> |
| 9 | 11 |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/macros.h" |
| 12 #include "chromeos/chromeos_export.h" | 14 #include "chromeos/chromeos_export.h" |
| 13 #include "chromeos/dbus/dbus_client.h" | 15 #include "chromeos/dbus/dbus_client.h" |
| 14 | 16 |
| 15 namespace chromeos { | 17 namespace chromeos { |
| 16 | 18 |
| 17 // ImageBurnerClient is used to communicate with the image burner. | 19 // ImageBurnerClient is used to communicate with the image burner. |
| 18 // All method should be called from the origin thread (UI thread) which | 20 // All method should be called from the origin thread (UI thread) which |
| 19 // initializes the DBusThreadManager instance. | 21 // initializes the DBusThreadManager instance. |
| 20 class CHROMEOS_EXPORT ImageBurnerClient : public DBusClient { | 22 class CHROMEOS_EXPORT ImageBurnerClient : public DBusClient { |
| 21 public: | 23 public: |
| 22 ~ImageBurnerClient() override; | 24 ~ImageBurnerClient() override; |
| 23 | 25 |
| 24 // A callback to be called when DBus method call fails. | 26 // A callback to be called when DBus method call fails. |
| 25 typedef base::Callback<void()> ErrorCallback; | 27 typedef base::Callback<void()> ErrorCallback; |
| 26 | 28 |
| 27 // A callback to handle burn_finished signal. | 29 // A callback to handle burn_finished signal. |
| 28 typedef base::Callback<void(const std::string& target_path, | 30 typedef base::Callback<void(const std::string& target_path, |
| 29 bool success, | 31 bool success, |
| 30 const std::string& error)> BurnFinishedHandler; | 32 const std::string& error)> BurnFinishedHandler; |
| 31 | 33 |
| 32 // A callback to handle burn_progress_update signal. | 34 // A callback to handle burn_progress_update signal. |
| 33 typedef base::Callback<void(const std::string& target_path, | 35 typedef base::Callback<void(const std::string& target_path, |
| 34 int64 num_bytes_burnt, | 36 int64_t num_bytes_burnt, |
| 35 int64 total_size)> BurnProgressUpdateHandler; | 37 int64_t total_size)> BurnProgressUpdateHandler; |
| 36 | 38 |
| 37 // Burns the image |from_path| to the disk |to_path|. | 39 // Burns the image |from_path| to the disk |to_path|. |
| 38 virtual void BurnImage(const std::string& from_path, | 40 virtual void BurnImage(const std::string& from_path, |
| 39 const std::string& to_path, | 41 const std::string& to_path, |
| 40 const ErrorCallback& error_callback) = 0; | 42 const ErrorCallback& error_callback) = 0; |
| 41 | 43 |
| 42 // Sets callbacks as event handlers. | 44 // Sets callbacks as event handlers. |
| 43 // |burn_finished_handler| is called when burn_finished signal is received. | 45 // |burn_finished_handler| is called when burn_finished signal is received. |
| 44 // |burn_progress_update_handler| is called when burn_progress_update signal | 46 // |burn_progress_update_handler| is called when burn_progress_update signal |
| 45 // is received. | 47 // is received. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 59 // Create() should be used instead. | 61 // Create() should be used instead. |
| 60 ImageBurnerClient(); | 62 ImageBurnerClient(); |
| 61 | 63 |
| 62 private: | 64 private: |
| 63 DISALLOW_COPY_AND_ASSIGN(ImageBurnerClient); | 65 DISALLOW_COPY_AND_ASSIGN(ImageBurnerClient); |
| 64 }; | 66 }; |
| 65 | 67 |
| 66 } // namespace chromeos | 68 } // namespace chromeos |
| 67 | 69 |
| 68 #endif // CHROMEOS_DBUS_IMAGE_BURNER_CLIENT_H_ | 70 #endif // CHROMEOS_DBUS_IMAGE_BURNER_CLIENT_H_ |
| OLD | NEW |