summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--chrome/browser/accessibility/browser_accessibility_manager_mac.mm1
-rw-r--r--chrome/common/common_param_traits.cc43
-rw-r--r--chrome/common/common_param_traits.h15
-rw-r--r--chrome/common/file_system/file_system_dispatcher.cc53
-rw-r--r--chrome/common/file_system/file_system_dispatcher.h18
-rw-r--r--chrome/common/pepper_file_messages.h2
-rw-r--r--chrome/common/render_messages.h6
-rw-r--r--chrome/common/render_messages_internal.h106
-rw-r--r--chrome/common/render_messages_params.cc26
-rw-r--r--chrome/common/render_messages_params.h9
-rw-r--r--content/browser/file_system/file_system_dispatcher_host.cc47
-rw-r--r--content/browser/file_system/file_system_dispatcher_host.h14
-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
-rw-r--r--content/content_common.gypi1
-rw-r--r--ipc/ipc_message_utils.h1
18 files changed, 247 insertions, 276 deletions
diff --git a/chrome/browser/accessibility/browser_accessibility_manager_mac.mm b/chrome/browser/accessibility/browser_accessibility_manager_mac.mm
index 47230aa..03a08dd 100644
--- a/chrome/browser/accessibility/browser_accessibility_manager_mac.mm
+++ b/chrome/browser/accessibility/browser_accessibility_manager_mac.mm
@@ -4,6 +4,7 @@
#include "chrome/browser/accessibility/browser_accessibility_manager_mac.h"
+#import "base/logging.h"
#import "chrome/browser/accessibility/browser_accessibility_cocoa.h"
#include "chrome/common/render_messages_params.h"
diff --git a/chrome/common/common_param_traits.cc b/chrome/common/common_param_traits.cc
index 5eefb26..38792bb 100644
--- a/chrome/common/common_param_traits.cc
+++ b/chrome/common/common_param_traits.cc
@@ -444,49 +444,6 @@ void ParamTraits<printing::NativeMetafile>::Log(
l->append("<printing::NativeMetafile>");
}
-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(")");
-}
-
void ParamTraits<printing::PrinterCapsAndDefaults>::Write(
Message* m, const param_type& p) {
WriteParam(m, p.printer_capabilities);
diff --git a/chrome/common/common_param_traits.h b/chrome/common/common_param_traits.h
index 1a2e4e6..28b48bc 100644
--- a/chrome/common/common_param_traits.h
+++ b/chrome/common/common_param_traits.h
@@ -14,7 +14,6 @@
#include "app/surface/transport_dib.h"
#include "base/file_util.h"
-#include "base/platform_file.h"
#include "base/ref_counted.h"
#include "chrome/common/content_settings.h"
#include "chrome/common/page_zoom.h"
@@ -287,20 +286,6 @@ struct ParamTraits<printing::NativeMetafile> {
};
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);
-};
-
-// Traits for base::PlatformFileError
-template <>
-struct SimilarTypeTraits<base::PlatformFileError> {
- typedef int Type;
-};
-
-template <>
struct ParamTraits<printing::PrinterCapsAndDefaults> {
typedef printing::PrinterCapsAndDefaults param_type;
static void Write(Message* m, const param_type& p);
diff --git a/chrome/common/file_system/file_system_dispatcher.cc b/chrome/common/file_system/file_system_dispatcher.cc
index 352deb3..de8814b 100644
--- a/chrome/common/file_system/file_system_dispatcher.cc
+++ b/chrome/common/file_system/file_system_dispatcher.cc
@@ -6,8 +6,7 @@
#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 "content/common/file_system_messages.h"
FileSystemDispatcher::FileSystemDispatcher() {
}
@@ -27,13 +26,12 @@ FileSystemDispatcher::~FileSystemDispatcher() {
bool FileSystemDispatcher::OnMessageReceived(const IPC::Message& msg) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(FileSystemDispatcher, msg)
- IPC_MESSAGE_HANDLER(ViewMsg_OpenFileSystemRequest_Complete,
- OnOpenFileSystemRequestComplete)
- 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_HANDLER(ViewMsg_FileSystem_DidWrite, DidWrite)
+ IPC_MESSAGE_HANDLER(FileSystemMsg_OpenComplete, OnOpenComplete)
+ IPC_MESSAGE_HANDLER(FileSystemMsg_DidSucceed, OnDidSucceed)
+ IPC_MESSAGE_HANDLER(FileSystemMsg_DidReadDirectory, OnDidReadDirectory)
+ IPC_MESSAGE_HANDLER(FileSystemMsg_DidReadMetadata, OnDidReadMetadata)
+ IPC_MESSAGE_HANDLER(FileSystemMsg_DidFail, OnDidFail)
+ IPC_MESSAGE_HANDLER(FileSystemMsg_DidWrite, OnDidWrite)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -44,7 +42,7 @@ bool FileSystemDispatcher::OpenFileSystem(
long long size, bool create,
fileapi::FileSystemCallbackDispatcher* dispatcher) {
int request_id = dispatchers_.Add(dispatcher);
- if (!ChildThread::current()->Send(new ViewHostMsg_OpenFileSystemRequest(
+ if (!ChildThread::current()->Send(new FileSystemHostMsg_Open(
request_id, origin_url, type, size, create))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
return false;
@@ -58,7 +56,7 @@ bool FileSystemDispatcher::Move(
const FilePath& dest_path,
fileapi::FileSystemCallbackDispatcher* dispatcher) {
int request_id = dispatchers_.Add(dispatcher);
- if (!ChildThread::current()->Send(new ViewHostMsg_FileSystem_Move(
+ if (!ChildThread::current()->Send(new FileSystemHostMsg_Move(
request_id, src_path, dest_path))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
return false;
@@ -72,7 +70,7 @@ bool FileSystemDispatcher::Copy(
const FilePath& dest_path,
fileapi::FileSystemCallbackDispatcher* dispatcher) {
int request_id = dispatchers_.Add(dispatcher);
- if (!ChildThread::current()->Send(new ViewHostMsg_FileSystem_Copy(
+ if (!ChildThread::current()->Send(new FileSystemHostMsg_Copy(
request_id, src_path, dest_path))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
return false;
@@ -87,7 +85,7 @@ bool FileSystemDispatcher::Remove(
fileapi::FileSystemCallbackDispatcher* dispatcher) {
int request_id = dispatchers_.Add(dispatcher);
if (!ChildThread::current()->Send(
- new ViewHostMsg_FileSystem_Remove(request_id, path, recursive))) {
+ new FileSystemMsg_Remove(request_id, path, recursive))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
return false;
}
@@ -100,7 +98,7 @@ bool FileSystemDispatcher::ReadMetadata(
fileapi::FileSystemCallbackDispatcher* dispatcher) {
int request_id = dispatchers_.Add(dispatcher);
if (!ChildThread::current()->Send(
- new ViewHostMsg_FileSystem_ReadMetadata(request_id, path))) {
+ new FileSystemHostMsg_ReadMetadata(request_id, path))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
return false;
}
@@ -115,7 +113,7 @@ bool FileSystemDispatcher::Create(
bool recursive,
fileapi::FileSystemCallbackDispatcher* dispatcher) {
int request_id = dispatchers_.Add(dispatcher);
- if (!ChildThread::current()->Send(new ViewHostMsg_FileSystem_Create(
+ if (!ChildThread::current()->Send(new FileSystemHostMsg_Create(
request_id, path, exclusive, is_directory, recursive))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
return false;
@@ -130,7 +128,7 @@ bool FileSystemDispatcher::Exists(
fileapi::FileSystemCallbackDispatcher* dispatcher) {
int request_id = dispatchers_.Add(dispatcher);
if (!ChildThread::current()->Send(
- new ViewHostMsg_FileSystem_Exists(request_id, path, is_directory))) {
+ new FileSystemHostMsg_Exists(request_id, path, is_directory))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
return false;
}
@@ -143,7 +141,7 @@ bool FileSystemDispatcher::ReadDirectory(
fileapi::FileSystemCallbackDispatcher* dispatcher) {
int request_id = dispatchers_.Add(dispatcher);
if (!ChildThread::current()->Send(
- new ViewHostMsg_FileSystem_ReadDirectory(request_id, path))) {
+ new FileSystemHostMsg_ReadDirectory(request_id, path))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
return false;
}
@@ -158,7 +156,7 @@ bool FileSystemDispatcher::Truncate(
fileapi::FileSystemCallbackDispatcher* dispatcher) {
int request_id = dispatchers_.Add(dispatcher);
if (!ChildThread::current()->Send(
- new ViewHostMsg_FileSystem_Truncate(request_id, path, offset))) {
+ new FileSystemHostMsg_Truncate(request_id, path, offset))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
return false;
}
@@ -176,8 +174,7 @@ bool FileSystemDispatcher::Write(
fileapi::FileSystemCallbackDispatcher* dispatcher) {
int request_id = dispatchers_.Add(dispatcher);
if (!ChildThread::current()->Send(
- new ViewHostMsg_FileSystem_Write(
- request_id, path, blob_url, offset))) {
+ new FileSystemHostMsg_Write(request_id, path, blob_url, offset))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
return false;
}
@@ -191,7 +188,7 @@ bool FileSystemDispatcher::Cancel(
int request_id_to_cancel,
fileapi::FileSystemCallbackDispatcher* dispatcher) {
int request_id = dispatchers_.Add(dispatcher);
- if (!ChildThread::current()->Send(new ViewHostMsg_FileSystem_CancelWrite(
+ if (!ChildThread::current()->Send(new FileSystemHostMsg_CancelWrite(
request_id, request_id_to_cancel))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
return false;
@@ -207,7 +204,7 @@ bool FileSystemDispatcher::TouchFile(
fileapi::FileSystemCallbackDispatcher* dispatcher) {
int request_id = dispatchers_.Add(dispatcher);
if (!ChildThread::current()->Send(
- new ViewHostMsg_FileSystem_TouchFile(
+ new FileSystemHostMsg_TouchFile(
request_id, path, last_access_time, last_modified_time))) {
dispatchers_.Remove(request_id); // destroys |dispatcher|
return false;
@@ -216,7 +213,7 @@ bool FileSystemDispatcher::TouchFile(
return true;
}
-void FileSystemDispatcher::OnOpenFileSystemRequestComplete(
+void FileSystemDispatcher::OnOpenComplete(
int request_id, bool accepted, const std::string& name,
const FilePath& root_path) {
fileapi::FileSystemCallbackDispatcher* dispatcher =
@@ -229,7 +226,7 @@ void FileSystemDispatcher::OnOpenFileSystemRequestComplete(
dispatchers_.Remove(request_id);
}
-void FileSystemDispatcher::DidSucceed(int request_id) {
+void FileSystemDispatcher::OnDidSucceed(int request_id) {
fileapi::FileSystemCallbackDispatcher* dispatcher =
dispatchers_.Lookup(request_id);
DCHECK(dispatcher);
@@ -237,7 +234,7 @@ void FileSystemDispatcher::DidSucceed(int request_id) {
dispatchers_.Remove(request_id);
}
-void FileSystemDispatcher::DidReadMetadata(
+void FileSystemDispatcher::OnDidReadMetadata(
int request_id, const base::PlatformFileInfo& file_info) {
fileapi::FileSystemCallbackDispatcher* dispatcher =
dispatchers_.Lookup(request_id);
@@ -246,7 +243,7 @@ void FileSystemDispatcher::DidReadMetadata(
dispatchers_.Remove(request_id);
}
-void FileSystemDispatcher::DidReadDirectory(
+void FileSystemDispatcher::OnDidReadDirectory(
int request_id,
const std::vector<base::FileUtilProxy::Entry>& entries,
bool has_more) {
@@ -257,7 +254,7 @@ void FileSystemDispatcher::DidReadDirectory(
dispatchers_.Remove(request_id);
}
-void FileSystemDispatcher::DidFail(
+void FileSystemDispatcher::OnDidFail(
int request_id, base::PlatformFileError error_code) {
fileapi::FileSystemCallbackDispatcher* dispatcher =
dispatchers_.Lookup(request_id);
@@ -266,7 +263,7 @@ void FileSystemDispatcher::DidFail(
dispatchers_.Remove(request_id);
}
-void FileSystemDispatcher::DidWrite(
+void FileSystemDispatcher::OnDidWrite(
int request_id, int64 bytes, bool complete) {
fileapi::FileSystemCallbackDispatcher* dispatcher =
dispatchers_.Lookup(request_id);
diff --git a/chrome/common/file_system/file_system_dispatcher.h b/chrome/common/file_system/file_system_dispatcher.h
index bc84d2a..65e1a6d 100644
--- a/chrome/common/file_system/file_system_dispatcher.h
+++ b/chrome/common/file_system/file_system_dispatcher.h
@@ -76,23 +76,21 @@ class FileSystemDispatcher : public IPC::Channel::Listener {
fileapi::FileSystemCallbackDispatcher* dispatcher);
private:
- // Message handler for OpenFileSystem.
- void OnOpenFileSystemRequestComplete(
+ // Message handlers.
+ void OnOpenComplete(
int request_id,
bool accepted,
const std::string& name,
const FilePath& root_path);
-
- // Message handlers for regular file system operations.
- void DidSucceed(int request_id);
- void DidReadMetadata(int request_id,
- const base::PlatformFileInfo& file_info);
- void DidReadDirectory(
+ void OnDidSucceed(int request_id);
+ void OnDidReadMetadata(int request_id,
+ const base::PlatformFileInfo& file_info);
+ void OnDidReadDirectory(
int request_id,
const std::vector<base::FileUtilProxy::Entry>& entries,
bool has_more);
- void DidFail(int request_id, base::PlatformFileError error_code);
- void DidWrite(int request_id, int64 bytes, bool complete);
+ void OnDidFail(int request_id, base::PlatformFileError error_code);
+ void OnDidWrite(int request_id, int64 bytes, bool complete);
IDMap<fileapi::FileSystemCallbackDispatcher, IDMapOwnPointer> dispatchers_;
diff --git a/chrome/common/pepper_file_messages.h b/chrome/common/pepper_file_messages.h
index eff4d153..1298414 100644
--- a/chrome/common/pepper_file_messages.h
+++ b/chrome/common/pepper_file_messages.h
@@ -6,7 +6,7 @@
#define CHROME_COMMON_PEPPER_FILE_MESSAGES_H_
#pragma once
-#include "chrome/common/common_param_traits.h"
+#include "content/common/common_param_traits.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_param_traits.h"
#include "ipc/ipc_platform_file.h"
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 777abe5..5a257f2 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -25,7 +25,6 @@
#include "ipc/ipc_platform_file.h" // ifdefed typedef.
#include "ui/base/clipboard/clipboard.h" // enum
#include "webkit/appcache/appcache_interfaces.h" // enum appcache::Status
-#include "webkit/fileapi/file_system_types.h" // enum fileapi::FileSystemType
#if defined(OS_MACOSX)
struct FontDescriptor;
@@ -456,11 +455,6 @@ struct ParamTraits<scoped_refptr<webkit_blob::BlobData> > {
static void Log(const param_type& p, std::string* l);
};
-template <>
-struct SimilarTypeTraits<fileapi::FileSystemType> {
- typedef int Type;
-};
-
// Traits for AudioBuffersState structure.
template <>
struct ParamTraits<AudioBuffersState> {
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 90d8717..23b997d 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -10,7 +10,6 @@
#include "build/build_config.h"
#include "base/file_path.h"
-#include "base/file_util_proxy.h"
#include "base/nullable_string16.h"
#include "base/platform_file.h"
#include "base/sync_socket.h"
@@ -948,32 +947,6 @@ IPC_MESSAGE_ROUTED0(ViewMsg_AccessibilityNotifications_ACK)
IPC_MESSAGE_ROUTED1(ViewMsg_DeviceOrientationUpdated,
ViewMsg_DeviceOrientationUpdated_Params)
-// WebFrameClient::openFileSystem response messages.
-IPC_MESSAGE_CONTROL4(ViewMsg_OpenFileSystemRequest_Complete,
- int /* request_id */,
- bool /* accepted */,
- std::string /* name */,
- FilePath /* root_path */)
-
-// WebFileSystem response messages.
-IPC_MESSAGE_CONTROL1(ViewMsg_FileSystem_DidSucceed,
- int /* request_id */)
-IPC_MESSAGE_CONTROL2(ViewMsg_FileSystem_DidReadMetadata,
- int /* request_id */,
- base::PlatformFileInfo)
-IPC_MESSAGE_CONTROL3(ViewMsg_FileSystem_DidReadDirectory,
- int /* request_id */,
- std::vector<base::FileUtilProxy::Entry> /* entries */,
- bool /* has_more */)
-
-IPC_MESSAGE_CONTROL3(ViewMsg_FileSystem_DidWrite,
- int /* request_id */,
- int64 /* byte count */,
- bool /* complete */)
-IPC_MESSAGE_CONTROL2(ViewMsg_FileSystem_DidFail,
- int /* request_id */,
- base::PlatformFileError /* error_code */)
-
// The response to ViewHostMsg_AsyncOpenFile.
IPC_MESSAGE_ROUTED3(ViewMsg_AsyncOpenFile_ACK,
base::PlatformFileError /* error_code */,
@@ -2283,85 +2256,6 @@ IPC_MESSAGE_CONTROL1(ViewHostMsg_DeviceOrientation_StopUpdating,
int /* render_view_id */)
//---------------------------------------------------------------------------
-// FileSystem API messages
-// These are messages sent from the renderer to the browser process.
-
-// WebFrameClient::openFileSystem() message.
-IPC_MESSAGE_CONTROL5(ViewHostMsg_OpenFileSystemRequest,
- int /* request_id */,
- GURL /* origin_url */,
- fileapi::FileSystemType /* type */,
- int64 /* requested_size */,
- bool /* create */)
-
-// WebFileSystem::move() message.
-IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Move,
- int /* request_id */,
- FilePath /* src path */,
- FilePath /* dest path */)
-
-// WebFileSystem::copy() message.
-IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Copy,
- int /* request_id */,
- FilePath /* src path */,
- FilePath /* dest path */)
-
-// WebFileSystem::remove() message.
-IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Remove,
- int /* request_id */,
- FilePath /* path */,
- bool /* recursive */)
-
-// WebFileSystem::readMetadata() message.
-IPC_MESSAGE_CONTROL2(ViewHostMsg_FileSystem_ReadMetadata,
- int /* request_id */,
- FilePath /* path */)
-
-// WebFileSystem::create() message.
-IPC_MESSAGE_CONTROL5(ViewHostMsg_FileSystem_Create,
- int /* request_id */,
- FilePath /* path */,
- bool /* exclusive */,
- bool /* is_directory */,
- bool /* recursive */)
-
-// WebFileSystem::exists() messages.
-IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Exists,
- int /* request_id */,
- FilePath /* path */,
- bool /* is_directory */)
-
-// WebFileSystem::readDirectory() message.
-IPC_MESSAGE_CONTROL2(ViewHostMsg_FileSystem_ReadDirectory,
- int /* request_id */,
- FilePath /* path */)
-
-// WebFileWriter::write() message.
-IPC_MESSAGE_CONTROL4(ViewHostMsg_FileSystem_Write,
- int /* request id */,
- FilePath /* file path */,
- GURL /* blob URL */,
- int64 /* position */)
-
-// WebFileWriter::truncate() message.
-IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Truncate,
- int /* request id */,
- FilePath /* file path */,
- int64 /* length */)
-
-// Pepper's Touch() message.
-IPC_MESSAGE_CONTROL4(ViewHostMsg_FileSystem_TouchFile,
- int /* request_id */,
- FilePath /* path */,
- base::Time /* last_access_time */,
- base::Time /* last_modified_time */)
-
-// WebFileWriter::cancel() message.
-IPC_MESSAGE_CONTROL2(ViewHostMsg_FileSystem_CancelWrite,
- int /* request id */,
- int /* id of request to cancel */)
-
-//---------------------------------------------------------------------------
// Blob messages:
// Registers a blob URL referring to the specified blob data.
diff --git a/chrome/common/render_messages_params.cc b/chrome/common/render_messages_params.cc
index 336d67b..02ac083 100644
--- a/chrome/common/render_messages_params.cc
+++ b/chrome/common/render_messages_params.cc
@@ -1490,32 +1490,6 @@ void ParamTraits<ViewHostMsg_DomMessage_Params>::Log(const param_type& p,
l->append(")");
}
-void ParamTraits<base::FileUtilProxy::Entry>::Write(
- Message* m,
- const param_type& p) {
- WriteParam(m, p.name);
- WriteParam(m, p.is_directory);
-}
-
-bool ParamTraits<base::FileUtilProxy::Entry>::Read(
- const Message* m,
- void** iter,
- param_type* p) {
- return
- ReadParam(m, iter, &p->name) &&
- ReadParam(m, iter, &p->is_directory);
-}
-
-void ParamTraits<base::FileUtilProxy::Entry>::Log(
- const param_type& p,
- std::string* l) {
- l->append("(");
- LogParam(p.name, l);
- l->append(", ");
- LogParam(p.is_directory, l);
- l->append(")");
-}
-
void ParamTraits<ViewHostMsg_AccessibilityNotification_Params>::Write(
Message* m,
const param_type& p) {
diff --git a/chrome/common/render_messages_params.h b/chrome/common/render_messages_params.h
index d698ca5..fb4b432 100644
--- a/chrome/common/render_messages_params.h
+++ b/chrome/common/render_messages_params.h
@@ -11,7 +11,6 @@
#include "app/surface/transport_dib.h"
#include "base/file_path.h"
-#include "base/file_util_proxy.h"
#include "base/ref_counted.h"
#include "base/shared_memory.h"
#include "base/time.h"
@@ -1103,14 +1102,6 @@ struct ParamTraits<ViewHostMsg_DomMessage_Params> {
};
template <>
-struct ParamTraits<base::FileUtilProxy::Entry> {
- typedef base::FileUtilProxy::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);
-};
-
-template <>
struct ParamTraits<ViewHostMsg_AccessibilityNotification_Params> {
typedef ViewHostMsg_AccessibilityNotification_Params param_type;
static void Write(Message* m, const param_type& p);
diff --git a/content/browser/file_system/file_system_dispatcher_host.cc b/content/browser/file_system/file_system_dispatcher_host.cc
index 051762a..0847c2b 100644
--- a/content/browser/file_system/file_system_dispatcher_host.cc
+++ b/content/browser/file_system/file_system_dispatcher_host.cc
@@ -15,8 +15,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_host/browser_render_process_host.h"
#include "chrome/common/net/url_request_context_getter.h"
-#include "chrome/common/render_messages.h"
-#include "chrome/common/render_messages_params.h"
+#include "content/common/file_system_messages.h"
#include "googleurl/src/gurl.h"
#include "net/url_request/url_request_context.h"
#include "webkit/fileapi/file_system_callback_dispatcher.h"
@@ -43,34 +42,32 @@ class BrowserFileSystemCallbackDispatcher
}
virtual void DidSucceed() {
- dispatcher_host_->Send(new ViewMsg_FileSystem_DidSucceed(request_id_));
+ dispatcher_host_->Send(new FileSystemMsg_DidSucceed(request_id_));
}
virtual void DidReadMetadata(const base::PlatformFileInfo& info) {
- dispatcher_host_->Send(new ViewMsg_FileSystem_DidReadMetadata(
+ dispatcher_host_->Send(new FileSystemMsg_DidReadMetadata(
request_id_, info));
}
virtual void DidReadDirectory(
const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more) {
- dispatcher_host_->Send(new ViewMsg_FileSystem_DidReadDirectory(
+ dispatcher_host_->Send(new FileSystemMsg_DidReadDirectory(
request_id_, entries, has_more));
}
virtual void DidOpenFileSystem(const std::string& name,
const FilePath& path) {
dispatcher_host_->Send(
- new ViewMsg_OpenFileSystemRequest_Complete(
- request_id_, !path.empty(), name, path));
+ new FileSystemMsg_OpenComplete(request_id_, !path.empty(), name, path));
}
virtual void DidFail(base::PlatformFileError error_code) {
- dispatcher_host_->Send(new ViewMsg_FileSystem_DidFail(
- request_id_, error_code));
+ dispatcher_host_->Send(new FileSystemMsg_DidFail(request_id_, error_code));
}
virtual void DidWrite(int64 bytes, bool complete) {
- dispatcher_host_->Send(new ViewMsg_FileSystem_DidWrite(
+ dispatcher_host_->Send(new FileSystemMsg_DidWrite(
request_id_, bytes, complete));
}
@@ -110,24 +107,24 @@ bool FileSystemDispatcherHost::OnMessageReceived(
*message_was_ok = true;
bool handled = true;
IPC_BEGIN_MESSAGE_MAP_EX(FileSystemDispatcherHost, message, *message_was_ok)
- IPC_MESSAGE_HANDLER(ViewHostMsg_OpenFileSystemRequest, OnOpenFileSystem)
- IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_Move, OnMove)
- 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_HANDLER(ViewHostMsg_FileSystem_Write, OnWrite)
- IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_Truncate, OnTruncate)
- IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_TouchFile, OnTouchFile)
- IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_CancelWrite, OnCancel)
+ IPC_MESSAGE_HANDLER(FileSystemHostMsg_Open, OnOpen)
+ IPC_MESSAGE_HANDLER(FileSystemHostMsg_Move, OnMove)
+ IPC_MESSAGE_HANDLER(FileSystemHostMsg_Copy, OnCopy)
+ IPC_MESSAGE_HANDLER(FileSystemMsg_Remove, OnRemove)
+ IPC_MESSAGE_HANDLER(FileSystemHostMsg_ReadMetadata, OnReadMetadata)
+ IPC_MESSAGE_HANDLER(FileSystemHostMsg_Create, OnCreate)
+ IPC_MESSAGE_HANDLER(FileSystemHostMsg_Exists, OnExists)
+ IPC_MESSAGE_HANDLER(FileSystemHostMsg_ReadDirectory, OnReadDirectory)
+ IPC_MESSAGE_HANDLER(FileSystemHostMsg_Write, OnWrite)
+ IPC_MESSAGE_HANDLER(FileSystemHostMsg_Truncate, OnTruncate)
+ IPC_MESSAGE_HANDLER(FileSystemHostMsg_TouchFile, OnTouchFile)
+ IPC_MESSAGE_HANDLER(FileSystemHostMsg_CancelWrite, OnCancel)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP_EX()
return handled;
}
-void FileSystemDispatcherHost::OnOpenFileSystem(
+void FileSystemDispatcherHost::OnOpen(
int request_id, const GURL& origin_url, fileapi::FileSystemType type,
int64 requested_size, bool create) {
ContentSetting content_setting =
@@ -139,7 +136,7 @@ void FileSystemDispatcherHost::OnOpenFileSystem(
if (content_setting == CONTENT_SETTING_BLOCK) {
// TODO(kinuko): Need to notify the UI thread to indicate that
// there's a blocked content.
- Send(new ViewMsg_OpenFileSystemRequest_Complete(
+ Send(new FileSystemMsg_OpenComplete(
request_id, false, std::string(), FilePath()));
return;
}
@@ -225,7 +222,7 @@ void FileSystemDispatcherHost::OnCancel(
write->Cancel(GetNewOperation(request_id));
} else {
// The write already finished; report that we failed to stop it.
- Send(new ViewMsg_FileSystem_DidFail(
+ Send(new FileSystemMsg_DidFail(
request_id, base::PLATFORM_FILE_ERROR_INVALID_OPERATION));
}
}
diff --git a/content/browser/file_system/file_system_dispatcher_host.h b/content/browser/file_system/file_system_dispatcher_host.h
index 728720e..c5bbafe 100644
--- a/content/browser/file_system/file_system_dispatcher_host.h
+++ b/content/browser/file_system/file_system_dispatcher_host.h
@@ -47,12 +47,14 @@ class FileSystemDispatcherHost : public BrowserMessageFilter {
virtual bool OnMessageReceived(const IPC::Message& message,
bool* message_was_ok);
+ void UnregisterOperation(int request_id);
- void OnOpenFileSystem(int request_id,
- const GURL& origin_url,
- fileapi::FileSystemType type,
- int64 requested_size,
- bool create);
+ private:
+ void OnOpen(int request_id,
+ const GURL& origin_url,
+ fileapi::FileSystemType type,
+ int64 requested_size,
+ bool create);
void OnMove(int request_id,
const FilePath& src_path,
const FilePath& dest_path);
@@ -78,9 +80,7 @@ class FileSystemDispatcherHost : public BrowserMessageFilter {
const base::Time& last_access_time,
const base::Time& last_modified_time);
void OnCancel(int request_id, int request_to_cancel);
- void UnregisterOperation(int request_id);
- private:
// Creates a new FileSystemOperation.
fileapi::FileSystemOperation* GetNewOperation(int request_id);
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 */)
diff --git a/content/content_common.gypi b/content/content_common.gypi
index b253e05..b11c701 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -22,6 +22,7 @@
'common/content_constants.h',
'common/content_switches.cc',
'common/content_switches.h',
+ 'common/file_system_messages.h',
'common/message_router.cc',
'common/message_router.h',
'common/notification_details.cc',
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index 800daaf..bc2bba1d 100644
--- a/ipc/ipc_message_utils.h
+++ b/ipc/ipc_message_utils.h
@@ -72,6 +72,7 @@ enum IPCMessageStart {
P2PMsgStart,
SocketStreamMsgStart,
ResourceMsgStart,
+ FileSystemMsgStart,
};
class DictionaryValue;