diff options
-rw-r--r-- | chrome/browser/file_system/file_system_dispatcher_host.cc | 60 | ||||
-rw-r--r-- | chrome/browser/file_system/file_system_dispatcher_host.h | 25 | ||||
-rw-r--r-- | chrome/common/common_param_traits.cc | 31 | ||||
-rw-r--r-- | chrome/common/common_param_traits.h | 9 | ||||
-rw-r--r-- | chrome/common/file_system/file_system_dispatcher.cc | 87 | ||||
-rw-r--r-- | chrome/common/file_system/file_system_dispatcher.h | 45 | ||||
-rw-r--r-- | chrome/common/file_system/webfilesystem_impl.cc | 32 | ||||
-rw-r--r-- | chrome/common/render_messages.h | 1 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 49 | ||||
-rw-r--r-- | chrome/common/render_messages_params.cc | 56 | ||||
-rw-r--r-- | chrome/common/render_messages_params.h | 37 | ||||
-rw-r--r-- | chrome/common/webkit_param_traits.h | 6 |
12 files changed, 413 insertions, 25 deletions
diff --git a/chrome/browser/file_system/file_system_dispatcher_host.cc b/chrome/browser/file_system/file_system_dispatcher_host.cc index d876808..50a7a3e 100644 --- a/chrome/browser/file_system/file_system_dispatcher_host.cc +++ b/chrome/browser/file_system/file_system_dispatcher_host.cc @@ -50,7 +50,12 @@ bool FileSystemDispatcherHost::OnMessageReceived( IPC_BEGIN_MESSAGE_MAP_EX(FileSystemDispatcherHost, message, *message_was_ok) IPC_MESSAGE_HANDLER(ViewHostMsg_OpenFileSystemRequest, OnOpenFileSystem) IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_Move, OnMove) - // TODO(kinuko): add more. + IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_Copy, OnCopy) + IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_Remove, OnRemove) + IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_ReadMetadata, OnReadMetadata) + IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_Create, OnCreate) + IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_Exists, OnExists) + IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_ReadDirectory, OnReadDirectory) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP_EX() return handled; @@ -99,8 +104,59 @@ void FileSystemDispatcherHost::OnMove( } // TODO(kinuko): not implemented yet. + Send(new ViewMsg_FileSystem_DidFail( + request_id, WebKit::WebFileErrorAbort)); +} + +void FileSystemDispatcherHost::OnCopy( + int request_id, + const string16& src_path, + const string16& dest_path) { + // TODO(kinuko): not implemented yet. + Send(new ViewMsg_FileSystem_DidFail( + request_id, WebKit::WebFileErrorAbort)); +} - Send(new ViewMsg_FileSystem_Failed( +void FileSystemDispatcherHost::OnRemove( + int request_id, + const string16& path) { + // TODO(kinuko): not implemented yet. + Send(new ViewMsg_FileSystem_DidFail( + request_id, WebKit::WebFileErrorAbort)); +} + +void FileSystemDispatcherHost::OnReadMetadata( + int request_id, + const string16& path) { + // TODO(kinuko): not implemented yet. + Send(new ViewMsg_FileSystem_DidFail( + request_id, WebKit::WebFileErrorAbort)); +} + +void FileSystemDispatcherHost::OnCreate( + int request_id, + const string16& path, + bool exclusive, + bool is_directory) { + // TODO(kinuko): not implemented yet. + Send(new ViewMsg_FileSystem_DidFail( + request_id, WebKit::WebFileErrorAbort)); +} + +void FileSystemDispatcherHost::OnExists( + int request_id, + const string16& path, + bool is_directory) { + // TODO(kinuko): not implemented yet. + Send(new ViewMsg_FileSystem_DidFail( + request_id, WebKit::WebFileErrorAbort)); +} + +void FileSystemDispatcherHost::OnReadDirectory( + int request_id, + const string16& path) { + // TODO(kinuko): not implemented yet. + Send(new ViewMsg_FileSystem_DidFail( request_id, WebKit::WebFileErrorAbort)); } diff --git a/chrome/browser/file_system/file_system_dispatcher_host.h b/chrome/browser/file_system/file_system_dispatcher_host.h index 0f8b63a..320e56a 100644 --- a/chrome/browser/file_system/file_system_dispatcher_host.h +++ b/chrome/browser/file_system/file_system_dispatcher_host.h @@ -32,9 +32,28 @@ class FileSystemDispatcherHost int request_id, const string16& src_path, const string16& dest_path); - - // TODO(kinuko): add more methods. - + void OnCopy( + int request_id, + const string16& src_path, + const string16& dest_path); + void OnRemove( + int request_id, + const string16& path); + void OnReadMetadata( + int request_id, + const string16& path); + void OnCreate( + int request_id, + const string16& path, + bool exclusive, + bool is_directory); + void OnExists( + int request_id, + const string16& path, + bool is_directory); + void OnReadDirectory( + int request_id, + const string16& path); void Send(IPC::Message* message); private: diff --git a/chrome/common/common_param_traits.cc b/chrome/common/common_param_traits.cc index f3c44c1..0cb91a0 100644 --- a/chrome/common/common_param_traits.cc +++ b/chrome/common/common_param_traits.cc @@ -4,6 +4,7 @@ #include "chrome/common/common_param_traits.h" +#include "base/time.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/content_settings.h" #include "chrome/common/geoposition.h" @@ -687,4 +688,34 @@ void ParamTraits<printing::NativeMetafile>::Log( l->append("<printing::NativeMetafile>"); } +void ParamTraits<file_util::FileInfo>::Write( + Message* m, const param_type& p) { + WriteParam(m, p.size); + WriteParam(m, p.is_directory); + WriteParam(m, p.last_modified.ToDoubleT()); +} + +bool ParamTraits<file_util::FileInfo>::Read( + const Message* m, void** iter, param_type* p) { + double last_modified; + bool result = + ReadParam(m, iter, &p->size) && + ReadParam(m, iter, &p->is_directory) && + ReadParam(m, iter, &last_modified); + if (result) + p->last_modified = base::Time::FromDoubleT(last_modified); + return result; +} + +void ParamTraits<file_util::FileInfo>::Log( + const param_type& p, std::string* l) { + l->append("("); + LogParam(p.size, l); + l->append(","); + LogParam(p.is_directory, l); + l->append(","); + LogParam(p.last_modified.ToDoubleT(), l); + l->append(")"); +} + } // namespace IPC diff --git a/chrome/common/common_param_traits.h b/chrome/common/common_param_traits.h index d77f15c..0a4d819 100644 --- a/chrome/common/common_param_traits.h +++ b/chrome/common/common_param_traits.h @@ -15,6 +15,7 @@ #include <vector> #include "app/surface/transport_dib.h" +#include "base/file_util.h" #include "base/ref_counted.h" #include "chrome/common/content_settings.h" #include "chrome/common/page_zoom.h" @@ -325,6 +326,14 @@ struct ParamTraits<printing::NativeMetafile> { static void Log(const param_type& p, std::string* l); }; +template <> +struct ParamTraits<file_util::FileInfo> { + typedef file_util::FileInfo param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + } // namespace IPC #endif // CHROME_COMMON_COMMON_PARAM_TRAITS_H_ diff --git a/chrome/common/file_system/file_system_dispatcher.cc b/chrome/common/file_system/file_system_dispatcher.cc index 81361d5..f7022e1 100644 --- a/chrome/common/file_system/file_system_dispatcher.cc +++ b/chrome/common/file_system/file_system_dispatcher.cc @@ -4,14 +4,21 @@ #include "chrome/common/file_system/file_system_dispatcher.h" +#include "base/file_util.h" #include "chrome/common/child_thread.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" +#include "third_party/WebKit/WebKit/chromium/public/WebFileInfo.h" +#include "third_party/WebKit/WebKit/chromium/public/WebFileSystemEntry.h" #include "third_party/WebKit/WebKit/chromium/public/WebFileSystemCallbacks.h" +#include "third_party/WebKit/WebKit/chromium/public/WebVector.h" #include "webkit/glue/webkit_glue.h" using WebKit::WebFileError; using WebKit::WebFileInfo; using WebKit::WebFileSystemCallbacks; +using WebKit::WebFileSystemEntry; +using WebKit::WebVector; FileSystemDispatcher::FileSystemDispatcher() { } @@ -32,8 +39,10 @@ FileSystemDispatcher::~FileSystemDispatcher() { bool FileSystemDispatcher::OnMessageReceived(const IPC::Message& msg) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(FileSystemDispatcher, msg) - IPC_MESSAGE_HANDLER(ViewMsg_FileSystem_Succeeded, DidSucceed) - IPC_MESSAGE_HANDLER(ViewMsg_FileSystem_Failed, DidFail) + IPC_MESSAGE_HANDLER(ViewMsg_FileSystem_DidSucceed, DidSucceed) + IPC_MESSAGE_HANDLER(ViewMsg_FileSystem_DidReadDirectory, DidReadDirectory) + IPC_MESSAGE_HANDLER(ViewMsg_FileSystem_DidReadMetadata, DidReadMetadata) + IPC_MESSAGE_HANDLER(ViewMsg_FileSystem_DidFail, DidFail) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -47,6 +56,52 @@ void FileSystemDispatcher::Move( new ViewHostMsg_FileSystem_Move(request_id, src_path, dest_path)); } +void FileSystemDispatcher::Copy( + const string16& src_path, const string16& dest_path, + WebFileSystemCallbacks* callbacks) { + int request_id = callbacks_.Add(callbacks); + ChildThread::current()->Send( + new ViewHostMsg_FileSystem_Copy(request_id, src_path, dest_path)); +} + +void FileSystemDispatcher::Remove( + const string16& path, WebFileSystemCallbacks* callbacks) { + int request_id = callbacks_.Add(callbacks); + ChildThread::current()->Send( + new ViewHostMsg_FileSystem_Remove(request_id, path)); +} + +void FileSystemDispatcher::ReadMetadata( + const string16& path, WebFileSystemCallbacks* callbacks) { + int request_id = callbacks_.Add(callbacks); + ChildThread::current()->Send( + new ViewHostMsg_FileSystem_ReadMetadata(request_id, path)); +} + +void FileSystemDispatcher::Create( + const string16& path, bool exclusive, bool is_directory, + WebFileSystemCallbacks* callbacks) { + int request_id = callbacks_.Add(callbacks); + ChildThread::current()->Send( + new ViewHostMsg_FileSystem_Create(request_id, path, exclusive, + is_directory)); +} + +void FileSystemDispatcher::Exists( + const string16& path, bool is_directory, + WebFileSystemCallbacks* callbacks) { + int request_id = callbacks_.Add(callbacks); + ChildThread::current()->Send( + new ViewHostMsg_FileSystem_Exists(request_id, path, is_directory)); +} + +void FileSystemDispatcher::ReadDirectory( + const string16& path, WebFileSystemCallbacks* callbacks) { + int request_id = callbacks_.Add(callbacks); + ChildThread::current()->Send( + new ViewHostMsg_FileSystem_ReadDirectory(request_id, path)); +} + void FileSystemDispatcher::DidSucceed(int request_id) { WebFileSystemCallbacks* callbacks = callbacks_.Lookup(request_id); DCHECK(callbacks); @@ -54,9 +109,33 @@ void FileSystemDispatcher::DidSucceed(int request_id) { callbacks->didSucceed(); } -void FileSystemDispatcher::DidFail(int request_id, int code) { +void FileSystemDispatcher::DidReadMetadata(int request_id, + const file_util::FileInfo& file_info) { + WebFileSystemCallbacks* callbacks = callbacks_.Lookup(request_id); + DCHECK(callbacks); + callbacks_.Remove(request_id); + WebFileInfo web_file_info; + web_file_info.modificationTime = file_info.last_modified.ToDoubleT(); + callbacks->didReadMetadata(web_file_info); +} + +void FileSystemDispatcher::DidReadDirectory( + const ViewMsg_FileSystem_DidReadDirectory_Params& params) { + WebFileSystemCallbacks* callbacks = callbacks_.Lookup(params.request_id); + DCHECK(callbacks); + if (!params.has_more) + callbacks_.Remove(params.request_id); + WebVector<WebFileSystemEntry> entries(params.entries.size()); + for (size_t i = 0; i < params.entries.size(); ++i) { + entries[i].name = webkit_glue::FilePathToWebString(params.entries[i].name); + entries[i].isDirectory = params.entries[i].is_directory; + } + callbacks->didReadDirectory(entries, params.has_more); +} + +void FileSystemDispatcher::DidFail(int request_id, WebFileError code) { WebFileSystemCallbacks* callbacks = callbacks_.Lookup(request_id); DCHECK(callbacks); callbacks_.Remove(request_id); - callbacks->didFail(static_cast<WebFileError>(code)); + callbacks->didFail(code); } diff --git a/chrome/common/file_system/file_system_dispatcher.h b/chrome/common/file_system/file_system_dispatcher.h index 5c854c2..70855d1 100644 --- a/chrome/common/file_system/file_system_dispatcher.h +++ b/chrome/common/file_system/file_system_dispatcher.h @@ -13,11 +13,20 @@ #include "googleurl/src/gurl.h" #include "ipc/ipc_channel.h" #include "ipc/ipc_message.h" +#include "third_party/WebKit/WebKit/chromium/public/WebFileError.h" namespace WebKit { +struct WebFileInfo; class WebFileSystemCallbacks; +struct WebFileSystemEntry; } +namespace file_util { +struct FileInfo; +} + +struct ViewMsg_FileSystem_DidReadDirectory_Params; + // Dispatches and sends file system related messages sent to/from a child // process from/to the main browser process. There is one instance // per child process. Messages are dispatched on the main child thread. @@ -32,13 +41,39 @@ class FileSystemDispatcher { const string16& src_path, const string16& dest_path, WebKit::WebFileSystemCallbacks* callbacks); - - // TODO(kinuko): add more implementation. + void Copy( + const string16& src_path, + const string16& dest_path, + WebKit::WebFileSystemCallbacks* callbacks); + void Remove( + const string16& path, + WebKit::WebFileSystemCallbacks* callbacks); + void ReadMetadata( + const string16& path, + WebKit::WebFileSystemCallbacks* callbacks); + void Create( + const string16& path, + bool exclusive, + bool for_directory, + WebKit::WebFileSystemCallbacks* callbacks); + void Exists( + const string16& path, + bool for_directory, + WebKit::WebFileSystemCallbacks* callbacks); + void ReadDirectory( + const string16& path, + WebKit::WebFileSystemCallbacks* callbacks); private: - void DidSucceed(int32 callbacks_id); - void DidFail(int32 callbacks_id, int code); - // TODO(kinuko): add more callbacks. + void DidSucceed(int request_id); + void DidReadMetadata( + int request_id, + const file_util::FileInfo& file_info); + void DidReadDirectory( + const ViewMsg_FileSystem_DidReadDirectory_Params& params); + void DidFail( + int request_id, + WebKit::WebFileError); IDMap<WebKit::WebFileSystemCallbacks> callbacks_; diff --git a/chrome/common/file_system/webfilesystem_impl.cc b/chrome/common/file_system/webfilesystem_impl.cc index a9aa346..49a07d6 100644 --- a/chrome/common/file_system/webfilesystem_impl.cc +++ b/chrome/common/file_system/webfilesystem_impl.cc @@ -23,40 +23,56 @@ void WebFileSystemImpl::move(const WebString& src_path, void WebFileSystemImpl::copy(const WebKit::WebString& src_path, const WebKit::WebString& dest_path, WebKit::WebFileSystemCallbacks* callbacks) { - // TODO(kinuko): not implemented yet. + FileSystemDispatcher* dispatcher = + ChildThread::current()->file_system_dispatcher(); + dispatcher->Copy(src_path, dest_path, callbacks); } void WebFileSystemImpl::remove(const WebString& path, WebFileSystemCallbacks* callbacks) { - // TODO(kinuko): not implemented yet. + FileSystemDispatcher* dispatcher = + ChildThread::current()->file_system_dispatcher(); + dispatcher->Remove(path, callbacks); } void WebFileSystemImpl::readMetadata(const WebString& path, WebFileSystemCallbacks* callbacks) { - // TODO(kinuko): not implemented yet. + FileSystemDispatcher* dispatcher = + ChildThread::current()->file_system_dispatcher(); + dispatcher->ReadMetadata(path, callbacks); } void WebFileSystemImpl::createFile(const WebString& path, bool exclusive, WebFileSystemCallbacks* callbacks) { - // TODO(kinuko): not implemented yet. + FileSystemDispatcher* dispatcher = + ChildThread::current()->file_system_dispatcher(); + dispatcher->Create(path, exclusive, false, callbacks); } void WebFileSystemImpl::createDirectory(const WebString& path, bool exclusive, WebFileSystemCallbacks* callbacks) { - // TODO(kinuko): not implemented yet. + FileSystemDispatcher* dispatcher = + ChildThread::current()->file_system_dispatcher(); + dispatcher->Create(path, exclusive, true, callbacks); } void WebFileSystemImpl::fileExists(const WebString& path, WebFileSystemCallbacks* callbacks) { - // TODO(kinuko): not implemented yet. + FileSystemDispatcher* dispatcher = + ChildThread::current()->file_system_dispatcher(); + dispatcher->Exists(path, false, callbacks); } void WebFileSystemImpl::directoryExists(const WebString& path, WebFileSystemCallbacks* callbacks) { - // TODO(kinuko): not implemented yet. + FileSystemDispatcher* dispatcher = + ChildThread::current()->file_system_dispatcher(); + dispatcher->Exists(path, true, callbacks); } void WebFileSystemImpl::readDirectory(const WebString& path, WebFileSystemCallbacks* callbacks) { - // TODO(kinuko): not implemented yet. + FileSystemDispatcher* dispatcher = + ChildThread::current()->file_system_dispatcher(); + dispatcher->ReadDirectory(path, callbacks); } diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index c5113d6..466eafa 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -108,6 +108,7 @@ struct ViewMsg_ExtensionsUpdated_Params; struct ViewMsg_DeviceOrientationUpdated_Params; struct ViewHostMsg_DomMessage_Params; struct ViewHostMsg_OpenFileSystemRequest_Params; +struct ViewMsg_FileSystem_DidReadDirectory_Params; // Values that may be OR'd together to form the 'flags' parameter of the // ViewMsg_EnablePreferredSizeChangedMode message. diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 1c65934..9d4fa57 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -55,6 +55,10 @@ namespace webkit_blob { class BlobData; } +namespace file_util { +struct FileInfo; +} + //----------------------------------------------------------------------------- // RenderView messages // These are messages sent from the browser to the renderer process. @@ -1014,11 +1018,16 @@ IPC_BEGIN_MESSAGES(View) string16 /* root_path */) // WebFileSystem response messages. - IPC_MESSAGE_CONTROL1(ViewMsg_FileSystem_Succeeded, + IPC_MESSAGE_CONTROL1(ViewMsg_FileSystem_DidSucceed, int /* request_id */) - IPC_MESSAGE_CONTROL2(ViewMsg_FileSystem_Failed, + IPC_MESSAGE_CONTROL2(ViewMsg_FileSystem_DidReadMetadata, + int /* request_id */, + file_util::FileInfo) + IPC_MESSAGE_CONTROL1(ViewMsg_FileSystem_DidReadDirectory, + ViewMsg_FileSystem_DidReadDirectory_Params) + IPC_MESSAGE_CONTROL2(ViewMsg_FileSystem_DidFail, int /* request_id */, - int /* error_code */) + WebKit::WebFileError /* error_code */) IPC_END_MESSAGES(View) @@ -2715,6 +2724,40 @@ IPC_BEGIN_MESSAGES(ViewHost) string16 /* src path */, string16 /* dest path */) + // WebFileSystem::copy() message. + IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Copy, + int /* request_id */, + string16 /* src path */, + string16 /* dest path */) + + // WebFileSystem::remove() message. + IPC_MESSAGE_CONTROL2(ViewHostMsg_FileSystem_Remove, + int /* request_id */, + string16 /* path */) + + // WebFileSystem::readMetadata() message. + IPC_MESSAGE_CONTROL2(ViewHostMsg_FileSystem_ReadMetadata, + int /* request_id */, + string16 /* path */) + + // WebFileSystem::create() message. + IPC_MESSAGE_CONTROL4(ViewHostMsg_FileSystem_Create, + int /* request_id */, + string16 /* path */, + bool /* exclusive */, + bool /* is_directory */) + + // WebFileSystem::exists() messages. + IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Exists, + int /* request_id */, + string16 /* path */, + bool /* is_directory */) + + // WebFileSystem::readDirectory() message. + IPC_MESSAGE_CONTROL2(ViewHostMsg_FileSystem_ReadDirectory, + int /* request_id */, + string16 /* path */) + //--------------------------------------------------------------------------- // Blob messages: diff --git a/chrome/common/render_messages_params.cc b/chrome/common/render_messages_params.cc index 5ad995e..56aaeda 100644 --- a/chrome/common/render_messages_params.cc +++ b/chrome/common/render_messages_params.cc @@ -1423,4 +1423,60 @@ void ParamTraits<ViewHostMsg_OpenFileSystemRequest_Params>::Log( l->append(")"); } +void ParamTraits<ViewMsg_FileSystem_DidReadDirectory_Params>::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.request_id); + WriteParam(m, p.entries); + WriteParam(m, p.has_more); +} + +bool ParamTraits<ViewMsg_FileSystem_DidReadDirectory_Params>::Read( + const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->request_id) && + ReadParam(m, iter, &p->entries) && + ReadParam(m, iter, &p->has_more); +} + +void ParamTraits<ViewMsg_FileSystem_DidReadDirectory_Params>::Log( + const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.request_id, l); + l->append(", "); + LogParam(p.entries, l); + l->append(", "); + LogParam(p.has_more, l); + l->append(")"); +} + +void ParamTraits<ViewMsg_FileSystem_DidReadDirectory_Params::Entry>::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.name); + WriteParam(m, p.is_directory); +} + +bool ParamTraits<ViewMsg_FileSystem_DidReadDirectory_Params::Entry>::Read( + const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->name) && + ReadParam(m, iter, &p->is_directory); +} + +void ParamTraits<ViewMsg_FileSystem_DidReadDirectory_Params::Entry>::Log( + const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.name, l); + l->append(", "); + LogParam(p.is_directory, l); + l->append(")"); +} + } // namespace IPC diff --git a/chrome/common/render_messages_params.h b/chrome/common/render_messages_params.h index 141e7f9..e5efd3c 100644 --- a/chrome/common/render_messages_params.h +++ b/chrome/common/render_messages_params.h @@ -845,6 +845,27 @@ struct ViewHostMsg_OpenFileSystemRequest_Params { int64 requested_size; }; +struct ViewMsg_FileSystem_DidReadDirectory_Params { + // The response should have this id. + int request_id; + + // TODO(kinuko): replace this with file_util_proxy's entry structure + // once it's defined. + struct Entry { + // Name of the entry. + FilePath name; + + // Indicates if the entry is directory or not. + bool is_directory; + }; + + // A vector of directory entries. + std::vector<Entry> entries; + + // Indicates if there will be more entries. + bool has_more; +}; + namespace IPC { class Message; @@ -1098,6 +1119,22 @@ struct ParamTraits<ViewHostMsg_OpenFileSystemRequest_Params> { static void Log(const param_type& p, std::string* l); }; +template <> +struct ParamTraits<ViewMsg_FileSystem_DidReadDirectory_Params> { + typedef ViewMsg_FileSystem_DidReadDirectory_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits<ViewMsg_FileSystem_DidReadDirectory_Params::Entry> { + typedef ViewMsg_FileSystem_DidReadDirectory_Params::Entry param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + } // namespace IPC #endif // CHROME_COMMON_RENDER_MESSAGES_PARAMS_H_ diff --git a/chrome/common/webkit_param_traits.h b/chrome/common/webkit_param_traits.h index b45655f..6cb83e5 100644 --- a/chrome/common/webkit_param_traits.h +++ b/chrome/common/webkit_param_traits.h @@ -29,6 +29,7 @@ #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" #include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h" #include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h" +#include "third_party/WebKit/WebKit/chromium/public/WebFileError.h" #include "third_party/WebKit/WebKit/chromium/public/WebFileSystem.h" #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" #include "third_party/WebKit/WebKit/chromium/public/WebPopupType.h" @@ -333,6 +334,11 @@ struct SimilarTypeTraits<WebKit::WebFileSystem::Type> { typedef int Type; }; +template <> +struct SimilarTypeTraits<WebKit::WebFileError> { + typedef int Type; +}; + } // namespace IPC #endif // CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ |