summaryrefslogtreecommitdiffstats
path: root/webkit/browser
diff options
context:
space:
mode:
authorkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-04 06:57:07 +0000
committerkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-04 06:57:07 +0000
commitf17d6a1d691a934430add3e2c58b92d4f6df0e47 (patch)
tree23c64315cdf1a308bf4a7abd854f418a1e1bb966 /webkit/browser
parent230d128b389379421074f7cd1f9d77e130967082 (diff)
downloadchromium_src-f17d6a1d691a934430add3e2c58b92d4f6df0e47.zip
chromium_src-f17d6a1d691a934430add3e2c58b92d4f6df0e47.tar.gz
chromium_src-f17d6a1d691a934430add3e2c58b92d4f6df0e47.tar.bz2
Rename CrossOperationDelegate to CopyOrMoveOperationDelegate
To make it crystal clear what it does. BUG=240658 TEST=CopyOrMoveOperationDelegateTest.* R=nhiroki@chromium.org Review URL: https://codereview.chromium.org/16352002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203880 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/browser')
-rw-r--r--webkit/browser/fileapi/copy_or_move_operation_delegate.cc (renamed from webkit/browser/fileapi/cross_operation_delegate.cc)48
-rw-r--r--webkit/browser/fileapi/copy_or_move_operation_delegate.h (renamed from webkit/browser/fileapi/cross_operation_delegate.h)18
-rw-r--r--webkit/browser/fileapi/copy_or_move_operation_delegate_unittest.cc (renamed from webkit/browser/fileapi/local_file_system_cross_operation_unittest.cc)56
-rw-r--r--webkit/browser/fileapi/local_file_system_operation.cc10
-rw-r--r--webkit/browser/fileapi/webkit_browser_fileapi.gypi4
5 files changed, 68 insertions, 68 deletions
diff --git a/webkit/browser/fileapi/cross_operation_delegate.cc b/webkit/browser/fileapi/copy_or_move_operation_delegate.cc
index c953ece..ce044d6 100644
--- a/webkit/browser/fileapi/cross_operation_delegate.cc
+++ b/webkit/browser/fileapi/copy_or_move_operation_delegate.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "webkit/browser/fileapi/cross_operation_delegate.h"
+#include "webkit/browser/fileapi/copy_or_move_operation_delegate.h"
#include "base/bind.h"
#include "base/files/file_path.h"
@@ -16,7 +16,7 @@
namespace fileapi {
-CrossOperationDelegate::CrossOperationDelegate(
+CopyOrMoveOperationDelegate::CopyOrMoveOperationDelegate(
FileSystemContext* file_system_context,
scoped_ptr<LocalFileSystemOperation> src_root_operation,
LocalFileSystemOperation* dest_root_operation,
@@ -33,15 +33,15 @@ CrossOperationDelegate::CrossOperationDelegate(
same_file_system_ = src_root_.IsInSameFileSystem(dest_root_);
}
-CrossOperationDelegate::~CrossOperationDelegate() {
+CopyOrMoveOperationDelegate::~CopyOrMoveOperationDelegate() {
}
-void CrossOperationDelegate::Run() {
+void CopyOrMoveOperationDelegate::Run() {
// Not supported; this should never be called.
NOTREACHED();
}
-void CrossOperationDelegate::RunRecursively() {
+void CopyOrMoveOperationDelegate::RunRecursively() {
// Perform light-weight checks first.
// It is an error to try to copy/move an entry into its child.
@@ -58,16 +58,16 @@ void CrossOperationDelegate::RunRecursively() {
// First try to copy/move it as a file.
CopyOrMoveFile(URLPair(src_root_, dest_root_),
- base::Bind(&CrossOperationDelegate::DidTryCopyOrMoveFile,
+ base::Bind(&CopyOrMoveOperationDelegate::DidTryCopyOrMoveFile,
AsWeakPtr()));
}
-void CrossOperationDelegate::ProcessFile(const FileSystemURL& src_url,
+void CopyOrMoveOperationDelegate::ProcessFile(const FileSystemURL& src_url,
const StatusCallback& callback) {
CopyOrMoveFile(URLPair(src_url, CreateDestURL(src_url)), callback);
}
-void CrossOperationDelegate::ProcessDirectory(const FileSystemURL& src_url,
+void CopyOrMoveOperationDelegate::ProcessDirectory(const FileSystemURL& src_url,
const StatusCallback& callback) {
FileSystemURL dest_url = CreateDestURL(src_url);
@@ -79,7 +79,7 @@ void CrossOperationDelegate::ProcessDirectory(const FileSystemURL& src_url,
dest_url, false /* exclusive */, false /* recursive */, callback);
}
-void CrossOperationDelegate::DidTryCopyOrMoveFile(
+void CopyOrMoveOperationDelegate::DidTryCopyOrMoveFile(
base::PlatformFileError error) {
if (error == base::PLATFORM_FILE_OK ||
error != base::PLATFORM_FILE_ERROR_NOT_A_FILE) {
@@ -91,11 +91,11 @@ void CrossOperationDelegate::DidTryCopyOrMoveFile(
// Try removing the dest_root_ to see if it exists and/or it is an
// empty directory.
NewDestOperation()->RemoveDirectory(
- dest_root_, base::Bind(&CrossOperationDelegate::DidTryRemoveDestRoot,
+ dest_root_, base::Bind(&CopyOrMoveOperationDelegate::DidTryRemoveDestRoot,
AsWeakPtr()));
}
-void CrossOperationDelegate::DidTryRemoveDestRoot(
+void CopyOrMoveOperationDelegate::DidTryRemoveDestRoot(
base::PlatformFileError error) {
if (error == base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY) {
callback_.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
@@ -112,11 +112,11 @@ void CrossOperationDelegate::DidTryRemoveDestRoot(
// and operation==MOVE case, probably we can just rename the root directory.
// http://crbug.com/172187
StartRecursiveOperation(
- src_root_, base::Bind(&CrossOperationDelegate::DidFinishCopy,
+ src_root_, base::Bind(&CopyOrMoveOperationDelegate::DidFinishCopy,
AsWeakPtr(), src_root_, callback_));
}
-void CrossOperationDelegate::CopyOrMoveFile(const URLPair& url_pair,
+void CopyOrMoveOperationDelegate::CopyOrMoveFile(const URLPair& url_pair,
const StatusCallback& callback) {
// Same filesystem case.
if (same_file_system_) {
@@ -134,15 +134,15 @@ void CrossOperationDelegate::CopyOrMoveFile(const URLPair& url_pair,
// Perform CreateSnapshotFile, CopyInForeignFile and then calls
// copy_callback which removes the source file if operation_type == MOVE.
StatusCallback copy_callback =
- base::Bind(&CrossOperationDelegate::DidFinishCopy, AsWeakPtr(),
+ base::Bind(&CopyOrMoveOperationDelegate::DidFinishCopy, AsWeakPtr(),
url_pair.src, callback);
NewSourceOperation()->CreateSnapshotFile(
url_pair.src,
- base::Bind(&CrossOperationDelegate::DidCreateSnapshot, AsWeakPtr(),
+ base::Bind(&CopyOrMoveOperationDelegate::DidCreateSnapshot, AsWeakPtr(),
url_pair, copy_callback));
}
-void CrossOperationDelegate::DidCreateSnapshot(
+void CopyOrMoveOperationDelegate::DidCreateSnapshot(
const URLPair& url_pair,
const StatusCallback& callback,
base::PlatformFileError error,
@@ -174,11 +174,11 @@ void CrossOperationDelegate::DidCreateSnapshot(
validator_.reset(
factory->CreateCopyOrMoveFileValidator(url_pair.src, platform_path));
validator_->StartValidation(
- base::Bind(&CrossOperationDelegate::DidValidateFile, AsWeakPtr(),
+ base::Bind(&CopyOrMoveOperationDelegate::DidValidateFile, AsWeakPtr(),
url_pair.dest, callback, file_info, platform_path));
}
-void CrossOperationDelegate::DidValidateFile(
+void CopyOrMoveOperationDelegate::DidValidateFile(
const FileSystemURL& dest,
const StatusCallback& callback,
const base::PlatformFileInfo& file_info,
@@ -192,7 +192,7 @@ void CrossOperationDelegate::DidValidateFile(
NewDestOperation()->CopyInForeignFile(platform_path, dest, callback);
}
-void CrossOperationDelegate::DidFinishCopy(
+void CopyOrMoveOperationDelegate::DidFinishCopy(
const FileSystemURL& src,
const StatusCallback& callback,
base::PlatformFileError error) {
@@ -207,11 +207,11 @@ void CrossOperationDelegate::DidFinishCopy(
// Remove the source for finalizing move operation.
NewSourceOperation()->Remove(
src, true /* recursive */,
- base::Bind(&CrossOperationDelegate::DidRemoveSourceForMove,
+ base::Bind(&CopyOrMoveOperationDelegate::DidRemoveSourceForMove,
AsWeakPtr(), callback));
}
-void CrossOperationDelegate::DidRemoveSourceForMove(
+void CopyOrMoveOperationDelegate::DidRemoveSourceForMove(
const StatusCallback& callback,
base::PlatformFileError error) {
if (error == base::PLATFORM_FILE_ERROR_NOT_FOUND)
@@ -219,7 +219,7 @@ void CrossOperationDelegate::DidRemoveSourceForMove(
callback.Run(error);
}
-FileSystemURL CrossOperationDelegate::CreateDestURL(
+FileSystemURL CopyOrMoveOperationDelegate::CreateDestURL(
const FileSystemURL& src_url) const {
DCHECK_EQ(src_root_.type(), src_url.type());
DCHECK_EQ(src_root_.origin(), src_url.origin());
@@ -233,11 +233,11 @@ FileSystemURL CrossOperationDelegate::CreateDestURL(
relative);
}
-LocalFileSystemOperation* CrossOperationDelegate::NewDestOperation() {
+LocalFileSystemOperation* CopyOrMoveOperationDelegate::NewDestOperation() {
return NewNestedOperation();
}
-LocalFileSystemOperation* CrossOperationDelegate::NewSourceOperation() {
+LocalFileSystemOperation* CopyOrMoveOperationDelegate::NewSourceOperation() {
if (same_file_system_)
return NewDestOperation();
return src_root_operation_->CreateNestedOperation();
diff --git a/webkit/browser/fileapi/cross_operation_delegate.h b/webkit/browser/fileapi/copy_or_move_operation_delegate.h
index d001a5e..1fce074 100644
--- a/webkit/browser/fileapi/cross_operation_delegate.h
+++ b/webkit/browser/fileapi/copy_or_move_operation_delegate.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef WEBKIT_BROWSER_FILEAPI_CROSS_OPERATION_DELEGATE_H_
-#define WEBKIT_BROWSER_FILEAPI_CROSS_OPERATION_DELEGATE_H_
+#ifndef WEBKIT_BROWSER_FILEAPI_COPY_OR_MOVE_OPERATION_DELEGATE_H_
+#define WEBKIT_BROWSER_FILEAPI_COPY_OR_MOVE_OPERATION_DELEGATE_H_
#include <stack>
@@ -20,16 +20,16 @@ namespace fileapi {
class CopyOrMoveFileValidator;
// A delegate class for recursive copy or move operations.
-class CrossOperationDelegate
+class CopyOrMoveOperationDelegate
: public RecursiveOperationDelegate,
- public base::SupportsWeakPtr<CrossOperationDelegate> {
+ public base::SupportsWeakPtr<CopyOrMoveOperationDelegate> {
public:
enum OperationType {
OPERATION_COPY,
OPERATION_MOVE
};
- CrossOperationDelegate(
+ CopyOrMoveOperationDelegate(
FileSystemContext* file_system_context,
scoped_ptr<LocalFileSystemOperation> src_root_operation,
LocalFileSystemOperation* dest_root_operation,
@@ -37,7 +37,7 @@ class CrossOperationDelegate
const FileSystemURL& dest_root,
OperationType operation_type,
const StatusCallback& callback);
- virtual ~CrossOperationDelegate();
+ virtual ~CopyOrMoveOperationDelegate();
// RecursiveOperationDelegate overrides:
virtual void Run() OVERRIDE;
@@ -47,7 +47,7 @@ class CrossOperationDelegate
virtual void ProcessDirectory(const FileSystemURL& url,
const StatusCallback& callback) OVERRIDE;
- using base::SupportsWeakPtr<CrossOperationDelegate>::AsWeakPtr;
+ using base::SupportsWeakPtr<CopyOrMoveOperationDelegate>::AsWeakPtr;
private:
struct URLPair {
@@ -115,9 +115,9 @@ class CrossOperationDelegate
scoped_ptr<CopyOrMoveFileValidator> validator_;
- DISALLOW_COPY_AND_ASSIGN(CrossOperationDelegate);
+ DISALLOW_COPY_AND_ASSIGN(CopyOrMoveOperationDelegate);
};
} // namespace fileapi
-#endif // WEBKIT_BROWSER_FILEAPI_CROSS_OPERATION_DELEGATE_H_
+#endif // WEBKIT_BROWSER_FILEAPI_COPY_OR_MOVE_OPERATION_DELEGATE_H_
diff --git a/webkit/browser/fileapi/local_file_system_cross_operation_unittest.cc b/webkit/browser/fileapi/copy_or_move_operation_delegate_unittest.cc
index cb0dfbf..b301bbf 100644
--- a/webkit/browser/fileapi/local_file_system_cross_operation_unittest.cc
+++ b/webkit/browser/fileapi/copy_or_move_operation_delegate_unittest.cc
@@ -35,9 +35,9 @@ void ExpectOk(base::PlatformFileError error) {
} // namespace
-class CrossOperationTestHelper {
+class CopyOrMoveOperationTestHelper {
public:
- CrossOperationTestHelper(
+ CopyOrMoveOperationTestHelper(
const GURL& origin,
FileSystemType src_type,
FileSystemType dest_type)
@@ -45,7 +45,7 @@ class CrossOperationTestHelper {
src_type_(src_type),
dest_type_(dest_type) {}
- ~CrossOperationTestHelper() {
+ ~CopyOrMoveOperationTestHelper() {
file_system_context_ = NULL;
quota_manager_proxy_->SimulateQuotaManagerDestroyed();
quota_manager_ = NULL;
@@ -232,13 +232,13 @@ class CrossOperationTestHelper {
scoped_refptr<quota::MockQuotaManagerProxy> quota_manager_proxy_;
scoped_refptr<quota::MockQuotaManager> quota_manager_;
- DISALLOW_COPY_AND_ASSIGN(CrossOperationTestHelper);
+ DISALLOW_COPY_AND_ASSIGN(CopyOrMoveOperationTestHelper);
};
-TEST(LocalFileSystemCrossOperationTest, CopySingleFile) {
- CrossOperationTestHelper helper(GURL("http://foo"),
- kFileSystemTypeTemporary,
- kFileSystemTypePersistent);
+TEST(LocalFileSystemCopyOrMoveOperationTest, CopySingleFile) {
+ CopyOrMoveOperationTestHelper helper(GURL("http://foo"),
+ kFileSystemTypeTemporary,
+ kFileSystemTypePersistent);
helper.SetUp();
FileSystemURL src = helper.SourceURL("a");
@@ -264,10 +264,10 @@ TEST(LocalFileSystemCrossOperationTest, CopySingleFile) {
ASSERT_EQ(src_increase, dest_increase);
}
-TEST(LocalFileSystemCrossOperationTest, MoveSingleFile) {
- CrossOperationTestHelper helper(GURL("http://foo"),
- kFileSystemTypeTemporary,
- kFileSystemTypePersistent);
+TEST(LocalFileSystemCopyOrMoveOperationTest, MoveSingleFile) {
+ CopyOrMoveOperationTestHelper helper(GURL("http://foo"),
+ kFileSystemTypeTemporary,
+ kFileSystemTypePersistent);
helper.SetUp();
FileSystemURL src = helper.SourceURL("a");
@@ -293,10 +293,10 @@ TEST(LocalFileSystemCrossOperationTest, MoveSingleFile) {
ASSERT_EQ(src_increase, dest_increase);
}
-TEST(LocalFileSystemCrossOperationTest, CopySingleDirectory) {
- CrossOperationTestHelper helper(GURL("http://foo"),
- kFileSystemTypeTemporary,
- kFileSystemTypePersistent);
+TEST(LocalFileSystemCopyOrMoveOperationTest, CopySingleDirectory) {
+ CopyOrMoveOperationTestHelper helper(GURL("http://foo"),
+ kFileSystemTypeTemporary,
+ kFileSystemTypePersistent);
helper.SetUp();
FileSystemURL src = helper.SourceURL("a");
@@ -322,10 +322,10 @@ TEST(LocalFileSystemCrossOperationTest, CopySingleDirectory) {
ASSERT_EQ(src_increase, dest_increase);
}
-TEST(LocalFileSystemCrossOperationTest, MoveSingleDirectory) {
- CrossOperationTestHelper helper(GURL("http://foo"),
- kFileSystemTypeTemporary,
- kFileSystemTypePersistent);
+TEST(LocalFileSystemCopyOrMoveOperationTest, MoveSingleDirectory) {
+ CopyOrMoveOperationTestHelper helper(GURL("http://foo"),
+ kFileSystemTypeTemporary,
+ kFileSystemTypePersistent);
helper.SetUp();
FileSystemURL src = helper.SourceURL("a");
@@ -351,10 +351,10 @@ TEST(LocalFileSystemCrossOperationTest, MoveSingleDirectory) {
ASSERT_EQ(src_increase, dest_increase);
}
-TEST(LocalFileSystemCrossOperationTest, CopyDirectory) {
- CrossOperationTestHelper helper(GURL("http://foo"),
- kFileSystemTypeTemporary,
- kFileSystemTypePersistent);
+TEST(LocalFileSystemCopyOrMoveOperationTest, CopyDirectory) {
+ CopyOrMoveOperationTestHelper helper(GURL("http://foo"),
+ kFileSystemTypeTemporary,
+ kFileSystemTypePersistent);
helper.SetUp();
FileSystemURL src = helper.SourceURL("a");
@@ -388,10 +388,10 @@ TEST(LocalFileSystemCrossOperationTest, CopyDirectory) {
ASSERT_EQ(src_increase, dest_increase);
}
-TEST(LocalFileSystemCrossOperationTest, MoveDirectory) {
- CrossOperationTestHelper helper(GURL("http://foo"),
- kFileSystemTypeTemporary,
- kFileSystemTypePersistent);
+TEST(LocalFileSystemCopyOrMoveOperationTest, MoveDirectory) {
+ CopyOrMoveOperationTestHelper helper(GURL("http://foo"),
+ kFileSystemTypeTemporary,
+ kFileSystemTypePersistent);
helper.SetUp();
FileSystemURL src = helper.SourceURL("a");
diff --git a/webkit/browser/fileapi/local_file_system_operation.cc b/webkit/browser/fileapi/local_file_system_operation.cc
index 644232e..32ed668 100644
--- a/webkit/browser/fileapi/local_file_system_operation.cc
+++ b/webkit/browser/fileapi/local_file_system_operation.cc
@@ -11,7 +11,7 @@
#include "net/base/escape.h"
#include "net/url_request/url_request_context.h"
#include "webkit/browser/fileapi/async_file_util.h"
-#include "webkit/browser/fileapi/cross_operation_delegate.h"
+#include "webkit/browser/fileapi/copy_or_move_operation_delegate.h"
#include "webkit/browser/fileapi/file_observers.h"
#include "webkit/browser/fileapi/file_system_context.h"
#include "webkit/browser/fileapi/file_system_file_util.h"
@@ -128,12 +128,12 @@ void LocalFileSystemOperation::Copy(const FileSystemURL& src_url,
DCHECK(!recursive_operation_delegate_);
recursive_operation_delegate_.reset(
- new CrossOperationDelegate(
+ new CopyOrMoveOperationDelegate(
file_system_context(),
src_operation.Pass(),
deleter.release(),
src_url, dest_url,
- CrossOperationDelegate::OPERATION_COPY,
+ CopyOrMoveOperationDelegate::OPERATION_COPY,
base::Bind(&LocalFileSystemOperation::DidFinishDelegatedOperation,
base::Unretained(this), callback)));
recursive_operation_delegate_->RunRecursively();
@@ -172,12 +172,12 @@ void LocalFileSystemOperation::Move(const FileSystemURL& src_url,
DCHECK(!recursive_operation_delegate_);
recursive_operation_delegate_.reset(
- new CrossOperationDelegate(
+ new CopyOrMoveOperationDelegate(
file_system_context(),
src_operation.Pass(),
deleter.release(),
src_url, dest_url,
- CrossOperationDelegate::OPERATION_MOVE,
+ CopyOrMoveOperationDelegate::OPERATION_MOVE,
base::Bind(&LocalFileSystemOperation::DidFinishDelegatedOperation,
base::Unretained(this), callback)));
recursive_operation_delegate_->RunRecursively();
diff --git a/webkit/browser/fileapi/webkit_browser_fileapi.gypi b/webkit/browser/fileapi/webkit_browser_fileapi.gypi
index 819e996..790cec0 100644
--- a/webkit/browser/fileapi/webkit_browser_fileapi.gypi
+++ b/webkit/browser/fileapi/webkit_browser_fileapi.gypi
@@ -9,8 +9,8 @@
'../browser/fileapi/async_file_util_adapter.cc',
'../browser/fileapi/async_file_util_adapter.h',
'../browser/fileapi/copy_or_move_file_validator.h',
- '../browser/fileapi/cross_operation_delegate.cc',
- '../browser/fileapi/cross_operation_delegate.h',
+ '../browser/fileapi/copy_or_move_operation_delegate.cc',
+ '../browser/fileapi/copy_or_move_operation_delegate.h',
'../browser/fileapi/external_mount_points.cc',
'../browser/fileapi/external_mount_points.h',
'../browser/fileapi/file_observers.h',