Chromium Code Reviews| 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_FILEAPI_CROSS_OPERATION_DELEGATE_H_ | 5 #ifndef WEBKIT_FILEAPI_CROSS_OPERATION_DELEGATE_H_ |
| 6 #define WEBKIT_FILEAPI_CROSS_OPERATION_DELEGATE_H_ | 6 #define WEBKIT_FILEAPI_CROSS_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" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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<CrossOperationDelegate>::AsWeakPtr; |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 struct Request { | |
| 54 Request(const FileSystemURL& src, const FileSystemURL& dest, | |
|
kinuko
2013/04/18 03:32:00
nit: can we break the line after 'src,'
vandebo (ex-Chrome)
2013/04/19 01:07:18
With just src and dest, they fit on one line. Do
| |
| 55 const StatusCallback& callback) | |
| 56 : src(src), | |
| 57 dest(dest), | |
| 58 callback(callback) { | |
| 59 } | |
| 60 FileSystemURL src; | |
| 61 FileSystemURL dest; | |
| 62 StatusCallback callback; | |
| 63 }; | |
| 64 | |
| 53 void DidTryCopyOrMoveFile(base::PlatformFileError error); | 65 void DidTryCopyOrMoveFile(base::PlatformFileError error); |
| 54 void DidTryRemoveDestRoot(base::PlatformFileError error); | 66 void DidTryRemoveDestRoot(base::PlatformFileError error); |
| 55 void CopyOrMoveFile( | 67 void CopyOrMoveFile(const Request& request); |
| 56 const FileSystemURL& src, | |
| 57 const FileSystemURL& dest, | |
| 58 const StatusCallback& callback); | |
| 59 void DidCreateSnapshot( | 68 void DidCreateSnapshot( |
| 60 const FileSystemURL& dest, | 69 const Request& request, |
|
vandebo (ex-Chrome)
2013/04/17 23:50:48
In order to pass virtual_path into the copy valida
kinuko
2013/04/18 03:32:00
This looks fine, the name Request sounds a bit unc
vandebo (ex-Chrome)
2013/04/19 01:07:18
Done.
Named URLPair.
Since it's just the two val
| |
| 61 const StatusCallback& callback, | |
| 62 base::PlatformFileError error, | 70 base::PlatformFileError error, |
| 63 const base::PlatformFileInfo& file_info, | 71 const base::PlatformFileInfo& file_info, |
| 64 const base::FilePath& platform_path, | 72 const base::FilePath& platform_path, |
| 65 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref); | 73 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref); |
| 66 void DidValidateFile( | 74 void DidValidateFile( |
| 67 const FileSystemURL& dest, | 75 const Request& request, |
| 68 const StatusCallback& callback, | |
| 69 const base::PlatformFileInfo& file_info, | 76 const base::PlatformFileInfo& file_info, |
| 70 const base::FilePath& platform_path, | 77 const base::FilePath& platform_path, |
| 71 base::PlatformFileError error); | 78 base::PlatformFileError error); |
| 72 void DidFinishCopy( | 79 void DidFinishCopy( |
| 73 const FileSystemURL& src, | 80 const Request& request, |
| 74 const StatusCallback& callback, | |
| 75 base::PlatformFileError error); | 81 base::PlatformFileError error); |
| 76 void DidRemoveSourceForMove( | 82 void DidRemoveSourceForMove( |
| 77 const StatusCallback& callback, | 83 const Request& request, |
| 78 base::PlatformFileError error); | 84 base::PlatformFileError error); |
| 79 | 85 |
| 80 FileSystemURL CreateDestURL(const FileSystemURL& src_url) const; | 86 FileSystemURL CreateDestURL(const FileSystemURL& src_url) const; |
| 81 | 87 |
| 82 // Create nested operations for recursive task. | 88 // Create nested operations for recursive task. |
| 83 // When the creation fails it fires callback_ with the | 89 // When the creation fails it fires callback_ with the |
| 84 // error code and returns NULL. | 90 // error code and returns NULL. |
| 85 // | 91 // |
| 86 // - NewDestOperation is basically a thin wrapper of | 92 // - NewDestOperation is basically a thin wrapper of |
| 87 // RecursiveOperationDelegate::NewOperation(). | 93 // RecursiveOperationDelegate::NewOperation(). |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 106 scoped_refptr<webkit_blob::ShareableFileReference> current_file_ref_; | 112 scoped_refptr<webkit_blob::ShareableFileReference> current_file_ref_; |
| 107 | 113 |
| 108 scoped_ptr<CopyOrMoveFileValidator> validator_; | 114 scoped_ptr<CopyOrMoveFileValidator> validator_; |
| 109 | 115 |
| 110 DISALLOW_COPY_AND_ASSIGN(CrossOperationDelegate); | 116 DISALLOW_COPY_AND_ASSIGN(CrossOperationDelegate); |
| 111 }; | 117 }; |
| 112 | 118 |
| 113 } // namespace fileapi | 119 } // namespace fileapi |
| 114 | 120 |
| 115 #endif // WEBKIT_FILEAPI_CROSS_OPERATION_DELEGATE_H_ | 121 #endif // WEBKIT_FILEAPI_CROSS_OPERATION_DELEGATE_H_ |
| OLD | NEW |