summaryrefslogtreecommitdiffstats
path: root/chrome/common/file_system
diff options
context:
space:
mode:
authorkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-30 22:30:12 +0000
committerkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-30 22:30:12 +0000
commitcd920c2ab434ec474f456f186996c9ace362bf79 (patch)
tree21ff915da298c6a567cf2a05b674a49c27f6b61b /chrome/common/file_system
parentf7578f5d14dbd1c2931b7f574ead27cc978ab73a (diff)
downloadchromium_src-cd920c2ab434ec474f456f186996c9ace362bf79.zip
chromium_src-cd920c2ab434ec474f456f186996c9ace362bf79.tar.gz
chromium_src-cd920c2ab434ec474f456f186996c9ace362bf79.tar.bz2
Revert 57915 - Add final part of IPC plumbing for FileSystem API.
BUG=32277 TEST=none; to be added when we have complete implementation. Review URL: http://codereview.chromium.org/3208007 TBR=kinuko@chromium.org,phajdan-jr Review URL: http://codereview.chromium.org/3245010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57923 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/file_system')
-rw-r--r--chrome/common/file_system/file_system_dispatcher.cc87
-rw-r--r--chrome/common/file_system/file_system_dispatcher.h45
-rw-r--r--chrome/common/file_system/webfilesystem_impl.cc32
3 files changed, 17 insertions, 147 deletions
diff --git a/chrome/common/file_system/file_system_dispatcher.cc b/chrome/common/file_system/file_system_dispatcher.cc
index f7022e1..81361d5 100644
--- a/chrome/common/file_system/file_system_dispatcher.cc
+++ b/chrome/common/file_system/file_system_dispatcher.cc
@@ -4,21 +4,14 @@
#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() {
}
@@ -39,10 +32,8 @@ FileSystemDispatcher::~FileSystemDispatcher() {
bool FileSystemDispatcher::OnMessageReceived(const IPC::Message& msg) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(FileSystemDispatcher, msg)
- 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_Succeeded, DidSucceed)
+ IPC_MESSAGE_HANDLER(ViewMsg_FileSystem_Failed, DidFail)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -56,52 +47,6 @@ 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);
@@ -109,33 +54,9 @@ void FileSystemDispatcher::DidSucceed(int request_id) {
callbacks->didSucceed();
}
-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) {
+void FileSystemDispatcher::DidFail(int request_id, int code) {
WebFileSystemCallbacks* callbacks = callbacks_.Lookup(request_id);
DCHECK(callbacks);
callbacks_.Remove(request_id);
- callbacks->didFail(code);
+ callbacks->didFail(static_cast<WebFileError>(code));
}
diff --git a/chrome/common/file_system/file_system_dispatcher.h b/chrome/common/file_system/file_system_dispatcher.h
index 70855d1..5c854c2 100644
--- a/chrome/common/file_system/file_system_dispatcher.h
+++ b/chrome/common/file_system/file_system_dispatcher.h
@@ -13,20 +13,11 @@
#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.
@@ -41,39 +32,13 @@ class FileSystemDispatcher {
const string16& src_path,
const string16& dest_path,
WebKit::WebFileSystemCallbacks* callbacks);
- 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);
+
+ // TODO(kinuko): add more implementation.
private:
- 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);
+ void DidSucceed(int32 callbacks_id);
+ void DidFail(int32 callbacks_id, int code);
+ // TODO(kinuko): add more callbacks.
IDMap<WebKit::WebFileSystemCallbacks> callbacks_;
diff --git a/chrome/common/file_system/webfilesystem_impl.cc b/chrome/common/file_system/webfilesystem_impl.cc
index 49a07d6..a9aa346 100644
--- a/chrome/common/file_system/webfilesystem_impl.cc
+++ b/chrome/common/file_system/webfilesystem_impl.cc
@@ -23,56 +23,40 @@ void WebFileSystemImpl::move(const WebString& src_path,
void WebFileSystemImpl::copy(const WebKit::WebString& src_path,
const WebKit::WebString& dest_path,
WebKit::WebFileSystemCallbacks* callbacks) {
- FileSystemDispatcher* dispatcher =
- ChildThread::current()->file_system_dispatcher();
- dispatcher->Copy(src_path, dest_path, callbacks);
+ // TODO(kinuko): not implemented yet.
}
void WebFileSystemImpl::remove(const WebString& path,
WebFileSystemCallbacks* callbacks) {
- FileSystemDispatcher* dispatcher =
- ChildThread::current()->file_system_dispatcher();
- dispatcher->Remove(path, callbacks);
+ // TODO(kinuko): not implemented yet.
}
void WebFileSystemImpl::readMetadata(const WebString& path,
WebFileSystemCallbacks* callbacks) {
- FileSystemDispatcher* dispatcher =
- ChildThread::current()->file_system_dispatcher();
- dispatcher->ReadMetadata(path, callbacks);
+ // TODO(kinuko): not implemented yet.
}
void WebFileSystemImpl::createFile(const WebString& path,
bool exclusive, WebFileSystemCallbacks* callbacks) {
- FileSystemDispatcher* dispatcher =
- ChildThread::current()->file_system_dispatcher();
- dispatcher->Create(path, exclusive, false, callbacks);
+ // TODO(kinuko): not implemented yet.
}
void WebFileSystemImpl::createDirectory(const WebString& path,
bool exclusive, WebFileSystemCallbacks* callbacks) {
- FileSystemDispatcher* dispatcher =
- ChildThread::current()->file_system_dispatcher();
- dispatcher->Create(path, exclusive, true, callbacks);
+ // TODO(kinuko): not implemented yet.
}
void WebFileSystemImpl::fileExists(const WebString& path,
WebFileSystemCallbacks* callbacks) {
- FileSystemDispatcher* dispatcher =
- ChildThread::current()->file_system_dispatcher();
- dispatcher->Exists(path, false, callbacks);
+ // TODO(kinuko): not implemented yet.
}
void WebFileSystemImpl::directoryExists(const WebString& path,
WebFileSystemCallbacks* callbacks) {
- FileSystemDispatcher* dispatcher =
- ChildThread::current()->file_system_dispatcher();
- dispatcher->Exists(path, true, callbacks);
+ // TODO(kinuko): not implemented yet.
}
void WebFileSystemImpl::readDirectory(const WebString& path,
WebFileSystemCallbacks* callbacks) {
- FileSystemDispatcher* dispatcher =
- ChildThread::current()->file_system_dispatcher();
- dispatcher->ReadDirectory(path, callbacks);
+ // TODO(kinuko): not implemented yet.
}