summaryrefslogtreecommitdiffstats
path: root/content/common
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-07 21:58:16 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-07 21:58:16 +0000
commit172f155f817cc56e1ca36bee6aeeca7f8f95bb64 (patch)
tree7a07e985bf2452ee3d24428b6b533ae695916361 /content/common
parent69d88ce83594e791dbbde1de900f993710f034c2 (diff)
downloadchromium_src-172f155f817cc56e1ca36bee6aeeca7f8f95bb64.zip
chromium_src-172f155f817cc56e1ca36bee6aeeca7f8f95bb64.tar.gz
chromium_src-172f155f817cc56e1ca36bee6aeeca7f8f95bb64.tar.bz2
Put file_system messages in their own file and move them to content, in preparation of moving child_thread.
TBR=avi Review URL: http://codereview.chromium.org/6624066 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77193 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common')
-rw-r--r--content/common/common_param_traits.cc43
-rw-r--r--content/common/common_param_traits.h14
-rw-r--r--content/common/content_message_generator.h1
-rw-r--r--content/common/file_system_messages.h123
4 files changed, 181 insertions, 0 deletions
diff --git a/content/common/common_param_traits.cc b/content/common/common_param_traits.cc
index fe92765..b5ba062 100644
--- a/content/common/common_param_traits.cc
+++ b/content/common/common_param_traits.cc
@@ -427,4 +427,47 @@ void ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> >::Log(
l->append(")");
}
+void ParamTraits<base::PlatformFileInfo>::Write(
+ Message* m, const param_type& p) {
+ WriteParam(m, p.size);
+ WriteParam(m, p.is_directory);
+ WriteParam(m, p.last_modified.ToDoubleT());
+ WriteParam(m, p.last_accessed.ToDoubleT());
+ WriteParam(m, p.creation_time.ToDoubleT());
+}
+
+bool ParamTraits<base::PlatformFileInfo>::Read(
+ const Message* m, void** iter, param_type* p) {
+ double last_modified;
+ double last_accessed;
+ double creation_time;
+ bool result =
+ ReadParam(m, iter, &p->size) &&
+ ReadParam(m, iter, &p->is_directory) &&
+ ReadParam(m, iter, &last_modified) &&
+ ReadParam(m, iter, &last_accessed) &&
+ ReadParam(m, iter, &creation_time);
+ if (result) {
+ p->last_modified = base::Time::FromDoubleT(last_modified);
+ p->last_accessed = base::Time::FromDoubleT(last_accessed);
+ p->creation_time = base::Time::FromDoubleT(creation_time);
+ }
+ return result;
+}
+
+void ParamTraits<base::PlatformFileInfo>::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(",");
+ LogParam(p.last_accessed.ToDoubleT(), l);
+ l->append(",");
+ LogParam(p.creation_time.ToDoubleT(), l);
+ l->append(")");
+}
+
} // namespace IPC
diff --git a/content/common/common_param_traits.h b/content/common/common_param_traits.h
index 1ecb5bb..f6f79b6 100644
--- a/content/common/common_param_traits.h
+++ b/content/common/common_param_traits.h
@@ -14,6 +14,7 @@
#define CONTENT_COMMON_COMMON_PARAM_TRAITS_H_
#pragma once
+#include "base/platform_file.h"
#include "base/ref_counted.h"
#include "googleurl/src/gurl.h"
#include "ipc/ipc_message_utils.h"
@@ -108,6 +109,19 @@ struct ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> > {
static void Log(const param_type& p, std::string* l);
};
+template <>
+struct ParamTraits<base::PlatformFileInfo> {
+ typedef base::PlatformFileInfo 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);
+};
+
+template <>
+struct SimilarTypeTraits<base::PlatformFileError> {
+ typedef int Type;
+};
+
} // namespace IPC
#endif // CONTENT_COMMON_COMMON_PARAM_TRAITS_H_
diff --git a/content/common/content_message_generator.h b/content/common/content_message_generator.h
index ac64b0d..c363be5 100644
--- a/content/common/content_message_generator.h
+++ b/content/common/content_message_generator.h
@@ -4,6 +4,7 @@
// Multiply-included file, hence no include guard.
+#include "content/common/file_system_messages.h"
#include "content/common/p2p_messages.h"
#include "content/common/resource_messages.h"
#include "content/common/socket_stream_messages.h"
diff --git a/content/common/file_system_messages.h b/content/common/file_system_messages.h
new file mode 100644
index 0000000..6965abe
--- /dev/null
+++ b/content/common/file_system_messages.h
@@ -0,0 +1,123 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// IPC messages for the file system.
+// Multiply-included message file, hence no include guard.
+
+#include "base/file_util_proxy.h"
+#include "ipc/ipc_message_macros.h"
+#include "webkit/fileapi/file_system_types.h"
+
+#define IPC_MESSAGE_START FileSystemMsgStart
+
+IPC_STRUCT_TRAITS_BEGIN(base::FileUtilProxy::Entry)
+ IPC_STRUCT_TRAITS_MEMBER(name)
+ IPC_STRUCT_TRAITS_MEMBER(is_directory)
+IPC_STRUCT_TRAITS_END()
+
+IPC_ENUM_TRAITS(fileapi::FileSystemType)
+
+// File system messages sent from the browser to the child process.
+
+// WebFrameClient::openFileSystem response messages.
+IPC_MESSAGE_CONTROL4(FileSystemMsg_OpenComplete,
+ int /* request_id */,
+ bool /* accepted */,
+ std::string /* name */,
+ FilePath /* root_path */)
+
+// WebFileSystem response messages.
+IPC_MESSAGE_CONTROL1(FileSystemMsg_DidSucceed,
+ int /* request_id */)
+IPC_MESSAGE_CONTROL2(FileSystemMsg_DidReadMetadata,
+ int /* request_id */,
+ base::PlatformFileInfo)
+IPC_MESSAGE_CONTROL3(FileSystemMsg_DidReadDirectory,
+ int /* request_id */,
+ std::vector<base::FileUtilProxy::Entry> /* entries */,
+ bool /* has_more */)
+IPC_MESSAGE_CONTROL3(FileSystemMsg_DidWrite,
+ int /* request_id */,
+ int64 /* byte count */,
+ bool /* complete */)
+IPC_MESSAGE_CONTROL2(FileSystemMsg_DidFail,
+ int /* request_id */,
+ base::PlatformFileError /* error_code */)
+
+// File system messages sent from the child process to the browser.
+
+// WebFrameClient::openFileSystem() message.
+IPC_MESSAGE_CONTROL5(FileSystemHostMsg_Open,
+ int /* request_id */,
+ GURL /* origin_url */,
+ fileapi::FileSystemType /* type */,
+ int64 /* requested_size */,
+ bool /* create */)
+
+// WebFileSystem::move() message.
+IPC_MESSAGE_CONTROL3(FileSystemHostMsg_Move,
+ int /* request_id */,
+ FilePath /* src path */,
+ FilePath /* dest path */)
+
+// WebFileSystem::copy() message.
+IPC_MESSAGE_CONTROL3(FileSystemHostMsg_Copy,
+ int /* request_id */,
+ FilePath /* src path */,
+ FilePath /* dest path */)
+
+// WebFileSystem::remove() message.
+IPC_MESSAGE_CONTROL3(FileSystemMsg_Remove,
+ int /* request_id */,
+ FilePath /* path */,
+ bool /* recursive */)
+
+// WebFileSystem::readMetadata() message.
+IPC_MESSAGE_CONTROL2(FileSystemHostMsg_ReadMetadata,
+ int /* request_id */,
+ FilePath /* path */)
+
+// WebFileSystem::create() message.
+IPC_MESSAGE_CONTROL5(FileSystemHostMsg_Create,
+ int /* request_id */,
+ FilePath /* path */,
+ bool /* exclusive */,
+ bool /* is_directory */,
+ bool /* recursive */)
+
+// WebFileSystem::exists() messages.
+IPC_MESSAGE_CONTROL3(FileSystemHostMsg_Exists,
+ int /* request_id */,
+ FilePath /* path */,
+ bool /* is_directory */)
+
+// WebFileSystem::readDirectory() message.
+IPC_MESSAGE_CONTROL2(FileSystemHostMsg_ReadDirectory,
+ int /* request_id */,
+ FilePath /* path */)
+
+// WebFileWriter::write() message.
+IPC_MESSAGE_CONTROL4(FileSystemHostMsg_Write,
+ int /* request id */,
+ FilePath /* file path */,
+ GURL /* blob URL */,
+ int64 /* position */)
+
+// WebFileWriter::truncate() message.
+IPC_MESSAGE_CONTROL3(FileSystemHostMsg_Truncate,
+ int /* request id */,
+ FilePath /* file path */,
+ int64 /* length */)
+
+// Pepper's Touch() message.
+IPC_MESSAGE_CONTROL4(FileSystemHostMsg_TouchFile,
+ int /* request_id */,
+ FilePath /* path */,
+ base::Time /* last_access_time */,
+ base::Time /* last_modified_time */)
+
+// WebFileWriter::cancel() message.
+IPC_MESSAGE_CONTROL2(FileSystemHostMsg_CancelWrite,
+ int /* request id */,
+ int /* id of request to cancel */)