diff options
author | tzik@chromium.org <tzik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-01 19:08:20 +0000 |
---|---|---|
committer | tzik@chromium.org <tzik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-01 19:08:20 +0000 |
commit | 16dd6e258292b24af7fc5625543e52651c92ce50 (patch) | |
tree | 7528b35d03aa90505a407b04aa7c734aeda5ee3d /content/common/fileapi/file_system_dispatcher.h | |
parent | 3d7e97a0290ab41e770b5c67a8a2a2871c9c32b4 (diff) | |
download | chromium_src-16dd6e258292b24af7fc5625543e52651c92ce50.zip chromium_src-16dd6e258292b24af7fc5625543e52651c92ce50.tar.gz chromium_src-16dd6e258292b24af7fc5625543e52651c92ce50.tar.bz2 |
Rename content/{common,browser}/file_system to fileapi and move blob stuff into it.
This patch:
- renames content/{common,browser]/file_system to content/{common,browser}/fileapi,
- moves content/browser/chrome_blob_storage_context.{h,cc} into content/browser/fileapi,
- moves content/common/webblob_registry_impl.{h,cc} into content/common/fileapi,
- moves content/common/{file_system_messages.h,webblob_messages.h} into content/common/fileapi,
- adds jianli@ to OWNERS of content/{browser,common}/fileapi,
- rename FileAndBlobMessageFilter to FileAPIMessageFilter.
BUG=115603
TEST='Build should finish successfully'
Review URL: http://codereview.chromium.org/9558006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124439 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/fileapi/file_system_dispatcher.h')
-rw-r--r-- | content/common/fileapi/file_system_dispatcher.h | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/content/common/fileapi/file_system_dispatcher.h b/content/common/fileapi/file_system_dispatcher.h new file mode 100644 index 0000000..8da0ff3 --- /dev/null +++ b/content/common/fileapi/file_system_dispatcher.h @@ -0,0 +1,114 @@ +// Copyright (c) 2012 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. + +#ifndef CONTENT_COMMON_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ +#define CONTENT_COMMON_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ + +#include <string> +#include <vector> + +#include "base/basictypes.h" +#include "base/file_util_proxy.h" +#include "base/id_map.h" +#include "base/process.h" +#include "ipc/ipc_channel.h" +#include "ipc/ipc_message.h" +#include "ipc/ipc_platform_file.h" +#include "webkit/fileapi/file_system_callback_dispatcher.h" +#include "webkit/fileapi/file_system_types.h" + +namespace base { +struct PlatformFileInfo; +} + +class FilePath; +class GURL; + +// 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. +class FileSystemDispatcher : public IPC::Channel::Listener { + public: + FileSystemDispatcher(); + virtual ~FileSystemDispatcher(); + + // IPC::Channel::Listener implementation. + virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; + + bool OpenFileSystem(const GURL& origin_url, + fileapi::FileSystemType type, + long long size, + bool create, + fileapi::FileSystemCallbackDispatcher* dispatcher); + bool Move(const GURL& src_path, + const GURL& dest_path, + fileapi::FileSystemCallbackDispatcher* dispatcher); + bool Copy(const GURL& src_path, + const GURL& dest_path, + fileapi::FileSystemCallbackDispatcher* dispatcher); + bool Remove(const GURL& path, + bool recursive, + fileapi::FileSystemCallbackDispatcher* dispatcher); + bool ReadMetadata(const GURL& path, + fileapi::FileSystemCallbackDispatcher* dispatcher); + bool Create(const GURL& path, + bool exclusive, + bool is_directory, + bool recursive, + fileapi::FileSystemCallbackDispatcher* dispatcher); + bool Exists(const GURL& path, + bool for_directory, + fileapi::FileSystemCallbackDispatcher* dispatcher); + bool ReadDirectory(const GURL& path, + fileapi::FileSystemCallbackDispatcher* dispatcher); + bool Truncate(const GURL& path, + int64 offset, + int* request_id_out, + fileapi::FileSystemCallbackDispatcher* dispatcher); + bool Write(const GURL& path, + const GURL& blob_url, + int64 offset, + int* request_id_out, + fileapi::FileSystemCallbackDispatcher* dispatcher); + bool Cancel(int request_id_to_cancel, + fileapi::FileSystemCallbackDispatcher* dispatcher); + bool TouchFile(const GURL& file_path, + const base::Time& last_access_time, + const base::Time& last_modified_time, + fileapi::FileSystemCallbackDispatcher* dispatcher); + + // This returns a raw open PlatformFile, unlike the above, which are + // self-contained operations. + bool OpenFile(const GURL& file_path, + int file_flags, // passed to FileUtilProxy::CreateOrOpen + fileapi::FileSystemCallbackDispatcher* dispatcher); + + bool CreateSnapshotFile(const GURL& blod_url, + const GURL& file_path, + fileapi::FileSystemCallbackDispatcher* dispatcher); + private: + // Message handlers. + void OnDidOpenFileSystem(int request_id, + const std::string& name, + const GURL& root); + void OnDidSucceed(int request_id); + void OnDidReadMetadata(int request_id, + const base::PlatformFileInfo& file_info, + const FilePath& platform_path); + void OnDidReadDirectory( + int request_id, + const std::vector<base::FileUtilProxy::Entry>& entries, + bool has_more); + void OnDidFail(int request_id, base::PlatformFileError error_code); + void OnDidWrite(int request_id, int64 bytes, bool complete); + void OnDidOpenFile( + int request_id, + IPC::PlatformFileForTransit file); + + IDMap<fileapi::FileSystemCallbackDispatcher, IDMapOwnPointer> dispatchers_; + + DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher); +}; + +#endif // CONTENT_COMMON_FILEAPI_FILE_SYSTEM_DISPATCHER_H_ |