OLD | NEW |
| (Empty) |
1 // Copyright (c) 2010 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_BROWSER_RENDERER_HOST_FILE_UTILITIES_DISPATCHER_HOST_H_ | |
6 #define CHROME_BROWSER_RENDERER_HOST_FILE_UTILITIES_DISPATCHER_HOST_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/file_path.h" | |
10 #include "base/process.h" | |
11 #include "base/ref_counted.h" | |
12 #include "ipc/ipc_message.h" | |
13 | |
14 namespace base { | |
15 struct PlatformFileInfo; | |
16 } | |
17 | |
18 namespace IPC { | |
19 class Message; | |
20 } | |
21 | |
22 class FileUtilitiesDispatcherHost | |
23 : public base::RefCountedThreadSafe<FileUtilitiesDispatcherHost> { | |
24 public: | |
25 FileUtilitiesDispatcherHost(IPC::Message::Sender* sender, int process_id); | |
26 void Init(base::ProcessHandle process_handle); | |
27 void Shutdown(); | |
28 bool OnMessageReceived(const IPC::Message& message); | |
29 | |
30 void Send(IPC::Message* message); | |
31 | |
32 private: | |
33 friend class base::RefCountedThreadSafe<FileUtilitiesDispatcherHost>; | |
34 ~FileUtilitiesDispatcherHost(); | |
35 | |
36 typedef void (*FileInfoWriteFunc)(IPC::Message* reply_msg, | |
37 const base::PlatformFileInfo& file_info); | |
38 | |
39 void OnGetFileSize(const FilePath& path, IPC::Message* reply_msg); | |
40 void OnGetFileModificationTime(const FilePath& path, IPC::Message* reply_msg); | |
41 void OnGetFileInfoOnFileThread(const FilePath& path, | |
42 IPC::Message* reply_msg, | |
43 FileInfoWriteFunc write_func); | |
44 void OnOpenFile(const FilePath& path, int mode,IPC::Message* reply_msg); | |
45 void OnOpenFileOnFileThread(const FilePath& path, | |
46 int mode, | |
47 IPC::Message* reply_msg); | |
48 | |
49 // The sender to be used for sending out IPC messages. | |
50 IPC::Message::Sender* message_sender_; | |
51 | |
52 // The ID of this process. | |
53 int process_id_; | |
54 | |
55 // The handle of this process. | |
56 base::ProcessHandle process_handle_; | |
57 | |
58 bool shutdown_; | |
59 | |
60 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilitiesDispatcherHost); | |
61 }; | |
62 | |
63 #endif // CHROME_BROWSER_RENDERER_HOST_FILE_UTILITIES_DISPATCHER_HOST_H_ | |
OLD | NEW |