Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this image code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_UTILITY_IMAGE_WRITER_IMAGE_WRITER_HANDLER_H_ | |
| 6 #define CHROME_UTILITY_IMAGE_WRITER_IMAGE_WRITER_HANDLER_H_ | |
| 7 | |
| 8 #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.
| |
| 9 #include "chrome/utility/image_writer/image_writer.h" | |
| 10 #include "chrome/utility/utility_message_handler.h" | |
| 11 #include "ipc/ipc_message.h" | |
| 12 | |
| 13 namespace chrome { | |
| 14 namespace image_writer { | |
| 15 | |
| 16 // A handler for messages related to writing images. This class is added as a | |
| 17 // handler in |chrome::ChromeContentUtilityClient. | |
|
Lei Zhang
2014/02/15 00:49:16
nit: remove '|'
Drew Haven
2014/02/15 01:23:58
Done.
| |
| 18 class ImageWriterHandler : public UtilityMessageHandler { | |
| 19 public: | |
| 20 ImageWriterHandler(); | |
| 21 virtual ~ImageWriterHandler(); | |
| 22 | |
| 23 // Methods for sending the different messages back to the browser process. | |
| 24 // Generally should be called by chrome::image_writer::ImageWriter. | |
| 25 virtual void SendSucceeded(); | |
| 26 virtual void SendCancelled(); | |
| 27 virtual void SendFailed(const std::string& message); | |
| 28 virtual void SendProgress(int64 progress); | |
| 29 | |
| 30 private: | |
| 31 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
| 32 | |
| 33 // 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.
| |
| 34 void Send(IPC::Message* msg); | |
| 35 | |
| 36 // Message handlers. | |
| 37 void OnWriteStart(const base::FilePath& image, const base::FilePath& device); | |
| 38 void OnVerifyStart(const base::FilePath& image, const base::FilePath& device); | |
| 39 void OnCancel(); | |
| 40 | |
| 41 // Checks if a path is a valid target device. | |
| 42 bool IsValidDevice(const base::FilePath& device); | |
| 43 | |
| 44 ImageWriter image_writer_; | |
| 45 }; | |
| 46 | |
| 47 } // namespace image_writer | |
| 48 } // namespace chrome | |
| 49 | |
| 50 #endif // CHROME_UTILITY_IMAGE_WRITER_IMAGE_WRITER_HANDLER_H_ | |
| OLD | NEW |