Index: chrome/utility/image_writer/image_writer_handler.h |
diff --git a/chrome/utility/image_writer/image_writer_handler.h b/chrome/utility/image_writer/image_writer_handler.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a3683774a3351fb018bd0415b560566436c01ec7 |
--- /dev/null |
+++ b/chrome/utility/image_writer/image_writer_handler.h |
@@ -0,0 +1,50 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this image code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_UTILITY_IMAGE_WRITER_IMAGE_WRITER_HANDLER_H_ |
+#define CHROME_UTILITY_IMAGE_WRITER_IMAGE_WRITER_HANDLER_H_ |
+ |
+#include "base/files/file_path.h" |
Lei Zhang
2014/02/15 00:49:16
nit: forward declare instead, move #include to .cc
Drew Haven
2014/02/15 01:23:58
Done.
|
+#include "chrome/utility/image_writer/image_writer.h" |
+#include "chrome/utility/utility_message_handler.h" |
+#include "ipc/ipc_message.h" |
+ |
+namespace chrome { |
+namespace image_writer { |
+ |
+// A handler for messages related to writing images. This class is added as a |
+// handler in |chrome::ChromeContentUtilityClient. |
Lei Zhang
2014/02/15 00:49:16
nit: remove '|'
Drew Haven
2014/02/15 01:23:58
Done.
|
+class ImageWriterHandler : public UtilityMessageHandler { |
+ public: |
+ ImageWriterHandler(); |
+ virtual ~ImageWriterHandler(); |
+ |
+ // Methods for sending the different messages back to the browser process. |
+ // Generally should be called by chrome::image_writer::ImageWriter. |
+ virtual void SendSucceeded(); |
+ virtual void SendCancelled(); |
+ virtual void SendFailed(const std::string& message); |
+ virtual void SendProgress(int64 progress); |
+ |
+ private: |
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
+ |
+ // Small wrapper for sendingon the UtilityProcess. |
Lei Zhang
2014/02/15 00:49:16
nit: sendingon -> sending on
Drew Haven
2014/02/15 01:23:58
Done.
|
+ void Send(IPC::Message* msg); |
+ |
+ // Message handlers. |
+ void OnWriteStart(const base::FilePath& image, const base::FilePath& device); |
+ void OnVerifyStart(const base::FilePath& image, const base::FilePath& device); |
+ void OnCancel(); |
+ |
+ // Checks if a path is a valid target device. |
+ bool IsValidDevice(const base::FilePath& device); |
+ |
+ ImageWriter image_writer_; |
+}; |
+ |
+} // namespace image_writer |
+} // namespace chrome |
+ |
+#endif // CHROME_UTILITY_IMAGE_WRITER_IMAGE_WRITER_HANDLER_H_ |