OLD | NEW |
| (Empty) |
1 // Copyright 2014 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. | |
4 | |
5 #ifndef CHROME_UTILITY_IMAGE_WRITER_IMAGE_WRITER_HANDLER_H_ | |
6 #define CHROME_UTILITY_IMAGE_WRITER_IMAGE_WRITER_HANDLER_H_ | |
7 | |
8 #include "chrome/utility/image_writer/image_writer.h" | |
9 #include "chrome/utility/utility_message_handler.h" | |
10 #include "ipc/ipc_message.h" | |
11 | |
12 namespace base { | |
13 class FilePath; | |
14 } | |
15 | |
16 namespace image_writer { | |
17 | |
18 // A handler for messages related to writing images. This class is added as a | |
19 // handler in chrome::ChromeContentUtilityClient. | |
20 class ImageWriterHandler : public chrome::UtilityMessageHandler { | |
21 public: | |
22 ImageWriterHandler(); | |
23 virtual ~ImageWriterHandler(); | |
24 | |
25 // Methods for sending the different messages back to the browser process. | |
26 // Generally should be called by chrome::image_writer::ImageWriter. | |
27 virtual void SendSucceeded(); | |
28 virtual void SendCancelled(); | |
29 virtual void SendFailed(const std::string& message); | |
30 virtual void SendProgress(int64 progress); | |
31 | |
32 private: | |
33 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
34 | |
35 // Small wrapper for sending on the UtilityProcess. | |
36 void Send(IPC::Message* msg); | |
37 | |
38 // Message handlers. | |
39 void OnWriteStart(const base::FilePath& image, const base::FilePath& device); | |
40 void OnVerifyStart(const base::FilePath& image, const base::FilePath& device); | |
41 void OnCancel(); | |
42 | |
43 // Checks if a path is a valid target device. | |
44 bool IsValidDevice(const base::FilePath& device); | |
45 | |
46 ImageWriter image_writer_; | |
47 }; | |
48 | |
49 } // namespace image_writer | |
50 | |
51 #endif // CHROME_UTILITY_IMAGE_WRITER_IMAGE_WRITER_HANDLER_H_ | |
OLD | NEW |