Simple Cache: transactional index in subdirectory
[chromium-blink-merge.git] / chromeos / dbus / image_burner_client.h
blobc6f65ef05b9041d46587f0b404b079f87e0cc7dc
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.h"
14 #include "chromeos/dbus/dbus_client_implementation_type.h"
16 namespace chromeos {
18 // ImageBurnerClient is used to communicate with the image burner.
19 // All method should be called from the origin thread (UI thread) which
20 // initializes the DBusThreadManager instance.
21 class CHROMEOS_EXPORT ImageBurnerClient : public DBusClient {
22 public:
23 virtual ~ImageBurnerClient();
25 // A callback to be called when DBus method call fails.
26 typedef base::Callback<void()> ErrorCallback;
28 // A callback to handle burn_finished signal.
29 typedef base::Callback<void(const std::string& target_path,
30 bool success,
31 const std::string& error)> BurnFinishedHandler;
33 // A callback to handle burn_progress_update signal.
34 typedef base::Callback<void(const std::string& target_path,
35 int64 num_bytes_burnt,
36 int64 total_size)> BurnProgressUpdateHandler;
38 // Burns the image |from_path| to the disk |to_path|.
39 virtual void BurnImage(const std::string& from_path,
40 const std::string& to_path,
41 const ErrorCallback& error_callback) = 0;
43 // Sets callbacks as event handlers.
44 // |burn_finished_handler| is called when burn_finished signal is received.
45 // |burn_progress_update_handler| is called when burn_progress_update signal
46 // is received.
47 virtual void SetEventHandlers(
48 const BurnFinishedHandler& burn_finished_handler,
49 const BurnProgressUpdateHandler& burn_progress_update_handler) = 0;
51 // Resets event handlers. After calling this method, nothing is done when
52 // signals are received.
53 virtual void ResetEventHandlers() = 0;
55 // Factory function, creates a new instance and returns ownership.
56 // For normal usage, access the singleton via DBusThreadManager::Get().
57 static ImageBurnerClient* Create(DBusClientImplementationType type);
59 protected:
60 // Create() should be used instead.
61 ImageBurnerClient();
63 private:
64 DISALLOW_COPY_AND_ASSIGN(ImageBurnerClient);
67 } // namespace chromeos
69 #endif // CHROMEOS_DBUS_IMAGE_BURNER_CLIENT_H_