OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_COMMON_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_H_ | 5 #ifndef CHROME_COMMON_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_H_ |
6 #define CHROME_COMMON_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_H_ | 6 #define CHROME_COMMON_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/file_util_proxy.h" | 11 #include "base/file_util_proxy.h" |
12 #include "base/id_map.h" | 12 #include "base/id_map.h" |
13 #include "ipc/ipc_channel.h" | 13 #include "ipc/ipc_channel.h" |
14 #include "ipc/ipc_message.h" | 14 #include "ipc/ipc_message.h" |
15 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 15 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
16 #include "webkit/fileapi/file_system_types.h" | 16 #include "webkit/fileapi/file_system_types.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 struct PlatformFileInfo; | 19 struct PlatformFileInfo; |
20 } | 20 } |
21 | 21 |
22 class FilePath; | 22 class FilePath; |
23 class GURL; | 23 class GURL; |
24 | 24 |
25 // Dispatches and sends file system related messages sent to/from a child | 25 // Dispatches and sends file system related messages sent to/from a child |
26 // process from/to the main browser process. There is one instance | 26 // process from/to the main browser process. There is one instance |
27 // per child process. Messages are dispatched on the main child thread. | 27 // per child process. Messages are dispatched on the main child thread. |
28 class FileSystemDispatcher { | 28 class FileSystemDispatcher : public IPC::Channel::Listener { |
29 public: | 29 public: |
30 FileSystemDispatcher(); | 30 FileSystemDispatcher(); |
31 ~FileSystemDispatcher(); | 31 ~FileSystemDispatcher(); |
32 | 32 |
| 33 // IPC::Channel::Listener implementation. |
33 bool OnMessageReceived(const IPC::Message& msg); | 34 bool OnMessageReceived(const IPC::Message& msg); |
34 | 35 |
35 bool OpenFileSystem(const GURL& origin_url, | 36 bool OpenFileSystem(const GURL& origin_url, |
36 fileapi::FileSystemType type, | 37 fileapi::FileSystemType type, |
37 long long size, | 38 long long size, |
38 bool create, | 39 bool create, |
39 fileapi::FileSystemCallbackDispatcher* dispatcher); | 40 fileapi::FileSystemCallbackDispatcher* dispatcher); |
40 bool Move(const FilePath& src_path, | 41 bool Move(const FilePath& src_path, |
41 const FilePath& dest_path, | 42 const FilePath& dest_path, |
42 fileapi::FileSystemCallbackDispatcher* dispatcher); | 43 fileapi::FileSystemCallbackDispatcher* dispatcher); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 bool has_more); | 93 bool has_more); |
93 void DidFail(int request_id, base::PlatformFileError error_code); | 94 void DidFail(int request_id, base::PlatformFileError error_code); |
94 void DidWrite(int request_id, int64 bytes, bool complete); | 95 void DidWrite(int request_id, int64 bytes, bool complete); |
95 | 96 |
96 IDMap<fileapi::FileSystemCallbackDispatcher, IDMapOwnPointer> dispatchers_; | 97 IDMap<fileapi::FileSystemCallbackDispatcher, IDMapOwnPointer> dispatchers_; |
97 | 98 |
98 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher); | 99 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher); |
99 }; | 100 }; |
100 | 101 |
101 #endif // CHROME_COMMON_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_H_ | 102 #endif // CHROME_COMMON_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_H_ |
OLD | NEW |