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_BROWSER_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_HOST_H_ | 5 #ifndef CHROME_BROWSER_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_HOST_H_ |
6 #define CHROME_BROWSER_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_HOST_H_ | 6 #define CHROME_BROWSER_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_HOST_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
11 #include "base/nullable_string16.h" | 11 #include "base/nullable_string16.h" |
12 #include "base/process.h" | 12 #include "base/process.h" |
13 #include "base/platform_file.h" | 13 #include "base/platform_file.h" |
14 #include "base/scoped_callback_factory.h" | 14 #include "base/scoped_callback_factory.h" |
15 #include "base/ref_counted.h" | 15 #include "base/ref_counted.h" |
16 #include "chrome/common/render_messages.h" | 16 #include "chrome/common/render_messages.h" |
17 #include "webkit/fileapi/file_system_operation.h" | 17 #include "webkit/fileapi/file_system_operation.h" |
18 | 18 |
19 class FileSystemHostContext; | 19 class FileSystemHostContext; |
| 20 class GURL; |
20 class HostContentSettingsMap; | 21 class HostContentSettingsMap; |
21 class Receiver; | 22 class Receiver; |
22 class ResourceMessageFilter; | 23 class ResourceMessageFilter; |
23 | 24 |
24 class FileSystemDispatcherHost | 25 class FileSystemDispatcherHost |
25 : public base::RefCountedThreadSafe<FileSystemDispatcherHost> { | 26 : public base::RefCountedThreadSafe<FileSystemDispatcherHost> { |
26 public: | 27 public: |
27 FileSystemDispatcherHost(IPC::Message::Sender* sender, | 28 FileSystemDispatcherHost(IPC::Message::Sender* sender, |
28 FileSystemHostContext* file_system_host_context, | 29 FileSystemHostContext* file_system_host_context, |
29 HostContentSettingsMap* host_content_settings_map); | 30 HostContentSettingsMap* host_content_settings_map); |
(...skipping 12 matching lines...) Expand all Loading... |
42 const FilePath& dest_path); | 43 const FilePath& dest_path); |
43 void OnRemove(int request_id, const FilePath& path); | 44 void OnRemove(int request_id, const FilePath& path); |
44 void OnReadMetadata(int request_id, const FilePath& path); | 45 void OnReadMetadata(int request_id, const FilePath& path); |
45 void OnCreate(int request_id, | 46 void OnCreate(int request_id, |
46 const FilePath& path, | 47 const FilePath& path, |
47 bool exclusive, | 48 bool exclusive, |
48 bool is_directory, | 49 bool is_directory, |
49 bool recursive); | 50 bool recursive); |
50 void OnExists(int request_id, const FilePath& path, bool is_directory); | 51 void OnExists(int request_id, const FilePath& path, bool is_directory); |
51 void OnReadDirectory(int request_id, const FilePath& path); | 52 void OnReadDirectory(int request_id, const FilePath& path); |
| 53 void OnWrite(int request_id, |
| 54 const FilePath& path, |
| 55 const GURL& blob_url, |
| 56 int64 offset); |
| 57 void OnTruncate(int request_id, const FilePath& path, int64 length); |
| 58 void OnCancel(int request_id, int request_to_cancel); |
52 void Send(IPC::Message* message); | 59 void Send(IPC::Message* message); |
53 void RemoveCompletedOperation(int request_id); | 60 void RemoveCompletedOperation(int request_id); |
54 | 61 |
55 private: | 62 private: |
56 // Creates a new FileSystemOperation. | 63 // Creates a new FileSystemOperation. |
57 fileapi::FileSystemOperation* GetNewOperation(int request_id); | 64 fileapi::FileSystemOperation* GetNewOperation(int request_id); |
58 | 65 |
59 // Checks the validity of a given |path|. Returns true if the given |path| | 66 // Checks the validity of a given |path|. Returns true if the given |path| |
60 // is valid as a path for FileSystem API. Otherwise it sends back a | 67 // is valid as a path for FileSystem API. Otherwise it sends back a |
61 // security error code to the dispatcher and returns false. | 68 // security error code to the dispatcher and returns false. |
(...skipping 13 matching lines...) Expand all Loading... |
75 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; | 82 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; |
76 | 83 |
77 // Keeps ongoing file system operations. | 84 // Keeps ongoing file system operations. |
78 typedef IDMap<fileapi::FileSystemOperation, IDMapOwnPointer> OperationsMap; | 85 typedef IDMap<fileapi::FileSystemOperation, IDMapOwnPointer> OperationsMap; |
79 OperationsMap operations_; | 86 OperationsMap operations_; |
80 | 87 |
81 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcherHost); | 88 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcherHost); |
82 }; | 89 }; |
83 | 90 |
84 #endif // CHROME_BROWSER_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_HOST_H_ | 91 #endif // CHROME_BROWSER_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_HOST_H_ |
OLD | NEW |