| 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/id_map.h" | 11 #include "base/id_map.h" |
| 12 #include "base/nullable_string16.h" | 12 #include "base/nullable_string16.h" |
| 13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 14 #include "ipc/ipc_channel.h" | 14 #include "ipc/ipc_channel.h" |
| 15 #include "ipc/ipc_message.h" | 15 #include "ipc/ipc_message.h" |
| 16 #include "third_party/WebKit/WebKit/chromium/public/WebFileError.h" | |
| 17 | 16 |
| 18 namespace WebKit { | 17 namespace WebKit { |
| 19 struct WebFileInfo; | |
| 20 class WebFileSystemCallbacks; | 18 class WebFileSystemCallbacks; |
| 21 struct WebFileSystemEntry; | |
| 22 } | 19 } |
| 23 | 20 |
| 24 namespace file_util { | |
| 25 struct FileInfo; | |
| 26 } | |
| 27 | |
| 28 struct ViewMsg_FileSystem_DidReadDirectory_Params; | |
| 29 | |
| 30 // Dispatches and sends file system related messages sent to/from a child | 21 // Dispatches and sends file system related messages sent to/from a child |
| 31 // process from/to the main browser process. There is one instance | 22 // process from/to the main browser process. There is one instance |
| 32 // per child process. Messages are dispatched on the main child thread. | 23 // per child process. Messages are dispatched on the main child thread. |
| 33 class FileSystemDispatcher { | 24 class FileSystemDispatcher { |
| 34 public: | 25 public: |
| 35 FileSystemDispatcher(); | 26 FileSystemDispatcher(); |
| 36 ~FileSystemDispatcher(); | 27 ~FileSystemDispatcher(); |
| 37 | 28 |
| 38 bool OnMessageReceived(const IPC::Message& msg); | 29 bool OnMessageReceived(const IPC::Message& msg); |
| 39 | 30 |
| 40 void Move( | 31 void Move( |
| 41 const string16& src_path, | 32 const string16& src_path, |
| 42 const string16& dest_path, | 33 const string16& dest_path, |
| 43 WebKit::WebFileSystemCallbacks* callbacks); | 34 WebKit::WebFileSystemCallbacks* callbacks); |
| 44 void Copy( | 35 |
| 45 const string16& src_path, | 36 // TODO(kinuko): add more implementation. |
| 46 const string16& dest_path, | |
| 47 WebKit::WebFileSystemCallbacks* callbacks); | |
| 48 void Remove( | |
| 49 const string16& path, | |
| 50 WebKit::WebFileSystemCallbacks* callbacks); | |
| 51 void ReadMetadata( | |
| 52 const string16& path, | |
| 53 WebKit::WebFileSystemCallbacks* callbacks); | |
| 54 void Create( | |
| 55 const string16& path, | |
| 56 bool exclusive, | |
| 57 bool for_directory, | |
| 58 WebKit::WebFileSystemCallbacks* callbacks); | |
| 59 void Exists( | |
| 60 const string16& path, | |
| 61 bool for_directory, | |
| 62 WebKit::WebFileSystemCallbacks* callbacks); | |
| 63 void ReadDirectory( | |
| 64 const string16& path, | |
| 65 WebKit::WebFileSystemCallbacks* callbacks); | |
| 66 | 37 |
| 67 private: | 38 private: |
| 68 void DidSucceed(int request_id); | 39 void DidSucceed(int32 callbacks_id); |
| 69 void DidReadMetadata( | 40 void DidFail(int32 callbacks_id, int code); |
| 70 int request_id, | 41 // TODO(kinuko): add more callbacks. |
| 71 const file_util::FileInfo& file_info); | |
| 72 void DidReadDirectory( | |
| 73 const ViewMsg_FileSystem_DidReadDirectory_Params& params); | |
| 74 void DidFail( | |
| 75 int request_id, | |
| 76 WebKit::WebFileError); | |
| 77 | 42 |
| 78 IDMap<WebKit::WebFileSystemCallbacks> callbacks_; | 43 IDMap<WebKit::WebFileSystemCallbacks> callbacks_; |
| 79 | 44 |
| 80 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher); | 45 DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher); |
| 81 }; | 46 }; |
| 82 | 47 |
| 83 #endif // CHROME_COMMON_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_H_ | 48 #endif // CHROME_COMMON_FILE_SYSTEM_FILE_SYSTEM_DISPATCHER_H_ |
| OLD | NEW |