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

Side by Side Diff: webkit/fileapi/file_util_helper.cc

Issue 10815003: Adding FileUtil::CreateSnapshotFile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
« no previous file with comments | « webkit/fileapi/file_system_operation.cc ('k') | webkit/fileapi/isolated_file_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/fileapi/file_util_helper.h" 5 #include "webkit/fileapi/file_util_helper.h"
6 6
7 #include <stack> 7 #include <stack>
8 8
9 #include "webkit/blob/shareable_file_reference.h"
9 #include "webkit/fileapi/file_system_file_util.h" 10 #include "webkit/fileapi/file_system_file_util.h"
10 #include "webkit/fileapi/file_system_operation_context.h" 11 #include "webkit/fileapi/file_system_operation_context.h"
11 #include "webkit/fileapi/file_system_url.h" 12 #include "webkit/fileapi/file_system_url.h"
12 13
13 using base::PlatformFileError; 14 using base::PlatformFileError;
14 15
15 namespace fileapi { 16 namespace fileapi {
16 17
17 namespace { 18 namespace {
18 19
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 DCHECK(src_util_ == dest_util_); 243 DCHECK(src_util_ == dest_util_);
243 // Source and destination are in the same FileSystemFileUtil; now we can 244 // Source and destination are in the same FileSystemFileUtil; now we can
244 // safely call FileSystemFileUtil method on src_util_ (== dest_util_). 245 // safely call FileSystemFileUtil method on src_util_ (== dest_util_).
245 return src_util_->CopyOrMoveFile(context_, src_url, dest_url, 246 return src_util_->CopyOrMoveFile(context_, src_url, dest_url,
246 operation_ == OPERATION_COPY); 247 operation_ == OPERATION_COPY);
247 } 248 }
248 249
249 // Resolve the src_url's underlying file path. 250 // Resolve the src_url's underlying file path.
250 base::PlatformFileInfo file_info; 251 base::PlatformFileInfo file_info;
251 FilePath platform_file_path; 252 FilePath platform_file_path;
252 PlatformFileError error = src_util_->GetFileInfo( 253 PlatformFileError error = base::PLATFORM_FILE_OK;
253 context_, src_url, &file_info, &platform_file_path); 254
255 scoped_refptr<webkit_blob::ShareableFileReference> file_ref =
256 src_util_->CreateSnapshotFile(context_, src_url,
257 &error, &file_info, &platform_file_path);
254 if (error != base::PLATFORM_FILE_OK) 258 if (error != base::PLATFORM_FILE_OK)
255 return error; 259 return error;
256 260
257 // Call CopyInForeignFile() on the dest_util_ with the resolved source path 261 // Call CopyInForeignFile() on the dest_util_ with the resolved source path
258 // to perform limited cross-FileSystemFileUtil copy/move. 262 // to perform limited cross-FileSystemFileUtil copy/move.
259 error = dest_util_->CopyInForeignFile( 263 error = dest_util_->CopyInForeignFile(
260 context_, platform_file_path, dest_url); 264 context_, platform_file_path, dest_url);
261 265
262 if (operation_ == OPERATION_COPY || error != base::PLATFORM_FILE_OK) 266 if (operation_ == OPERATION_COPY || error != base::PLATFORM_FILE_OK)
263 return error; 267 return error;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 context, url.WithPath(directories.top())); 364 context, url.WithPath(directories.top()));
361 if (error != base::PLATFORM_FILE_ERROR_NOT_FOUND && 365 if (error != base::PLATFORM_FILE_ERROR_NOT_FOUND &&
362 error != base::PLATFORM_FILE_OK) 366 error != base::PLATFORM_FILE_OK)
363 return error; 367 return error;
364 directories.pop(); 368 directories.pop();
365 } 369 }
366 return file_util->DeleteSingleDirectory(context, url); 370 return file_util->DeleteSingleDirectory(context, url);
367 } 371 }
368 372
369 } // namespace fileapi 373 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_operation.cc ('k') | webkit/fileapi/isolated_file_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698