OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_FILE_SYSTEM_OPERATION_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ |
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/file_util_proxy.h" | 12 #include "base/file_util_proxy.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/message_loop_proxy.h" | |
17 #include "base/platform_file.h" | 16 #include "base/platform_file.h" |
18 #include "base/process.h" | 17 #include "base/process.h" |
19 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
20 #include "webkit/fileapi/file_system_operation_context.h" | 19 #include "webkit/fileapi/file_system_operation_context.h" |
21 #include "webkit/fileapi/file_system_operation_interface.h" | 20 #include "webkit/fileapi/file_system_operation_interface.h" |
22 #include "webkit/fileapi/file_system_types.h" | 21 #include "webkit/fileapi/file_system_types.h" |
23 #include "webkit/quota/quota_manager.h" | 22 #include "webkit/quota/quota_manager.h" |
24 | 23 |
25 namespace base { | 24 namespace base { |
26 class Time; | 25 class Time; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 friend class IsolatedMountPointProvider; | 122 friend class IsolatedMountPointProvider; |
124 friend class SandboxMountPointProvider; | 123 friend class SandboxMountPointProvider; |
125 friend class chromeos::CrosMountPointProvider; | 124 friend class chromeos::CrosMountPointProvider; |
126 | 125 |
127 friend class FileSystemOperationTest; | 126 friend class FileSystemOperationTest; |
128 friend class FileSystemOperationWriteTest; | 127 friend class FileSystemOperationWriteTest; |
129 friend class FileWriterDelegateTest; | 128 friend class FileWriterDelegateTest; |
130 friend class FileSystemTestOriginHelper; | 129 friend class FileSystemTestOriginHelper; |
131 friend class FileSystemQuotaTest; | 130 friend class FileSystemQuotaTest; |
132 | 131 |
133 FileSystemOperation(scoped_refptr<base::MessageLoopProxy> proxy, | 132 FileSystemOperation(FileSystemContext* file_system_context); |
134 FileSystemContext* file_system_context); | |
135 | 133 |
136 FileSystemContext* file_system_context() const { | 134 FileSystemContext* file_system_context() const { |
137 return operation_context_.file_system_context(); | 135 return operation_context_.file_system_context(); |
138 } | 136 } |
139 | 137 |
140 FileSystemOperationContext* file_system_operation_context() { | 138 FileSystemOperationContext* file_system_operation_context() { |
141 return &operation_context_; | 139 return &operation_context_; |
142 } | 140 } |
143 | 141 |
144 // The unit tests that need to specify and control the lifetime of the | 142 // The unit tests that need to specify and control the lifetime of the |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 base::PlatformFileError SetUpFileSystemPath( | 227 base::PlatformFileError SetUpFileSystemPath( |
230 const GURL& path_url, | 228 const GURL& path_url, |
231 FileSystemPath* file_system_path, | 229 FileSystemPath* file_system_path, |
232 FileSystemFileUtil** file_util, | 230 FileSystemFileUtil** file_util, |
233 SetUpPathMode mode); | 231 SetUpPathMode mode); |
234 | 232 |
235 // Used only for internal assertions. | 233 // Used only for internal assertions. |
236 // Returns false if there's another inflight pending operation. | 234 // Returns false if there's another inflight pending operation. |
237 bool SetPendingOperationType(OperationType type); | 235 bool SetPendingOperationType(OperationType type); |
238 | 236 |
239 // Proxy for calling file_util_proxy methods. | |
240 scoped_refptr<base::MessageLoopProxy> proxy_; | |
241 | |
242 FileSystemOperationContext operation_context_; | 237 FileSystemOperationContext operation_context_; |
243 FileSystemPath src_path_; | 238 FileSystemPath src_path_; |
244 FileSystemPath dest_path_; | 239 FileSystemPath dest_path_; |
245 FileSystemFileUtil* src_util_; // Not owned. | 240 FileSystemFileUtil* src_util_; // Not owned. |
246 FileSystemFileUtil* dest_util_; // Not owned. | 241 FileSystemFileUtil* dest_util_; // Not owned. |
247 | 242 |
248 // This is set before any write operations. The destructor of | 243 // This is set before any write operations. The destructor of |
249 // ScopedQuotaNotifier sends notification to the QuotaManager | 244 // ScopedQuotaNotifier sends notification to the QuotaManager |
250 // to tell the update is done; so that we can make sure notify | 245 // to tell the update is done; so that we can make sure notify |
251 // the manager after any write operations are done. | 246 // the manager after any write operations are done. |
(...skipping 20 matching lines...) Expand all Loading... |
272 | 267 |
273 // A flag to make sure we call operation only once per instance. | 268 // A flag to make sure we call operation only once per instance. |
274 OperationType pending_operation_; | 269 OperationType pending_operation_; |
275 | 270 |
276 DISALLOW_COPY_AND_ASSIGN(FileSystemOperation); | 271 DISALLOW_COPY_AND_ASSIGN(FileSystemOperation); |
277 }; | 272 }; |
278 | 273 |
279 } // namespace fileapi | 274 } // namespace fileapi |
280 | 275 |
281 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ | 276 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ |
OLD | NEW |