Fix a type mismatch on Windows caused by r201738.
[chromium-blink-merge.git] / chromeos / dbus / image_burner_client.h
blob053b4306e6b8adfc58f4bdd6de6f0ce4b10f40a3
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
3 // found in the LICENSE file.
5 #ifndef CHROMEOS_DBUS_IMAGE_BURNER_CLIENT_H_
6 #define CHROMEOS_DBUS_IMAGE_BURNER_CLIENT_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/callback.h"
12 #include "chromeos/chromeos_export.h"
13 #include "chromeos/dbus/dbus_client_implementation_type.h"
15 namespace dbus {
16 class Bus;
19 namespace chromeos {
21 // ImageBurnerClient is used to communicate with the image burner.
22 // All method should be called from the origin thread (UI thread) which
23 // initializes the DBusThreadManager instance.
24 class CHROMEOS_EXPORT ImageBurnerClient {
25 public:
26 virtual ~ImageBurnerClient();
28 // A callback to be called when DBus method call fails.
29 typedef base::Callback<void()> ErrorCallback;
31 // A callback to handle burn_finished signal.
32 typedef base::Callback<void(const std::string& target_path,
33 bool success,
34 const std::string& error)> BurnFinishedHandler;
36 // A callback to handle burn_progress_update signal.
37 typedef base::Callback<void(const std::string& target_path,
38 int64 num_bytes_burnt,
39 int64 total_size)> BurnProgressUpdateHandler;
41 // Burns the image |from_path| to the disk |to_path|.
42 virtual void BurnImage(const std::string& from_path,
43 const std::string& to_path,
44 const ErrorCallback& error_callback) = 0;
46 // Sets callbacks as event handlers.
47 // |burn_finished_handler| is called when burn_finished signal is received.
48 // |burn_progress_update_handler| is called when burn_progress_update signal
49 // is received.
50 virtual void SetEventHandlers(
51 const BurnFinishedHandler& burn_finished_handler,
52 const BurnProgressUpdateHandler& burn_progress_update_handler) = 0;
54 // Resets event handlers. After calling this method, nothing is done when
55 // signals are received.
56 virtual void ResetEventHandlers() = 0;
58 // Factory function, creates a new instance and returns ownership.
59 // For normal usage, access the singleton via DBusThreadManager::Get().
60 static ImageBurnerClient* Create(DBusClientImplementationType type,
61 dbus::Bus* bus);
63 protected:
64 // Create() should be used instead.
65 ImageBurnerClient();
67 private:
68 DISALLOW_COPY_AND_ASSIGN(ImageBurnerClient);
71 } // namespace chromeos
73 #endif // CHROMEOS_DBUS_IMAGE_BURNER_CLIENT_H_