Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: webkit/browser/fileapi/file_system_operation_impl.cc

Issue 23835005: Remove dependency to file_system_operation_impl.h from chrome/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "webkit/browser/fileapi/file_system_operation_impl.h" 5 #include "webkit/browser/fileapi/file_system_operation_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 13 matching lines...) Expand all
24 #include "webkit/browser/quota/quota_manager.h" 24 #include "webkit/browser/quota/quota_manager.h"
25 #include "webkit/common/blob/shareable_file_reference.h" 25 #include "webkit/common/blob/shareable_file_reference.h"
26 #include "webkit/common/fileapi/file_system_types.h" 26 #include "webkit/common/fileapi/file_system_types.h"
27 #include "webkit/common/fileapi/file_system_util.h" 27 #include "webkit/common/fileapi/file_system_util.h"
28 #include "webkit/common/quota/quota_types.h" 28 #include "webkit/common/quota/quota_types.h"
29 29
30 using webkit_blob::ScopedFile; 30 using webkit_blob::ScopedFile;
31 31
32 namespace fileapi { 32 namespace fileapi {
33 33
34 FileSystemOperationImpl::FileSystemOperationImpl( 34 FileSystemOperation* FileSystemOperation::Create(
35 const FileSystemURL& url, 35 const FileSystemURL& url,
36 FileSystemContext* file_system_context, 36 FileSystemContext* file_system_context,
37 scoped_ptr<FileSystemOperationContext> operation_context) 37 scoped_ptr<FileSystemOperationContext> operation_context) {
38 : file_system_context_(file_system_context), 38 return new FileSystemOperationImpl(url, file_system_context,
39 operation_context_(operation_context.Pass()), 39 operation_context.Pass());
40 async_file_util_(NULL),
41 peer_handle_(base::kNullProcessHandle),
42 pending_operation_(kOperationNone),
43 weak_factory_(this) {
44 DCHECK(operation_context_.get());
45 operation_context_->DetachUserDataThread();
46 async_file_util_ = file_system_context_->GetAsyncFileUtil(url.type());
47 DCHECK(async_file_util_);
48 } 40 }
49 41
50 FileSystemOperationImpl::~FileSystemOperationImpl() { 42 FileSystemOperationImpl::~FileSystemOperationImpl() {
51 } 43 }
52 44
53 void FileSystemOperationImpl::CreateFile(const FileSystemURL& url, 45 void FileSystemOperationImpl::CreateFile(const FileSystemURL& url,
54 bool exclusive, 46 bool exclusive,
55 const StatusCallback& callback) { 47 const StatusCallback& callback) {
56 DCHECK(SetPendingOperationType(kOperationCreateFile)); 48 DCHECK(SetPendingOperationType(kOperationCreateFile));
57 GetUsageAndQuotaThenRunTask( 49 GetUsageAndQuotaThenRunTask(
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 base::FilePath* platform_path) { 303 base::FilePath* platform_path) {
312 DCHECK(SetPendingOperationType(kOperationGetLocalPath)); 304 DCHECK(SetPendingOperationType(kOperationGetLocalPath));
313 if (!file_system_context()->IsSandboxFileSystem(url.type())) 305 if (!file_system_context()->IsSandboxFileSystem(url.type()))
314 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; 306 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
315 FileSystemFileUtil* file_util = 307 FileSystemFileUtil* file_util =
316 file_system_context()->sandbox_delegate()->sync_file_util(); 308 file_system_context()->sandbox_delegate()->sync_file_util();
317 file_util->GetLocalFilePath(operation_context_.get(), url, platform_path); 309 file_util->GetLocalFilePath(operation_context_.get(), url, platform_path);
318 return base::PLATFORM_FILE_OK; 310 return base::PLATFORM_FILE_OK;
319 } 311 }
320 312
313 FileSystemOperationImpl::FileSystemOperationImpl(
314 const FileSystemURL& url,
315 FileSystemContext* file_system_context,
316 scoped_ptr<FileSystemOperationContext> operation_context)
317 : file_system_context_(file_system_context),
318 operation_context_(operation_context.Pass()),
319 async_file_util_(NULL),
320 peer_handle_(base::kNullProcessHandle),
321 pending_operation_(kOperationNone),
322 weak_factory_(this) {
323 DCHECK(operation_context_.get());
324 operation_context_->DetachUserDataThread();
325 async_file_util_ = file_system_context_->GetAsyncFileUtil(url.type());
326 DCHECK(async_file_util_);
327 }
328
321 void FileSystemOperationImpl::GetUsageAndQuotaThenRunTask( 329 void FileSystemOperationImpl::GetUsageAndQuotaThenRunTask(
322 const FileSystemURL& url, 330 const FileSystemURL& url,
323 const base::Closure& task, 331 const base::Closure& task,
324 const base::Closure& error_callback) { 332 const base::Closure& error_callback) {
325 quota::QuotaManagerProxy* quota_manager_proxy = 333 quota::QuotaManagerProxy* quota_manager_proxy =
326 file_system_context()->quota_manager_proxy(); 334 file_system_context()->quota_manager_proxy();
327 if (!quota_manager_proxy || 335 if (!quota_manager_proxy ||
328 !file_system_context()->GetQuotaUtil(url.type())) { 336 !file_system_context()->GetQuotaUtil(url.type())) {
329 // If we don't have the quota manager or the requested filesystem type 337 // If we don't have the quota manager or the requested filesystem type
330 // does not support quota, we should be able to let it go. 338 // does not support quota, we should be able to let it go.
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 } 540 }
533 541
534 bool FileSystemOperationImpl::SetPendingOperationType(OperationType type) { 542 bool FileSystemOperationImpl::SetPendingOperationType(OperationType type) {
535 if (pending_operation_ != kOperationNone) 543 if (pending_operation_ != kOperationNone)
536 return false; 544 return false;
537 pending_operation_ = type; 545 pending_operation_ = type;
538 return true; 546 return true;
539 } 547 }
540 548
541 } // namespace fileapi 549 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/file_system_operation_impl.h ('k') | webkit/browser/fileapi/file_system_operation_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698