summaryrefslogtreecommitdiffstats
path: root/content/common
diff options
context:
space:
mode:
authorkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-28 04:59:23 +0000
committerkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-28 04:59:23 +0000
commit61d271f3a6d602bfb0ced0ba468cf66523d26341 (patch)
tree474312d15944881f541fc1e202ae28d332d18184 /content/common
parent1e57cab1ea720cd4126c398c18771df5e099e196 (diff)
downloadchromium_src-61d271f3a6d602bfb0ced0ba468cf66523d26341.zip
chromium_src-61d271f3a6d602bfb0ced0ba468cf66523d26341.tar.gz
chromium_src-61d271f3a6d602bfb0ced0ba468cf66523d26341.tar.bz2
Split FileAPI code for common|common_child|renderer
Move following files from content/common to content/common_child: - webfilesystem_callback_adapters.* - webfilesystem_impl.* - webfilewriter_impl.* Move following files from webkit/fileapi to webkit/common/fileapi: - directory_entry.h - file_system_types.h - file_system_url* - file_system_util* Move following files from webkit/fileapi to webkit/renderer/fileapi: - webfilewriter_base* BUG=239710 TBR=jamesr@chromium.org Review URL: https://codereview.chromium.org/15658004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202501 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common')
-rw-r--r--content/common/fileapi/file_system_dispatcher.h2
-rw-r--r--content/common/fileapi/file_system_messages.h4
-rw-r--r--content/common/fileapi/webfilesystem_callback_adapters.cc77
-rw-r--r--content/common/fileapi/webfilesystem_callback_adapters.h48
-rw-r--r--content/common/fileapi/webfilesystem_impl.cc144
-rw-r--r--content/common/fileapi/webfilesystem_impl.h69
-rw-r--r--content/common/fileapi/webfilewriter_impl.cc51
-rw-r--r--content/common/fileapi/webfilewriter_impl.h35
8 files changed, 3 insertions, 427 deletions
diff --git a/content/common/fileapi/file_system_dispatcher.h b/content/common/fileapi/file_system_dispatcher.h
index a1a7d2d..f7329e7 100644
--- a/content/common/fileapi/file_system_dispatcher.h
+++ b/content/common/fileapi/file_system_dispatcher.h
@@ -14,7 +14,7 @@
#include "base/process.h"
#include "ipc/ipc_listener.h"
#include "ipc/ipc_platform_file.h"
-#include "webkit/fileapi/file_system_types.h"
+#include "webkit/common/fileapi/file_system_types.h"
#include "webkit/quota/quota_types.h"
namespace base {
diff --git a/content/common/fileapi/file_system_messages.h b/content/common/fileapi/file_system_messages.h
index 8ba953d..1a7ad99 100644
--- a/content/common/fileapi/file_system_messages.h
+++ b/content/common/fileapi/file_system_messages.h
@@ -8,8 +8,8 @@
#include "googleurl/src/gurl.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_platform_file.h"
-#include "webkit/fileapi/directory_entry.h"
-#include "webkit/fileapi/file_system_types.h"
+#include "webkit/common/fileapi/directory_entry.h"
+#include "webkit/common/fileapi/file_system_types.h"
#include "webkit/quota/quota_types.h"
#define IPC_MESSAGE_START FileSystemMsgStart
diff --git a/content/common/fileapi/webfilesystem_callback_adapters.cc b/content/common/fileapi/webfilesystem_callback_adapters.cc
deleted file mode 100644
index f12adea..0000000
--- a/content/common/fileapi/webfilesystem_callback_adapters.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-// 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.
-
-#include "content/common/fileapi/webfilesystem_callback_adapters.h"
-
-#include <string>
-#include <vector>
-
-#include "base/logging.h"
-#include "base/utf_string_conversions.h"
-#include "googleurl/src/gurl.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebFileInfo.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallbacks.h"
-#include "webkit/base/file_path_string_conversions.h"
-#include "webkit/fileapi/directory_entry.h"
-#include "webkit/fileapi/file_system_util.h"
-#include "webkit/glue/webkit_glue.h"
-
-using WebKit::WebFileInfo;
-using WebKit::WebFileSystemCallbacks;
-using WebKit::WebFileSystemEntry;
-using WebKit::WebString;
-using WebKit::WebVector;
-
-namespace content {
-
-void FileStatusCallbackAdapter(
- WebKit::WebFileSystemCallbacks* callbacks,
- base::PlatformFileError error) {
- if (error == base::PLATFORM_FILE_OK)
- callbacks->didSucceed();
- else
- callbacks->didFail(::fileapi::PlatformFileErrorToWebFileError(error));
-}
-
-void ReadMetadataCallbackAdapter(
- WebKit::WebFileSystemCallbacks* callbacks,
- const base::PlatformFileInfo& file_info,
- const base::FilePath& platform_path) {
- WebFileInfo web_file_info;
- webkit_glue::PlatformFileInfoToWebFileInfo(file_info, &web_file_info);
- web_file_info.platformPath = webkit_base::FilePathToWebString(platform_path);
- callbacks->didReadMetadata(web_file_info);
-}
-
-void CreateSnapshotFileCallbackAdapter(
- WebKit::WebFileSystemCallbacks* callbacks,
- const base::PlatformFileInfo& file_info,
- const base::FilePath& platform_path) {
- WebFileInfo web_file_info;
- webkit_glue::PlatformFileInfoToWebFileInfo(file_info, &web_file_info);
- web_file_info.platformPath = webkit_base::FilePathToWebString(platform_path);
- callbacks->didCreateSnapshotFile(web_file_info);
-}
-
-void ReadDirectoryCallbackAdapater(
- WebKit::WebFileSystemCallbacks* callbacks,
- const std::vector<fileapi::DirectoryEntry>& entries,
- bool has_more) {
- WebVector<WebFileSystemEntry> file_system_entries(entries.size());
- for (size_t i = 0; i < entries.size(); i++) {
- file_system_entries[i].name =
- webkit_base::FilePathStringToWebString(entries[i].name);
- file_system_entries[i].isDirectory = entries[i].is_directory;
- }
- callbacks->didReadDirectory(file_system_entries, has_more);
-}
-
-void OpenFileSystemCallbackAdapter(
- WebKit::WebFileSystemCallbacks* callbacks,
- const std::string& name, const GURL& root) {
- callbacks->didOpenFileSystem(UTF8ToUTF16(name), root);
-}
-
-} // namespace content
diff --git a/content/common/fileapi/webfilesystem_callback_adapters.h b/content/common/fileapi/webfilesystem_callback_adapters.h
deleted file mode 100644
index 5f855ff..0000000
--- a/content/common/fileapi/webfilesystem_callback_adapters.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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_WEBFILESYSTEM_CALLBACK_ADAPTERS_H_
-#define CONTENT_COMMON_FILEAPI_WEBFILESYSTEM_CALLBACK_ADAPTERS_H_
-
-#include "base/basictypes.h"
-#include "base/platform_file.h"
-
-class GURL;
-
-namespace fileapi {
-struct DirectoryEntry;
-}
-
-namespace WebKit {
-class WebFileSystemCallbacks;
-}
-
-namespace content {
-
-void FileStatusCallbackAdapter(
- WebKit::WebFileSystemCallbacks* callbacks,
- base::PlatformFileError error);
-
-void ReadMetadataCallbackAdapter(
- WebKit::WebFileSystemCallbacks* callbacks,
- const base::PlatformFileInfo& file_info,
- const base::FilePath& platform_path);
-
-void CreateSnapshotFileCallbackAdapter(
- WebKit::WebFileSystemCallbacks* callbacks,
- const base::PlatformFileInfo& file_info,
- const base::FilePath& platform_path);
-
-void ReadDirectoryCallbackAdapater(
- WebKit::WebFileSystemCallbacks* callbacks,
- const std::vector<fileapi::DirectoryEntry>& entries,
- bool has_more);
-
-void OpenFileSystemCallbackAdapter(
- WebKit::WebFileSystemCallbacks* callbacks,
- const std::string& name, const GURL& root);
-
-} // namespace content
-
-#endif // CONTENT_COMMON_FILEAPI_WEBFILESYSTEM_CALLBACK_ADAPTERS_H_
diff --git a/content/common/fileapi/webfilesystem_impl.cc b/content/common/fileapi/webfilesystem_impl.cc
deleted file mode 100644
index 479484b..0000000
--- a/content/common/fileapi/webfilesystem_impl.cc
+++ /dev/null
@@ -1,144 +0,0 @@
-// 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.
-
-#include "content/common/fileapi/webfilesystem_impl.h"
-
-#include "base/bind.h"
-#include "content/common/child_thread.h"
-#include "content/common/fileapi/file_system_dispatcher.h"
-#include "content/common/fileapi/webfilesystem_callback_adapters.h"
-#include "content/common/fileapi/webfilewriter_impl.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebFileInfo.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallbacks.h"
-#include "webkit/glue/webkit_glue.h"
-
-using WebKit::WebFileInfo;
-using WebKit::WebFileSystemCallbacks;
-using WebKit::WebFileSystemEntry;
-using WebKit::WebString;
-using WebKit::WebURL;
-using WebKit::WebVector;
-
-namespace content {
-
-WebFileSystemImpl::WebFileSystemImpl() {
-}
-
-void WebFileSystemImpl::move(const WebURL& src_path,
- const WebURL& dest_path,
- WebFileSystemCallbacks* callbacks) {
- FileSystemDispatcher* dispatcher =
- ChildThread::current()->file_system_dispatcher();
- dispatcher->Move(GURL(src_path),
- GURL(dest_path),
- base::Bind(&FileStatusCallbackAdapter, callbacks));
-}
-
-void WebFileSystemImpl::copy(const WebURL& src_path,
- const WebURL& dest_path,
- WebFileSystemCallbacks* callbacks) {
- FileSystemDispatcher* dispatcher =
- ChildThread::current()->file_system_dispatcher();
- dispatcher->Copy(GURL(src_path),
- GURL(dest_path),
- base::Bind(&FileStatusCallbackAdapter, callbacks));
-}
-
-void WebFileSystemImpl::remove(const WebURL& path,
- WebFileSystemCallbacks* callbacks) {
- FileSystemDispatcher* dispatcher =
- ChildThread::current()->file_system_dispatcher();
- dispatcher->Remove(
- GURL(path),
- false /* recursive */,
- base::Bind(&FileStatusCallbackAdapter, callbacks));
-}
-
-void WebFileSystemImpl::removeRecursively(const WebURL& path,
- WebFileSystemCallbacks* callbacks) {
- FileSystemDispatcher* dispatcher =
- ChildThread::current()->file_system_dispatcher();
- dispatcher->Remove(
- GURL(path),
- true /* recursive */,
- base::Bind(&FileStatusCallbackAdapter, callbacks));
-}
-
-void WebFileSystemImpl::readMetadata(const WebURL& path,
- WebFileSystemCallbacks* callbacks) {
- FileSystemDispatcher* dispatcher =
- ChildThread::current()->file_system_dispatcher();
- dispatcher->ReadMetadata(
- GURL(path),
- base::Bind(&ReadMetadataCallbackAdapter, callbacks),
- base::Bind(&FileStatusCallbackAdapter, callbacks));
-}
-
-void WebFileSystemImpl::createFile(const WebURL& path,
- bool exclusive,
- WebFileSystemCallbacks* callbacks) {
- FileSystemDispatcher* dispatcher =
- ChildThread::current()->file_system_dispatcher();
- dispatcher->Create(
- GURL(path), exclusive, false /* directory */, false /* recursive */,
- base::Bind(&FileStatusCallbackAdapter, callbacks));
-}
-
-void WebFileSystemImpl::createDirectory(const WebURL& path,
- bool exclusive,
- WebFileSystemCallbacks* callbacks) {
- FileSystemDispatcher* dispatcher =
- ChildThread::current()->file_system_dispatcher();
- dispatcher->Create(
- GURL(path), exclusive, true /* directory */, false /* recursive */,
- base::Bind(&FileStatusCallbackAdapter, callbacks));
-}
-
-void WebFileSystemImpl::fileExists(const WebURL& path,
- WebFileSystemCallbacks* callbacks) {
- FileSystemDispatcher* dispatcher =
- ChildThread::current()->file_system_dispatcher();
- dispatcher->Exists(
- GURL(path), false /* directory */,
- base::Bind(&FileStatusCallbackAdapter, callbacks));
-}
-
-void WebFileSystemImpl::directoryExists(const WebURL& path,
- WebFileSystemCallbacks* callbacks) {
- FileSystemDispatcher* dispatcher =
- ChildThread::current()->file_system_dispatcher();
- dispatcher->Exists(
- GURL(path), true /* directory */,
- base::Bind(&FileStatusCallbackAdapter, callbacks));
-}
-
-void WebFileSystemImpl::readDirectory(const WebURL& path,
- WebFileSystemCallbacks* callbacks) {
- FileSystemDispatcher* dispatcher =
- ChildThread::current()->file_system_dispatcher();
- dispatcher->ReadDirectory(
- GURL(path),
- base::Bind(&ReadDirectoryCallbackAdapater, callbacks),
- base::Bind(&FileStatusCallbackAdapter, callbacks));
-}
-
-WebKit::WebFileWriter* WebFileSystemImpl::createFileWriter(
- const WebURL& path, WebKit::WebFileWriterClient* client) {
- return new WebFileWriterImpl(GURL(path), client);
-}
-
-void WebFileSystemImpl::createSnapshotFileAndReadMetadata(
- const WebKit::WebURL& path,
- WebKit::WebFileSystemCallbacks* callbacks) {
- FileSystemDispatcher* dispatcher =
- ChildThread::current()->file_system_dispatcher();
- dispatcher->CreateSnapshotFile(
- GURL(path),
- base::Bind(&CreateSnapshotFileCallbackAdapter, callbacks),
- base::Bind(&FileStatusCallbackAdapter, callbacks));
-}
-
-} // namespace content
diff --git a/content/common/fileapi/webfilesystem_impl.h b/content/common/fileapi/webfilesystem_impl.h
deleted file mode 100644
index fc742b4d..0000000
--- a/content/common/fileapi/webfilesystem_impl.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// 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_WEBFILESYSTEM_IMPL_H_
-#define CONTENT_COMMON_FILEAPI_WEBFILESYSTEM_IMPL_H_
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebFileSystem.h"
-
-namespace WebKit {
-class WebURL;
-class WebFileWriter;
-class WebFileWriterClient;
-}
-
-namespace content {
-
-class WebFileSystemImpl : public WebKit::WebFileSystem {
- public:
- WebFileSystemImpl();
- virtual ~WebFileSystemImpl() { }
-
- // WebFileSystem implementation.
- virtual void move(
- const WebKit::WebURL& src_path,
- const WebKit::WebURL& dest_path,
- WebKit::WebFileSystemCallbacks*) OVERRIDE;
- virtual void copy(
- const WebKit::WebURL& src_path,
- const WebKit::WebURL& dest_path,
- WebKit::WebFileSystemCallbacks*) OVERRIDE;
- virtual void remove(
- const WebKit::WebURL& path,
- WebKit::WebFileSystemCallbacks*) OVERRIDE;
- virtual void removeRecursively(
- const WebKit::WebURL& path,
- WebKit::WebFileSystemCallbacks*) OVERRIDE;
- virtual void readMetadata(
- const WebKit::WebURL& path,
- WebKit::WebFileSystemCallbacks*) OVERRIDE;
- virtual void createFile(
- const WebKit::WebURL& path,
- bool exclusive,
- WebKit::WebFileSystemCallbacks*) OVERRIDE;
- virtual void createDirectory(
- const WebKit::WebURL& path,
- bool exclusive,
- WebKit::WebFileSystemCallbacks*) OVERRIDE;
- virtual void fileExists(
- const WebKit::WebURL& path,
- WebKit::WebFileSystemCallbacks*) OVERRIDE;
- virtual void directoryExists(
- const WebKit::WebURL& path,
- WebKit::WebFileSystemCallbacks*) OVERRIDE;
- virtual void readDirectory(
- const WebKit::WebURL& path,
- WebKit::WebFileSystemCallbacks*) OVERRIDE;
- virtual WebKit::WebFileWriter* createFileWriter(
- const WebKit::WebURL& path, WebKit::WebFileWriterClient*) OVERRIDE;
- virtual void createSnapshotFileAndReadMetadata(
- const WebKit::WebURL& path,
- WebKit::WebFileSystemCallbacks*);
-};
-
-} // namespace content
-
-#endif // CONTENT_COMMON_FILEAPI_WEBFILESYSTEM_IMPL_H_
diff --git a/content/common/fileapi/webfilewriter_impl.cc b/content/common/fileapi/webfilewriter_impl.cc
deleted file mode 100644
index fed77f5..0000000
--- a/content/common/fileapi/webfilewriter_impl.cc
+++ /dev/null
@@ -1,51 +0,0 @@
-// 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.
-
-#include "content/common/fileapi/webfilewriter_impl.h"
-
-#include "base/bind.h"
-#include "content/common/child_thread.h"
-#include "content/common/fileapi/file_system_dispatcher.h"
-
-namespace content {
-
-namespace {
-
-inline FileSystemDispatcher* GetFileSystemDispatcher() {
- return ChildThread::current()->file_system_dispatcher();
-}
-
-} // namespace
-
-WebFileWriterImpl::WebFileWriterImpl(
- const GURL& path, WebKit::WebFileWriterClient* client)
- : WebFileWriterBase(path, client),
- request_id_(0) {
-}
-
-WebFileWriterImpl::~WebFileWriterImpl() {
-}
-
-void WebFileWriterImpl::DoTruncate(const GURL& path, int64 offset) {
- // The FileSystemDispatcher takes ownership of the CallbackDispatcher.
- GetFileSystemDispatcher()->Truncate(
- path, offset, &request_id_,
- base::Bind(&WebFileWriterImpl::DidFinish, AsWeakPtr()));
-}
-
-void WebFileWriterImpl::DoWrite(
- const GURL& path, const GURL& blob_url, int64 offset) {
- GetFileSystemDispatcher()->Write(
- path, blob_url, offset, &request_id_,
- base::Bind(&WebFileWriterImpl::DidWrite, AsWeakPtr()),
- base::Bind(&WebFileWriterImpl::DidFinish, AsWeakPtr()));
-}
-
-void WebFileWriterImpl::DoCancel() {
- GetFileSystemDispatcher()->Cancel(
- request_id_,
- base::Bind(&WebFileWriterImpl::DidFinish, AsWeakPtr()));
-}
-
-} // namespace content
diff --git a/content/common/fileapi/webfilewriter_impl.h b/content/common/fileapi/webfilewriter_impl.h
deleted file mode 100644
index 77550bf..0000000
--- a/content/common/fileapi/webfilewriter_impl.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// 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_WEBFILEWRITER_IMPL_H_
-#define CONTENT_COMMON_FILEAPI_WEBFILEWRITER_IMPL_H_
-
-#include "base/memory/ref_counted.h"
-#include "base/memory/weak_ptr.h"
-#include "webkit/fileapi/webfilewriter_base.h"
-
-namespace content {
-
-// An implementation of WebFileWriter for use in chrome renderers and workers.
-class WebFileWriterImpl : public fileapi::WebFileWriterBase,
- public base::SupportsWeakPtr<WebFileWriterImpl> {
- public:
- WebFileWriterImpl(const GURL& path, WebKit::WebFileWriterClient* client);
- virtual ~WebFileWriterImpl();
-
- protected:
- // WebFileWriterBase overrides
- virtual void DoTruncate(const GURL& path, int64 offset) OVERRIDE;
- virtual void DoWrite(const GURL& path, const GURL& blob_url,
- int64 offset) OVERRIDE;
- virtual void DoCancel() OVERRIDE;
-
- private:
- class CallbackDispatcher;
- int request_id_;
-};
-
-} // namespace content
-
-#endif // CONTENT_COMMON_FILEAPI_WEBFILEWRITER_IMPL_H_