| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_BROWSER_FILEAPI_CROSS_OPERATION_DELEGATE_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_COPY_OR_MOVE_OPERATION_DELEGATE_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_CROSS_OPERATION_DELEGATE_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_COPY_OR_MOVE_OPERATION_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <stack> | 8 #include <stack> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "webkit/browser/fileapi/recursive_operation_delegate.h" | 12 #include "webkit/browser/fileapi/recursive_operation_delegate.h" |
| 13 | 13 |
| 14 namespace webkit_blob { | 14 namespace webkit_blob { |
| 15 class ShareableFileReference; | 15 class ShareableFileReference; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace fileapi { | 18 namespace fileapi { |
| 19 | 19 |
| 20 class CopyOrMoveFileValidator; | 20 class CopyOrMoveFileValidator; |
| 21 | 21 |
| 22 // A delegate class for recursive copy or move operations. | 22 // A delegate class for recursive copy or move operations. |
| 23 class CrossOperationDelegate | 23 class CopyOrMoveOperationDelegate |
| 24 : public RecursiveOperationDelegate, | 24 : public RecursiveOperationDelegate, |
| 25 public base::SupportsWeakPtr<CrossOperationDelegate> { | 25 public base::SupportsWeakPtr<CopyOrMoveOperationDelegate> { |
| 26 public: | 26 public: |
| 27 enum OperationType { | 27 enum OperationType { |
| 28 OPERATION_COPY, | 28 OPERATION_COPY, |
| 29 OPERATION_MOVE | 29 OPERATION_MOVE |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 CrossOperationDelegate( | 32 CopyOrMoveOperationDelegate( |
| 33 FileSystemContext* file_system_context, | 33 FileSystemContext* file_system_context, |
| 34 scoped_ptr<LocalFileSystemOperation> src_root_operation, | 34 scoped_ptr<LocalFileSystemOperation> src_root_operation, |
| 35 LocalFileSystemOperation* dest_root_operation, | 35 LocalFileSystemOperation* dest_root_operation, |
| 36 const FileSystemURL& src_root, | 36 const FileSystemURL& src_root, |
| 37 const FileSystemURL& dest_root, | 37 const FileSystemURL& dest_root, |
| 38 OperationType operation_type, | 38 OperationType operation_type, |
| 39 const StatusCallback& callback); | 39 const StatusCallback& callback); |
| 40 virtual ~CrossOperationDelegate(); | 40 virtual ~CopyOrMoveOperationDelegate(); |
| 41 | 41 |
| 42 // RecursiveOperationDelegate overrides: | 42 // RecursiveOperationDelegate overrides: |
| 43 virtual void Run() OVERRIDE; | 43 virtual void Run() OVERRIDE; |
| 44 virtual void RunRecursively() OVERRIDE; | 44 virtual void RunRecursively() OVERRIDE; |
| 45 virtual void ProcessFile(const FileSystemURL& url, | 45 virtual void ProcessFile(const FileSystemURL& url, |
| 46 const StatusCallback& callback) OVERRIDE; | 46 const StatusCallback& callback) OVERRIDE; |
| 47 virtual void ProcessDirectory(const FileSystemURL& url, | 47 virtual void ProcessDirectory(const FileSystemURL& url, |
| 48 const StatusCallback& callback) OVERRIDE; | 48 const StatusCallback& callback) OVERRIDE; |
| 49 | 49 |
| 50 using base::SupportsWeakPtr<CrossOperationDelegate>::AsWeakPtr; | 50 using base::SupportsWeakPtr<CopyOrMoveOperationDelegate>::AsWeakPtr; |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 struct URLPair { | 53 struct URLPair { |
| 54 URLPair(const FileSystemURL& src, const FileSystemURL& dest) | 54 URLPair(const FileSystemURL& src, const FileSystemURL& dest) |
| 55 : src(src), | 55 : src(src), |
| 56 dest(dest) { | 56 dest(dest) { |
| 57 } | 57 } |
| 58 FileSystemURL src; | 58 FileSystemURL src; |
| 59 FileSystemURL dest; | 59 FileSystemURL dest; |
| 60 }; | 60 }; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 bool same_file_system_; | 108 bool same_file_system_; |
| 109 OperationType operation_type_; | 109 OperationType operation_type_; |
| 110 StatusCallback callback_; | 110 StatusCallback callback_; |
| 111 | 111 |
| 112 scoped_ptr<LocalFileSystemOperation> src_root_operation_; | 112 scoped_ptr<LocalFileSystemOperation> src_root_operation_; |
| 113 | 113 |
| 114 scoped_refptr<webkit_blob::ShareableFileReference> current_file_ref_; | 114 scoped_refptr<webkit_blob::ShareableFileReference> current_file_ref_; |
| 115 | 115 |
| 116 scoped_ptr<CopyOrMoveFileValidator> validator_; | 116 scoped_ptr<CopyOrMoveFileValidator> validator_; |
| 117 | 117 |
| 118 DISALLOW_COPY_AND_ASSIGN(CrossOperationDelegate); | 118 DISALLOW_COPY_AND_ASSIGN(CopyOrMoveOperationDelegate); |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 } // namespace fileapi | 121 } // namespace fileapi |
| 122 | 122 |
| 123 #endif // WEBKIT_BROWSER_FILEAPI_CROSS_OPERATION_DELEGATE_H_ | 123 #endif // WEBKIT_BROWSER_FILEAPI_COPY_OR_MOVE_OPERATION_DELEGATE_H_ |
| OLD | NEW |