OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium OS 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 JAVASCRIPT_MESSAGE_SENDER_INTERFACE_H_ | |
6 #define JAVASCRIPT_MESSAGE_SENDER_INTERFACE_H_ | |
7 | |
8 #include <string> | |
9 | |
10 // Creates and sends messages to JavaScript. Messages are send asynchronously. | |
11 class JavaScriptMessageSenderInterface { | |
12 public: | |
13 virtual ~JavaScriptMessageSenderInterface() {} | |
14 | |
15 virtual void SendFileSystemError(const std::string& file_system_id, | |
16 const std::string& request_id, | |
17 const std::string& message) = 0; | |
18 | |
19 virtual void SendCompressorError(int compressor_id, | |
20 const std::string& message) = 0; | |
21 | |
22 virtual void SendFileChunkRequest(const std::string& file_system_id, | |
23 const std::string& request_id, | |
24 int64_t offset, | |
25 int64_t bytes_to_read) = 0; | |
26 | |
27 virtual void SendPassphraseRequest(const std::string& file_system_id, | |
28 const std::string& request_id) = 0; | |
29 | |
30 virtual void SendReadMetadataDone(const std::string& file_system_id, | |
31 const std::string& request_id, | |
32 const pp::VarDictionary& metadata) = 0; | |
33 | |
34 virtual void SendOpenFileDone(const std::string& file_system_id, | |
35 const std::string& request_id) = 0; | |
36 | |
37 virtual void SendCloseFileDone(const std::string& file_system_id, | |
38 const std::string& request_id, | |
39 const std::string& open_request_id) = 0; | |
40 | |
41 virtual void SendReadFileDone(const std::string& file_system_id, | |
42 const std::string& request_id, | |
43 const pp::VarArrayBuffer& array_buffer, | |
44 bool has_more_data) = 0; | |
45 | |
46 virtual void SendConsoleLog(const std::string& file_system_id, | |
47 const std::string& request_id, | |
48 const std::string& src_file, | |
49 int src_line, | |
50 const std::string& src_func, | |
51 const std::string& message) = 0; | |
52 | |
53 virtual void SendCreateArchiveDone(int compressor_id) = 0; | |
54 | |
55 virtual void SendReadFileChunk(int compressor_id_, | |
56 int64_t file_size) = 0; | |
57 | |
58 virtual void SendWriteChunk(int compressor_id, | |
59 const pp::VarArrayBuffer& array_buffer, | |
60 int64_t length) = 0; | |
61 | |
62 virtual void SendAddToArchiveDone(int compressor_id) = 0; | |
63 | |
64 virtual void SendCloseArchiveDone(int compressor_id) = 0; | |
65 }; | |
66 | |
67 #define CONSOLE_LOG(fsid, rid, msg) \ | |
68 SendConsoleLog(fsid, rid, __FILE__, __LINE__, __func__, msg) | |
69 | |
70 #endif // JAVASCRIPT_MESSAGE_SENDER_INTERFACE_H_ | |
OLD | NEW |