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

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

Issue 16352002: Rename CrossOperationDelegate to CopyOrMoveOperationDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 (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 #include "webkit/browser/fileapi/local_file_system_operation.h" 5 #include "webkit/browser/fileapi/local_file_system_operation.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/time.h" 9 #include "base/time.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "net/base/escape.h" 11 #include "net/base/escape.h"
12 #include "net/url_request/url_request_context.h" 12 #include "net/url_request/url_request_context.h"
13 #include "webkit/browser/fileapi/async_file_util.h" 13 #include "webkit/browser/fileapi/async_file_util.h"
14 #include "webkit/browser/fileapi/cross_operation_delegate.h" 14 #include "webkit/browser/fileapi/copy_or_move_operation_delegate.h"
15 #include "webkit/browser/fileapi/file_observers.h" 15 #include "webkit/browser/fileapi/file_observers.h"
16 #include "webkit/browser/fileapi/file_system_context.h" 16 #include "webkit/browser/fileapi/file_system_context.h"
17 #include "webkit/browser/fileapi/file_system_file_util.h" 17 #include "webkit/browser/fileapi/file_system_file_util.h"
18 #include "webkit/browser/fileapi/file_system_mount_point_provider.h" 18 #include "webkit/browser/fileapi/file_system_mount_point_provider.h"
19 #include "webkit/browser/fileapi/file_system_operation_context.h" 19 #include "webkit/browser/fileapi/file_system_operation_context.h"
20 #include "webkit/browser/fileapi/file_system_task_runners.h" 20 #include "webkit/browser/fileapi/file_system_task_runners.h"
21 #include "webkit/browser/fileapi/file_system_url.h" 21 #include "webkit/browser/fileapi/file_system_url.h"
22 #include "webkit/browser/fileapi/file_writer_delegate.h" 22 #include "webkit/browser/fileapi/file_writer_delegate.h"
23 #include "webkit/browser/fileapi/remove_operation_delegate.h" 23 #include "webkit/browser/fileapi/remove_operation_delegate.h"
24 #include "webkit/browser/fileapi/sandbox_file_stream_writer.h" 24 #include "webkit/browser/fileapi/sandbox_file_stream_writer.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 operation->AsLocalFileSystemOperation()); 121 operation->AsLocalFileSystemOperation());
122 DCHECK(src_operation); 122 DCHECK(src_operation);
123 result = src_operation->SetUp(src_url, OPERATION_MODE_READ); 123 result = src_operation->SetUp(src_url, OPERATION_MODE_READ);
124 if (result != base::PLATFORM_FILE_OK) { 124 if (result != base::PLATFORM_FILE_OK) {
125 callback.Run(result); 125 callback.Run(result);
126 return; 126 return;
127 } 127 }
128 128
129 DCHECK(!recursive_operation_delegate_); 129 DCHECK(!recursive_operation_delegate_);
130 recursive_operation_delegate_.reset( 130 recursive_operation_delegate_.reset(
131 new CrossOperationDelegate( 131 new CopyOrMoveOperationDelegate(
132 file_system_context(), 132 file_system_context(),
133 src_operation.Pass(), 133 src_operation.Pass(),
134 deleter.release(), 134 deleter.release(),
135 src_url, dest_url, 135 src_url, dest_url,
136 CrossOperationDelegate::OPERATION_COPY, 136 CopyOrMoveOperationDelegate::OPERATION_COPY,
137 base::Bind(&LocalFileSystemOperation::DidFinishDelegatedOperation, 137 base::Bind(&LocalFileSystemOperation::DidFinishDelegatedOperation,
138 base::Unretained(this), callback))); 138 base::Unretained(this), callback)));
139 recursive_operation_delegate_->RunRecursively(); 139 recursive_operation_delegate_->RunRecursively();
140 } 140 }
141 141
142 void LocalFileSystemOperation::Move(const FileSystemURL& src_url, 142 void LocalFileSystemOperation::Move(const FileSystemURL& src_url,
143 const FileSystemURL& dest_url, 143 const FileSystemURL& dest_url,
144 const StatusCallback& callback) { 144 const StatusCallback& callback) {
145 DCHECK(SetPendingOperationType(kOperationMove)); 145 DCHECK(SetPendingOperationType(kOperationMove));
146 scoped_ptr<LocalFileSystemOperation> deleter(this); 146 scoped_ptr<LocalFileSystemOperation> deleter(this);
(...skipping 18 matching lines...) Expand all
165 operation->AsLocalFileSystemOperation()); 165 operation->AsLocalFileSystemOperation());
166 DCHECK(src_operation); 166 DCHECK(src_operation);
167 result = src_operation->SetUp(src_url, OPERATION_MODE_WRITE); 167 result = src_operation->SetUp(src_url, OPERATION_MODE_WRITE);
168 if (result != base::PLATFORM_FILE_OK) { 168 if (result != base::PLATFORM_FILE_OK) {
169 callback.Run(result); 169 callback.Run(result);
170 return; 170 return;
171 } 171 }
172 172
173 DCHECK(!recursive_operation_delegate_); 173 DCHECK(!recursive_operation_delegate_);
174 recursive_operation_delegate_.reset( 174 recursive_operation_delegate_.reset(
175 new CrossOperationDelegate( 175 new CopyOrMoveOperationDelegate(
176 file_system_context(), 176 file_system_context(),
177 src_operation.Pass(), 177 src_operation.Pass(),
178 deleter.release(), 178 deleter.release(),
179 src_url, dest_url, 179 src_url, dest_url,
180 CrossOperationDelegate::OPERATION_MOVE, 180 CopyOrMoveOperationDelegate::OPERATION_MOVE,
181 base::Bind(&LocalFileSystemOperation::DidFinishDelegatedOperation, 181 base::Bind(&LocalFileSystemOperation::DidFinishDelegatedOperation,
182 base::Unretained(this), callback))); 182 base::Unretained(this), callback)));
183 recursive_operation_delegate_->RunRecursively(); 183 recursive_operation_delegate_->RunRecursively();
184 } 184 }
185 185
186 void LocalFileSystemOperation::DirectoryExists(const FileSystemURL& url, 186 void LocalFileSystemOperation::DirectoryExists(const FileSystemURL& url,
187 const StatusCallback& callback) { 187 const StatusCallback& callback) {
188 DCHECK(SetPendingOperationType(kOperationDirectoryExists)); 188 DCHECK(SetPendingOperationType(kOperationDirectoryExists));
189 189
190 base::PlatformFileError result = SetUp(url, OPERATION_MODE_READ); 190 base::PlatformFileError result = SetUp(url, OPERATION_MODE_READ);
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 } 871 }
872 872
873 bool LocalFileSystemOperation::SetPendingOperationType(OperationType type) { 873 bool LocalFileSystemOperation::SetPendingOperationType(OperationType type) {
874 if (pending_operation_ != kOperationNone) 874 if (pending_operation_ != kOperationNone)
875 return false; 875 return false;
876 pending_operation_ = type; 876 pending_operation_ = type;
877 return true; 877 return true;
878 } 878 }
879 879
880 } // namespace fileapi 880 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698