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

Side by Side Diff: storage/browser/fileapi/isolated_file_system_backend.cc

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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/isolated_file_system_backend.h" 5 #include "storage/browser/fileapi/isolated_file_system_backend.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/files/file_util_proxy.h" 11 #include "base/files/file_util_proxy.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/message_loop/message_loop_proxy.h" 13 #include "base/message_loop/message_loop_proxy.h"
14 #include "base/sequenced_task_runner.h" 14 #include "base/sequenced_task_runner.h"
15 #include "webkit/browser/blob/file_stream_reader.h" 15 #include "storage/browser/blob/file_stream_reader.h"
16 #include "webkit/browser/fileapi/async_file_util_adapter.h" 16 #include "storage/browser/fileapi/async_file_util_adapter.h"
17 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" 17 #include "storage/browser/fileapi/copy_or_move_file_validator.h"
18 #include "webkit/browser/fileapi/dragged_file_util.h" 18 #include "storage/browser/fileapi/dragged_file_util.h"
19 #include "webkit/browser/fileapi/file_stream_writer.h" 19 #include "storage/browser/fileapi/file_stream_writer.h"
20 #include "webkit/browser/fileapi/file_system_context.h" 20 #include "storage/browser/fileapi/file_system_context.h"
21 #include "webkit/browser/fileapi/file_system_operation.h" 21 #include "storage/browser/fileapi/file_system_operation.h"
22 #include "webkit/browser/fileapi/file_system_operation_context.h" 22 #include "storage/browser/fileapi/file_system_operation_context.h"
23 #include "webkit/browser/fileapi/isolated_context.h" 23 #include "storage/browser/fileapi/isolated_context.h"
24 #include "webkit/browser/fileapi/native_file_util.h" 24 #include "storage/browser/fileapi/native_file_util.h"
25 #include "webkit/browser/fileapi/transient_file_util.h" 25 #include "storage/browser/fileapi/transient_file_util.h"
26 #include "webkit/common/fileapi/file_system_types.h" 26 #include "storage/common/fileapi/file_system_types.h"
27 #include "webkit/common/fileapi/file_system_util.h" 27 #include "storage/common/fileapi/file_system_util.h"
28 28
29 namespace fileapi { 29 namespace storage {
30 30
31 IsolatedFileSystemBackend::IsolatedFileSystemBackend() 31 IsolatedFileSystemBackend::IsolatedFileSystemBackend()
32 : isolated_file_util_(new AsyncFileUtilAdapter(new LocalFileUtil())), 32 : isolated_file_util_(new AsyncFileUtilAdapter(new LocalFileUtil())),
33 dragged_file_util_(new AsyncFileUtilAdapter(new DraggedFileUtil())), 33 dragged_file_util_(new AsyncFileUtilAdapter(new DraggedFileUtil())),
34 transient_file_util_(new AsyncFileUtilAdapter(new TransientFileUtil())) { 34 transient_file_util_(new AsyncFileUtilAdapter(new TransientFileUtil())) {
35 } 35 }
36 36
37 IsolatedFileSystemBackend::~IsolatedFileSystemBackend() { 37 IsolatedFileSystemBackend::~IsolatedFileSystemBackend() {
38 } 38 }
39 39
(...skipping 16 matching lines...) Expand all
56 void IsolatedFileSystemBackend::Initialize(FileSystemContext* context) { 56 void IsolatedFileSystemBackend::Initialize(FileSystemContext* context) {
57 } 57 }
58 58
59 void IsolatedFileSystemBackend::ResolveURL( 59 void IsolatedFileSystemBackend::ResolveURL(
60 const FileSystemURL& url, 60 const FileSystemURL& url,
61 OpenFileSystemMode mode, 61 OpenFileSystemMode mode,
62 const OpenFileSystemCallback& callback) { 62 const OpenFileSystemCallback& callback) {
63 // We never allow opening a new isolated FileSystem via usual ResolveURL. 63 // We never allow opening a new isolated FileSystem via usual ResolveURL.
64 base::MessageLoopProxy::current()->PostTask( 64 base::MessageLoopProxy::current()->PostTask(
65 FROM_HERE, 65 FROM_HERE,
66 base::Bind(callback, 66 base::Bind(
67 GURL(), 67 callback, GURL(), std::string(), base::File::FILE_ERROR_SECURITY));
68 std::string(),
69 base::File::FILE_ERROR_SECURITY));
70 } 68 }
71 69
72 AsyncFileUtil* IsolatedFileSystemBackend::GetAsyncFileUtil( 70 AsyncFileUtil* IsolatedFileSystemBackend::GetAsyncFileUtil(
73 FileSystemType type) { 71 FileSystemType type) {
74 switch (type) { 72 switch (type) {
75 case kFileSystemTypeNativeLocal: 73 case kFileSystemTypeNativeLocal:
76 return isolated_file_util_.get(); 74 return isolated_file_util_.get();
77 case kFileSystemTypeDragged: 75 case kFileSystemTypeDragged:
78 return dragged_file_util_.get(); 76 return dragged_file_util_.get();
79 case kFileSystemTypeForTransientFile: 77 case kFileSystemTypeForTransientFile:
80 return transient_file_util_.get(); 78 return transient_file_util_.get();
81 default: 79 default:
82 NOTREACHED(); 80 NOTREACHED();
83 } 81 }
84 return NULL; 82 return NULL;
85 } 83 }
86 84
87 CopyOrMoveFileValidatorFactory* 85 CopyOrMoveFileValidatorFactory*
88 IsolatedFileSystemBackend::GetCopyOrMoveFileValidatorFactory( 86 IsolatedFileSystemBackend::GetCopyOrMoveFileValidatorFactory(
89 FileSystemType type, base::File::Error* error_code) { 87 FileSystemType type,
88 base::File::Error* error_code) {
90 DCHECK(error_code); 89 DCHECK(error_code);
91 *error_code = base::File::FILE_OK; 90 *error_code = base::File::FILE_OK;
92 return NULL; 91 return NULL;
93 } 92 }
94 93
95 FileSystemOperation* IsolatedFileSystemBackend::CreateFileSystemOperation( 94 FileSystemOperation* IsolatedFileSystemBackend::CreateFileSystemOperation(
96 const FileSystemURL& url, 95 const FileSystemURL& url,
97 FileSystemContext* context, 96 FileSystemContext* context,
98 base::File::Error* error_code) const { 97 base::File::Error* error_code) const {
99 return FileSystemOperation::Create( 98 return FileSystemOperation::Create(
100 url, context, make_scoped_ptr(new FileSystemOperationContext(context))); 99 url, context, make_scoped_ptr(new FileSystemOperationContext(context)));
101 } 100 }
102 101
103 bool IsolatedFileSystemBackend::SupportsStreaming( 102 bool IsolatedFileSystemBackend::SupportsStreaming(
104 const fileapi::FileSystemURL& url) const { 103 const storage::FileSystemURL& url) const {
105 return false; 104 return false;
106 } 105 }
107 106
108 scoped_ptr<webkit_blob::FileStreamReader> 107 scoped_ptr<storage::FileStreamReader>
109 IsolatedFileSystemBackend::CreateFileStreamReader( 108 IsolatedFileSystemBackend::CreateFileStreamReader(
110 const FileSystemURL& url, 109 const FileSystemURL& url,
111 int64 offset, 110 int64 offset,
112 const base::Time& expected_modification_time, 111 const base::Time& expected_modification_time,
113 FileSystemContext* context) const { 112 FileSystemContext* context) const {
114 return scoped_ptr<webkit_blob::FileStreamReader>( 113 return scoped_ptr<storage::FileStreamReader>(
115 webkit_blob::FileStreamReader::CreateForLocalFile( 114 storage::FileStreamReader::CreateForLocalFile(
116 context->default_file_task_runner(), 115 context->default_file_task_runner(),
117 url.path(), offset, expected_modification_time)); 116 url.path(),
117 offset,
118 expected_modification_time));
118 } 119 }
119 120
120 scoped_ptr<FileStreamWriter> IsolatedFileSystemBackend::CreateFileStreamWriter( 121 scoped_ptr<FileStreamWriter> IsolatedFileSystemBackend::CreateFileStreamWriter(
121 const FileSystemURL& url, 122 const FileSystemURL& url,
122 int64 offset, 123 int64 offset,
123 FileSystemContext* context) const { 124 FileSystemContext* context) const {
124 return scoped_ptr<FileStreamWriter>( 125 return scoped_ptr<FileStreamWriter>(FileStreamWriter::CreateForLocalFile(
125 FileStreamWriter::CreateForLocalFile( 126 context->default_file_task_runner(),
126 context->default_file_task_runner(), 127 url.path(),
127 url.path(), 128 offset,
128 offset, 129 FileStreamWriter::OPEN_EXISTING_FILE));
129 FileStreamWriter::OPEN_EXISTING_FILE));
130 } 130 }
131 131
132 FileSystemQuotaUtil* IsolatedFileSystemBackend::GetQuotaUtil() { 132 FileSystemQuotaUtil* IsolatedFileSystemBackend::GetQuotaUtil() {
133 // No quota support. 133 // No quota support.
134 return NULL; 134 return NULL;
135 } 135 }
136 136
137 } // namespace fileapi 137 } // namespace storage
OLDNEW
« no previous file with comments | « storage/browser/fileapi/isolated_file_system_backend.h ('k') | storage/browser/fileapi/local_file_stream_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698