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

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

Issue 7470037: [Refactor] to rename and re-layer the file_util stack layers. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebased. Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_system_operation.h" 5 #include "webkit/fileapi/file_system_operation.h"
6 6
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "net/base/escape.h" 9 #include "net/base/escape.h"
10 #include "net/url_request/url_request_context.h" 10 #include "net/url_request/url_request_context.h"
11 #include "webkit/fileapi/file_system_callback_dispatcher.h" 11 #include "webkit/fileapi/file_system_callback_dispatcher.h"
12 #include "webkit/fileapi/file_system_context.h" 12 #include "webkit/fileapi/file_system_context.h"
13 #include "webkit/fileapi/file_system_file_util_proxy.h" 13 #include "webkit/fileapi/file_system_file_util_proxy.h"
14 #include "webkit/fileapi/file_system_operation_context.h" 14 #include "webkit/fileapi/file_system_operation_context.h"
15 #include "webkit/fileapi/file_system_path_manager.h" 15 #include "webkit/fileapi/file_system_path_manager.h"
16 #include "webkit/fileapi/file_system_quota_util.h" 16 #include "webkit/fileapi/file_system_quota_util.h"
17 #include "webkit/fileapi/file_system_types.h" 17 #include "webkit/fileapi/file_system_types.h"
18 #include "webkit/fileapi/file_system_util.h" 18 #include "webkit/fileapi/file_system_util.h"
19 #include "webkit/fileapi/file_writer_delegate.h" 19 #include "webkit/fileapi/file_writer_delegate.h"
20 #include "webkit/fileapi/local_file_system_file_util.h" 20 #include "webkit/fileapi/local_file_util.h"
21 #include "webkit/fileapi/quota_file_util.h" 21 #include "webkit/fileapi/quota_file_util.h"
22 #include "webkit/quota/quota_types.h" 22 #include "webkit/quota/quota_types.h"
23 23
24 namespace fileapi { 24 namespace fileapi {
25 25
26 FileSystemOperation::FileSystemOperation( 26 FileSystemOperation::FileSystemOperation(
27 FileSystemCallbackDispatcher* dispatcher, 27 FileSystemCallbackDispatcher* dispatcher,
28 scoped_refptr<base::MessageLoopProxy> proxy, 28 scoped_refptr<base::MessageLoopProxy> proxy,
29 FileSystemContext* file_system_context, 29 FileSystemContext* file_system_context,
30 FileSystemFileUtil* file_system_file_util) 30 FileUtil* file_util)
31 : proxy_(proxy), 31 : proxy_(proxy),
32 dispatcher_(dispatcher), 32 dispatcher_(dispatcher),
33 file_system_operation_context_( 33 file_system_operation_context_(file_system_context, file_util),
34 file_system_context, file_system_file_util),
35 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 34 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
36 DCHECK(dispatcher); 35 DCHECK(dispatcher);
37 #ifndef NDEBUG 36 #ifndef NDEBUG
38 pending_operation_ = kOperationNone; 37 pending_operation_ = kOperationNone;
39 #endif 38 #endif
40 } 39 }
41 40
42 FileSystemOperation::~FileSystemOperation() { 41 FileSystemOperation::~FileSystemOperation() {
43 if (file_writer_delegate_.get()) 42 if (file_writer_delegate_.get())
44 FileSystemFileUtilProxy::Close( 43 FileSystemFileUtilProxy::Close(
(...skipping 25 matching lines...) Expand all
70 69
71 void FileSystemOperation::CreateFile(const GURL& path, 70 void FileSystemOperation::CreateFile(const GURL& path,
72 bool exclusive) { 71 bool exclusive) {
73 #ifndef NDEBUG 72 #ifndef NDEBUG
74 DCHECK(kOperationNone == pending_operation_); 73 DCHECK(kOperationNone == pending_operation_);
75 pending_operation_ = kOperationCreateFile; 74 pending_operation_ = kOperationCreateFile;
76 #endif 75 #endif
77 FilePath virtual_path; 76 FilePath virtual_path;
78 GURL origin_url; 77 GURL origin_url;
79 FileSystemType type; 78 FileSystemType type;
80 FileSystemFileUtil* file_system_file_util; 79 FileUtil* file_util;
81 if (!VerifyFileSystemPathForWrite( 80 if (!VerifyFileSystemPathForWrite(
82 path, true /* create */, &origin_url, &type, &virtual_path, 81 path, true /* create */, &origin_url, &type, &virtual_path, &file_util)) {
83 &file_system_file_util)) {
84 delete this; 82 delete this;
85 return; 83 return;
86 } 84 }
87 file_system_operation_context_.set_src_origin_url(origin_url); 85 file_system_operation_context_.set_src_origin_url(origin_url);
88 file_system_operation_context_.set_src_type(type); 86 file_system_operation_context_.set_src_type(type);
89 file_system_operation_context_.set_src_virtual_path(virtual_path); 87 file_system_operation_context_.set_src_virtual_path(virtual_path);
90 if (!file_system_operation_context_.src_file_system_file_util()) 88 if (!file_system_operation_context_.src_file_util())
91 file_system_operation_context_.set_src_file_system_file_util( 89 file_system_operation_context_.set_src_file_util(file_util);
92 file_system_file_util);
93 exclusive_ = exclusive; 90 exclusive_ = exclusive;
94 91
95 GetUsageAndQuotaThenCallback(origin_url, callback_factory_.NewCallback( 92 GetUsageAndQuotaThenCallback(origin_url, callback_factory_.NewCallback(
96 &FileSystemOperation::DelayedCreateFileForQuota)); 93 &FileSystemOperation::DelayedCreateFileForQuota));
97 } 94 }
98 95
99 void FileSystemOperation::DelayedCreateFileForQuota( 96 void FileSystemOperation::DelayedCreateFileForQuota(
100 quota::QuotaStatusCode status, int64 usage, int64 quota) { 97 quota::QuotaStatusCode status, int64 usage, int64 quota) {
101 if (file_system_context()->IsStorageUnlimited( 98 if (file_system_context()->IsStorageUnlimited(
102 file_system_operation_context()->src_origin_url()) || 99 file_system_operation_context()->src_origin_url()) ||
(...skipping 15 matching lines...) Expand all
118 void FileSystemOperation::CreateDirectory(const GURL& path, 115 void FileSystemOperation::CreateDirectory(const GURL& path,
119 bool exclusive, 116 bool exclusive,
120 bool recursive) { 117 bool recursive) {
121 #ifndef NDEBUG 118 #ifndef NDEBUG
122 DCHECK(kOperationNone == pending_operation_); 119 DCHECK(kOperationNone == pending_operation_);
123 pending_operation_ = kOperationCreateDirectory; 120 pending_operation_ = kOperationCreateDirectory;
124 #endif 121 #endif
125 FilePath virtual_path; 122 FilePath virtual_path;
126 GURL origin_url; 123 GURL origin_url;
127 FileSystemType type; 124 FileSystemType type;
128 FileSystemFileUtil* file_system_file_util; 125 FileUtil* file_util;
129 126
130 if (!VerifyFileSystemPathForWrite( 127 if (!VerifyFileSystemPathForWrite(
131 path, true /* create */, &origin_url, &type, &virtual_path, 128 path, true /* create */, &origin_url, &type, &virtual_path, &file_util)) {
132 &file_system_file_util)) {
133 delete this; 129 delete this;
134 return; 130 return;
135 } 131 }
136 file_system_operation_context_.set_src_origin_url(origin_url); 132 file_system_operation_context_.set_src_origin_url(origin_url);
137 file_system_operation_context_.set_src_type(type); 133 file_system_operation_context_.set_src_type(type);
138 file_system_operation_context_.set_src_virtual_path(virtual_path); 134 file_system_operation_context_.set_src_virtual_path(virtual_path);
139 if (!file_system_operation_context_.src_file_system_file_util()) 135 if (!file_system_operation_context_.src_file_util())
140 file_system_operation_context_.set_src_file_system_file_util( 136 file_system_operation_context_.set_src_file_util(file_util);
141 file_system_file_util);
142 exclusive_ = exclusive; 137 exclusive_ = exclusive;
143 recursive_ = recursive; 138 recursive_ = recursive;
144 139
145 GetUsageAndQuotaThenCallback(origin_url, callback_factory_.NewCallback( 140 GetUsageAndQuotaThenCallback(origin_url, callback_factory_.NewCallback(
146 &FileSystemOperation::DelayedCreateDirectoryForQuota)); 141 &FileSystemOperation::DelayedCreateDirectoryForQuota));
147 } 142 }
148 143
149 void FileSystemOperation::DelayedCreateDirectoryForQuota( 144 void FileSystemOperation::DelayedCreateDirectoryForQuota(
150 quota::QuotaStatusCode status, int64 usage, int64 quota) { 145 quota::QuotaStatusCode status, int64 usage, int64 quota) {
151 if (file_system_context()->IsStorageUnlimited( 146 if (file_system_context()->IsStorageUnlimited(
(...skipping 19 matching lines...) Expand all
171 #ifndef NDEBUG 166 #ifndef NDEBUG
172 DCHECK(kOperationNone == pending_operation_); 167 DCHECK(kOperationNone == pending_operation_);
173 pending_operation_ = kOperationCopy; 168 pending_operation_ = kOperationCopy;
174 #endif 169 #endif
175 FilePath virtual_path_0; 170 FilePath virtual_path_0;
176 FilePath virtual_path_1; 171 FilePath virtual_path_1;
177 GURL src_origin_url; 172 GURL src_origin_url;
178 GURL dest_origin_url; 173 GURL dest_origin_url;
179 FileSystemType src_type; 174 FileSystemType src_type;
180 FileSystemType dest_type; 175 FileSystemType dest_type;
181 FileSystemFileUtil* src_file_system_file_util; 176 FileUtil* src_file_util;
182 FileSystemFileUtil* dest_file_system_file_util; 177 FileUtil* dest_file_util;
183 178
184 if (!VerifyFileSystemPathForRead(src_path, &src_origin_url, &src_type, 179 if (!VerifyFileSystemPathForRead(src_path, &src_origin_url, &src_type,
185 &virtual_path_0, &src_file_system_file_util) || 180 &virtual_path_0, &src_file_util) ||
186 !VerifyFileSystemPathForWrite(dest_path, true /* create */, 181 !VerifyFileSystemPathForWrite(dest_path, true /* create */,
187 &dest_origin_url, &dest_type, &virtual_path_1, 182 &dest_origin_url, &dest_type, &virtual_path_1, &dest_file_util)) {
188 &dest_file_system_file_util)) {
189 delete this; 183 delete this;
190 return; 184 return;
191 } 185 }
192 file_system_operation_context_.set_src_origin_url(src_origin_url); 186 file_system_operation_context_.set_src_origin_url(src_origin_url);
193 file_system_operation_context_.set_dest_origin_url(dest_origin_url); 187 file_system_operation_context_.set_dest_origin_url(dest_origin_url);
194 file_system_operation_context_.set_src_type(src_type); 188 file_system_operation_context_.set_src_type(src_type);
195 file_system_operation_context_.set_dest_type(dest_type); 189 file_system_operation_context_.set_dest_type(dest_type);
196 file_system_operation_context_.set_src_virtual_path(virtual_path_0); 190 file_system_operation_context_.set_src_virtual_path(virtual_path_0);
197 file_system_operation_context_.set_dest_virtual_path(virtual_path_1); 191 file_system_operation_context_.set_dest_virtual_path(virtual_path_1);
198 if (!file_system_operation_context_.src_file_system_file_util()) 192 if (!file_system_operation_context_.src_file_util())
199 file_system_operation_context_.set_src_file_system_file_util( 193 file_system_operation_context_.set_src_file_util(src_file_util);
200 src_file_system_file_util); 194 if (!file_system_operation_context_.dest_file_util())
201 if (!file_system_operation_context_.dest_file_system_file_util()) 195 file_system_operation_context_.set_dest_file_util(dest_file_util);
202 file_system_operation_context_.set_dest_file_system_file_util(
203 dest_file_system_file_util);
204 196
205 GetUsageAndQuotaThenCallback(dest_origin_url, callback_factory_.NewCallback( 197 GetUsageAndQuotaThenCallback(dest_origin_url, callback_factory_.NewCallback(
206 &FileSystemOperation::DelayedCopyForQuota)); 198 &FileSystemOperation::DelayedCopyForQuota));
207 } 199 }
208 200
209 void FileSystemOperation::DelayedCopyForQuota(quota::QuotaStatusCode status, 201 void FileSystemOperation::DelayedCopyForQuota(quota::QuotaStatusCode status,
210 int64 usage, int64 quota) { 202 int64 usage, int64 quota) {
211 if (file_system_context()->IsStorageUnlimited( 203 if (file_system_context()->IsStorageUnlimited(
212 file_system_operation_context()->dest_origin_url()) || 204 file_system_operation_context()->dest_origin_url()) ||
213 quota == QuotaFileUtil::kNoLimit) { 205 quota == QuotaFileUtil::kNoLimit) {
(...skipping 16 matching lines...) Expand all
230 #ifndef NDEBUG 222 #ifndef NDEBUG
231 DCHECK(kOperationNone == pending_operation_); 223 DCHECK(kOperationNone == pending_operation_);
232 pending_operation_ = kOperationMove; 224 pending_operation_ = kOperationMove;
233 #endif 225 #endif
234 FilePath virtual_path_0; 226 FilePath virtual_path_0;
235 FilePath virtual_path_1; 227 FilePath virtual_path_1;
236 GURL src_origin_url; 228 GURL src_origin_url;
237 GURL dest_origin_url; 229 GURL dest_origin_url;
238 FileSystemType src_type; 230 FileSystemType src_type;
239 FileSystemType dest_type; 231 FileSystemType dest_type;
240 FileSystemFileUtil* src_file_system_file_util; 232 FileUtil* src_file_util;
241 FileSystemFileUtil* dest_file_system_file_util; 233 FileUtil* dest_file_util;
242 234
243 if (!VerifyFileSystemPathForWrite(src_path, false, &src_origin_url, &src_type, 235 if (!VerifyFileSystemPathForWrite(src_path, false, &src_origin_url, &src_type,
244 &virtual_path_0, &src_file_system_file_util) || 236 &virtual_path_0, &src_file_util) ||
245 !VerifyFileSystemPathForWrite(dest_path, true /* create */, 237 !VerifyFileSystemPathForWrite(dest_path, true /* create */,
246 &dest_origin_url, &dest_type, &virtual_path_1, 238 &dest_origin_url, &dest_type, &virtual_path_1, &dest_file_util)) {
247 &dest_file_system_file_util)) {
248 delete this; 239 delete this;
249 return; 240 return;
250 } 241 }
251 file_system_operation_context_.set_src_origin_url(src_origin_url); 242 file_system_operation_context_.set_src_origin_url(src_origin_url);
252 file_system_operation_context_.set_dest_origin_url(dest_origin_url); 243 file_system_operation_context_.set_dest_origin_url(dest_origin_url);
253 file_system_operation_context_.set_src_type(src_type); 244 file_system_operation_context_.set_src_type(src_type);
254 file_system_operation_context_.set_dest_type(dest_type); 245 file_system_operation_context_.set_dest_type(dest_type);
255 file_system_operation_context_.set_src_virtual_path(virtual_path_0); 246 file_system_operation_context_.set_src_virtual_path(virtual_path_0);
256 file_system_operation_context_.set_dest_virtual_path(virtual_path_1); 247 file_system_operation_context_.set_dest_virtual_path(virtual_path_1);
257 if (!file_system_operation_context_.src_file_system_file_util()) 248 if (!file_system_operation_context_.src_file_util())
258 file_system_operation_context_.set_src_file_system_file_util( 249 file_system_operation_context_.set_src_file_util(src_file_util);
259 src_file_system_file_util); 250 if (!file_system_operation_context_.dest_file_util())
260 if (!file_system_operation_context_.dest_file_system_file_util()) 251 file_system_operation_context_.set_dest_file_util(dest_file_util);
261 file_system_operation_context_.set_dest_file_system_file_util(
262 dest_file_system_file_util);
263 252
264 GetUsageAndQuotaThenCallback(dest_origin_url, callback_factory_.NewCallback( 253 GetUsageAndQuotaThenCallback(dest_origin_url, callback_factory_.NewCallback(
265 &FileSystemOperation::DelayedMoveForQuota)); 254 &FileSystemOperation::DelayedMoveForQuota));
266 } 255 }
267 256
268 void FileSystemOperation::DelayedMoveForQuota(quota::QuotaStatusCode status, 257 void FileSystemOperation::DelayedMoveForQuota(quota::QuotaStatusCode status,
269 int64 usage, int64 quota) { 258 int64 usage, int64 quota) {
270 if (file_system_context()->IsStorageUnlimited( 259 if (file_system_context()->IsStorageUnlimited(
271 file_system_operation_context()->dest_origin_url()) || 260 file_system_operation_context()->dest_origin_url()) ||
272 quota == QuotaFileUtil::kNoLimit) { 261 quota == QuotaFileUtil::kNoLimit) {
(...skipping 13 matching lines...) Expand all
286 275
287 void FileSystemOperation::DirectoryExists(const GURL& path) { 276 void FileSystemOperation::DirectoryExists(const GURL& path) {
288 #ifndef NDEBUG 277 #ifndef NDEBUG
289 DCHECK(kOperationNone == pending_operation_); 278 DCHECK(kOperationNone == pending_operation_);
290 pending_operation_ = kOperationDirectoryExists; 279 pending_operation_ = kOperationDirectoryExists;
291 #endif 280 #endif
292 281
293 FilePath virtual_path; 282 FilePath virtual_path;
294 GURL origin_url; 283 GURL origin_url;
295 FileSystemType type; 284 FileSystemType type;
296 FileSystemFileUtil* file_system_file_util; 285 FileUtil* file_util;
297 if (!VerifyFileSystemPathForRead(path, &origin_url, &type, &virtual_path, 286 if (!VerifyFileSystemPathForRead(path, &origin_url, &type, &virtual_path,
298 &file_system_file_util)) { 287 &file_util)) {
299 delete this; 288 delete this;
300 return; 289 return;
301 } 290 }
302 file_system_operation_context_.set_src_origin_url(origin_url); 291 file_system_operation_context_.set_src_origin_url(origin_url);
303 file_system_operation_context_.set_src_type(type); 292 file_system_operation_context_.set_src_type(type);
304 if (!file_system_operation_context_.src_file_system_file_util()) 293 if (!file_system_operation_context_.src_file_util())
305 file_system_operation_context_.set_src_file_system_file_util( 294 file_system_operation_context_.set_src_file_util(file_util);
306 file_system_file_util);
307 FileSystemFileUtilProxy::GetFileInfo( 295 FileSystemFileUtilProxy::GetFileInfo(
308 file_system_operation_context_, 296 file_system_operation_context_,
309 proxy_, virtual_path, callback_factory_.NewCallback( 297 proxy_, virtual_path, callback_factory_.NewCallback(
310 &FileSystemOperation::DidDirectoryExists)); 298 &FileSystemOperation::DidDirectoryExists));
311 } 299 }
312 300
313 void FileSystemOperation::FileExists(const GURL& path) { 301 void FileSystemOperation::FileExists(const GURL& path) {
314 #ifndef NDEBUG 302 #ifndef NDEBUG
315 DCHECK(kOperationNone == pending_operation_); 303 DCHECK(kOperationNone == pending_operation_);
316 pending_operation_ = kOperationFileExists; 304 pending_operation_ = kOperationFileExists;
317 #endif 305 #endif
318 306
319 FilePath virtual_path; 307 FilePath virtual_path;
320 GURL origin_url; 308 GURL origin_url;
321 FileSystemType type; 309 FileSystemType type;
322 FileSystemFileUtil* file_system_file_util; 310 FileUtil* file_util;
323 if (!VerifyFileSystemPathForRead(path, &origin_url, &type, &virtual_path, 311 if (!VerifyFileSystemPathForRead(path, &origin_url, &type, &virtual_path,
324 &file_system_file_util)) { 312 &file_util)) {
325 delete this; 313 delete this;
326 return; 314 return;
327 } 315 }
328 file_system_operation_context_.set_src_origin_url(origin_url); 316 file_system_operation_context_.set_src_origin_url(origin_url);
329 file_system_operation_context_.set_src_type(type); 317 file_system_operation_context_.set_src_type(type);
330 if (!file_system_operation_context_.src_file_system_file_util()) 318 if (!file_system_operation_context_.src_file_util())
331 file_system_operation_context_.set_src_file_system_file_util( 319 file_system_operation_context_.set_src_file_util(file_util);
332 file_system_file_util);
333 FileSystemFileUtilProxy::GetFileInfo( 320 FileSystemFileUtilProxy::GetFileInfo(
334 file_system_operation_context_, 321 file_system_operation_context_,
335 proxy_, virtual_path, callback_factory_.NewCallback( 322 proxy_, virtual_path, callback_factory_.NewCallback(
336 &FileSystemOperation::DidFileExists)); 323 &FileSystemOperation::DidFileExists));
337 } 324 }
338 325
339 void FileSystemOperation::GetMetadata(const GURL& path) { 326 void FileSystemOperation::GetMetadata(const GURL& path) {
340 #ifndef NDEBUG 327 #ifndef NDEBUG
341 DCHECK(kOperationNone == pending_operation_); 328 DCHECK(kOperationNone == pending_operation_);
342 pending_operation_ = kOperationGetMetadata; 329 pending_operation_ = kOperationGetMetadata;
343 #endif 330 #endif
344 331
345 FilePath virtual_path; 332 FilePath virtual_path;
346 GURL origin_url; 333 GURL origin_url;
347 FileSystemType type; 334 FileSystemType type;
348 FileSystemFileUtil* file_system_file_util; 335 FileUtil* file_util;
349 if (!VerifyFileSystemPathForRead(path, &origin_url, &type, &virtual_path, 336 if (!VerifyFileSystemPathForRead(path, &origin_url, &type, &virtual_path,
350 &file_system_file_util)) { 337 &file_util)) {
351 delete this; 338 delete this;
352 return; 339 return;
353 } 340 }
354 file_system_operation_context_.set_src_origin_url(origin_url); 341 file_system_operation_context_.set_src_origin_url(origin_url);
355 file_system_operation_context_.set_src_type(type); 342 file_system_operation_context_.set_src_type(type);
356 if (!file_system_operation_context_.src_file_system_file_util()) 343 if (!file_system_operation_context_.src_file_util())
357 file_system_operation_context_.set_src_file_system_file_util( 344 file_system_operation_context_.set_src_file_util(file_util);
358 file_system_file_util);
359 FileSystemFileUtilProxy::GetFileInfo( 345 FileSystemFileUtilProxy::GetFileInfo(
360 file_system_operation_context_, 346 file_system_operation_context_,
361 proxy_, virtual_path, callback_factory_.NewCallback( 347 proxy_, virtual_path, callback_factory_.NewCallback(
362 &FileSystemOperation::DidGetMetadata)); 348 &FileSystemOperation::DidGetMetadata));
363 } 349 }
364 350
365 void FileSystemOperation::ReadDirectory(const GURL& path) { 351 void FileSystemOperation::ReadDirectory(const GURL& path) {
366 #ifndef NDEBUG 352 #ifndef NDEBUG
367 DCHECK(kOperationNone == pending_operation_); 353 DCHECK(kOperationNone == pending_operation_);
368 pending_operation_ = kOperationReadDirectory; 354 pending_operation_ = kOperationReadDirectory;
369 #endif 355 #endif
370 356
371 FilePath virtual_path; 357 FilePath virtual_path;
372 GURL origin_url; 358 GURL origin_url;
373 FileSystemType type; 359 FileSystemType type;
374 FileSystemFileUtil* file_system_file_util; 360 FileUtil* file_util;
375 if (!VerifyFileSystemPathForRead(path, &origin_url, &type, &virtual_path, 361 if (!VerifyFileSystemPathForRead(path, &origin_url, &type, &virtual_path,
376 &file_system_file_util)) { 362 &file_util)) {
377 delete this; 363 delete this;
378 return; 364 return;
379 } 365 }
380 file_system_operation_context_.set_src_origin_url(origin_url); 366 file_system_operation_context_.set_src_origin_url(origin_url);
381 file_system_operation_context_.set_src_type(type); 367 file_system_operation_context_.set_src_type(type);
382 if (!file_system_operation_context_.src_file_system_file_util()) 368 if (!file_system_operation_context_.src_file_util())
383 file_system_operation_context_.set_src_file_system_file_util( 369 file_system_operation_context_.set_src_file_util(file_util);
384 file_system_file_util);
385 FileSystemFileUtilProxy::ReadDirectory( 370 FileSystemFileUtilProxy::ReadDirectory(
386 file_system_operation_context_, 371 file_system_operation_context_,
387 proxy_, virtual_path, callback_factory_.NewCallback( 372 proxy_, virtual_path, callback_factory_.NewCallback(
388 &FileSystemOperation::DidReadDirectory)); 373 &FileSystemOperation::DidReadDirectory));
389 } 374 }
390 375
391 void FileSystemOperation::Remove(const GURL& path, bool recursive) { 376 void FileSystemOperation::Remove(const GURL& path, bool recursive) {
392 #ifndef NDEBUG 377 #ifndef NDEBUG
393 DCHECK(kOperationNone == pending_operation_); 378 DCHECK(kOperationNone == pending_operation_);
394 pending_operation_ = kOperationRemove; 379 pending_operation_ = kOperationRemove;
395 #endif 380 #endif
396 381
397 FilePath virtual_path; 382 FilePath virtual_path;
398 GURL origin_url; 383 GURL origin_url;
399 FileSystemType type; 384 FileSystemType type;
400 FileSystemFileUtil* file_system_file_util; 385 FileUtil* file_util;
401 if (!VerifyFileSystemPathForWrite(path, false /* create */, &origin_url, 386 if (!VerifyFileSystemPathForWrite(path, false /* create */, &origin_url,
402 &type, &virtual_path, &file_system_file_util)) { 387 &type, &virtual_path, &file_util)) {
403 delete this; 388 delete this;
404 return; 389 return;
405 } 390 }
406 file_system_operation_context_.set_src_origin_url(origin_url); 391 file_system_operation_context_.set_src_origin_url(origin_url);
407 file_system_operation_context_.set_src_type(type); 392 file_system_operation_context_.set_src_type(type);
408 if (!file_system_operation_context_.src_file_system_file_util()) 393 if (!file_system_operation_context_.src_file_util())
409 file_system_operation_context_.set_src_file_system_file_util( 394 file_system_operation_context_.set_src_file_util(file_util);
410 file_system_file_util);
411 FileSystemFileUtilProxy::Delete( 395 FileSystemFileUtilProxy::Delete(
412 file_system_operation_context_, 396 file_system_operation_context_,
413 proxy_, virtual_path, recursive, callback_factory_.NewCallback( 397 proxy_, virtual_path, recursive, callback_factory_.NewCallback(
414 &FileSystemOperation::DidFinishFileOperation)); 398 &FileSystemOperation::DidFinishFileOperation));
415 } 399 }
416 400
417 void FileSystemOperation::Write( 401 void FileSystemOperation::Write(
418 scoped_refptr<net::URLRequestContext> url_request_context, 402 scoped_refptr<net::URLRequestContext> url_request_context,
419 const GURL& path, 403 const GURL& path,
420 const GURL& blob_url, 404 const GURL& blob_url,
421 int64 offset) { 405 int64 offset) {
422 #ifndef NDEBUG 406 #ifndef NDEBUG
423 DCHECK(kOperationNone == pending_operation_); 407 DCHECK(kOperationNone == pending_operation_);
424 pending_operation_ = kOperationWrite; 408 pending_operation_ = kOperationWrite;
425 #endif 409 #endif
426 FilePath virtual_path; 410 FilePath virtual_path;
427 GURL origin_url; 411 GURL origin_url;
428 FileSystemType type; 412 FileSystemType type;
429 FileSystemFileUtil* file_system_file_util; 413 FileUtil* file_util;
430 if (!VerifyFileSystemPathForWrite(path, true /* create */, &origin_url, 414 if (!VerifyFileSystemPathForWrite(path, true /* create */, &origin_url,
431 &type, &virtual_path, &file_system_file_util)) { 415 &type, &virtual_path, &file_util)) {
432 delete this; 416 delete this;
433 return; 417 return;
434 } 418 }
435 file_system_operation_context_.set_src_origin_url(origin_url); 419 file_system_operation_context_.set_src_origin_url(origin_url);
436 file_system_operation_context_.set_src_type(type); 420 file_system_operation_context_.set_src_type(type);
437 file_system_operation_context_.set_src_virtual_path(virtual_path); 421 file_system_operation_context_.set_src_virtual_path(virtual_path);
438 if (!file_system_operation_context_.src_file_system_file_util()) 422 if (!file_system_operation_context_.src_file_util())
439 file_system_operation_context_.set_src_file_system_file_util( 423 file_system_operation_context_.set_src_file_util(file_util);
440 file_system_file_util);
441 DCHECK(blob_url.is_valid()); 424 DCHECK(blob_url.is_valid());
442 file_writer_delegate_.reset(new FileWriterDelegate(this, offset, proxy_)); 425 file_writer_delegate_.reset(new FileWriterDelegate(this, offset, proxy_));
443 blob_request_.reset( 426 blob_request_.reset(
444 new net::URLRequest(blob_url, file_writer_delegate_.get())); 427 new net::URLRequest(blob_url, file_writer_delegate_.get()));
445 blob_request_->set_context(url_request_context); 428 blob_request_->set_context(url_request_context);
446 429
447 GetUsageAndQuotaThenCallback(origin_url, callback_factory_.NewCallback( 430 GetUsageAndQuotaThenCallback(origin_url, callback_factory_.NewCallback(
448 &FileSystemOperation::DelayedWriteForQuota)); 431 &FileSystemOperation::DelayedWriteForQuota));
449 } 432 }
450 433
(...skipping 18 matching lines...) Expand all
469 } 452 }
470 453
471 void FileSystemOperation::Truncate(const GURL& path, int64 length) { 454 void FileSystemOperation::Truncate(const GURL& path, int64 length) {
472 #ifndef NDEBUG 455 #ifndef NDEBUG
473 DCHECK(kOperationNone == pending_operation_); 456 DCHECK(kOperationNone == pending_operation_);
474 pending_operation_ = kOperationTruncate; 457 pending_operation_ = kOperationTruncate;
475 #endif 458 #endif
476 FilePath virtual_path; 459 FilePath virtual_path;
477 GURL origin_url; 460 GURL origin_url;
478 FileSystemType type; 461 FileSystemType type;
479 FileSystemFileUtil* file_system_file_util; 462 FileUtil* file_util;
480 if (!VerifyFileSystemPathForWrite(path, false /* create */, &origin_url, 463 if (!VerifyFileSystemPathForWrite(path, false /* create */, &origin_url,
481 &type, &virtual_path, &file_system_file_util)) { 464 &type, &virtual_path, &file_util)) {
482 delete this; 465 delete this;
483 return; 466 return;
484 } 467 }
485 file_system_operation_context_.set_src_origin_url(origin_url); 468 file_system_operation_context_.set_src_origin_url(origin_url);
486 file_system_operation_context_.set_src_type(type); 469 file_system_operation_context_.set_src_type(type);
487 file_system_operation_context_.set_src_virtual_path(virtual_path); 470 file_system_operation_context_.set_src_virtual_path(virtual_path);
488 if (!file_system_operation_context_.src_file_system_file_util()) 471 if (!file_system_operation_context_.src_file_util())
489 file_system_operation_context_.set_src_file_system_file_util( 472 file_system_operation_context_.set_src_file_util(file_util);
490 file_system_file_util);
491 length_ = length; 473 length_ = length;
492 474
493 GetUsageAndQuotaThenCallback(origin_url, callback_factory_.NewCallback( 475 GetUsageAndQuotaThenCallback(origin_url, callback_factory_.NewCallback(
494 &FileSystemOperation::DelayedTruncateForQuota)); 476 &FileSystemOperation::DelayedTruncateForQuota));
495 } 477 }
496 478
497 void FileSystemOperation::DelayedTruncateForQuota(quota::QuotaStatusCode status, 479 void FileSystemOperation::DelayedTruncateForQuota(quota::QuotaStatusCode status,
498 int64 usage, int64 quota) { 480 int64 usage, int64 quota) {
499 if (file_system_context()->IsStorageUnlimited( 481 if (file_system_context()->IsStorageUnlimited(
500 file_system_operation_context()->src_origin_url()) || 482 file_system_operation_context()->src_origin_url()) ||
(...skipping 15 matching lines...) Expand all
516 const base::Time& last_access_time, 498 const base::Time& last_access_time,
517 const base::Time& last_modified_time) { 499 const base::Time& last_modified_time) {
518 #ifndef NDEBUG 500 #ifndef NDEBUG
519 DCHECK(kOperationNone == pending_operation_); 501 DCHECK(kOperationNone == pending_operation_);
520 pending_operation_ = kOperationTouchFile; 502 pending_operation_ = kOperationTouchFile;
521 #endif 503 #endif
522 504
523 FilePath virtual_path; 505 FilePath virtual_path;
524 GURL origin_url; 506 GURL origin_url;
525 FileSystemType type; 507 FileSystemType type;
526 FileSystemFileUtil* file_system_file_util; 508 FileUtil* file_util;
527 if (!VerifyFileSystemPathForWrite(path, true /* create */, &origin_url, 509 if (!VerifyFileSystemPathForWrite(path, true /* create */, &origin_url,
528 &type, &virtual_path, &file_system_file_util)) { 510 &type, &virtual_path, &file_util)) {
529 delete this; 511 delete this;
530 return; 512 return;
531 } 513 }
532 file_system_operation_context_.set_src_origin_url(origin_url); 514 file_system_operation_context_.set_src_origin_url(origin_url);
533 file_system_operation_context_.set_src_type(type); 515 file_system_operation_context_.set_src_type(type);
534 if (!file_system_operation_context_.src_file_system_file_util()) 516 if (!file_system_operation_context_.src_file_util())
535 file_system_operation_context_.set_src_file_system_file_util( 517 file_system_operation_context_.set_src_file_util(file_util);
536 file_system_file_util);
537 FileSystemFileUtilProxy::Touch( 518 FileSystemFileUtilProxy::Touch(
538 file_system_operation_context_, 519 file_system_operation_context_,
539 proxy_, virtual_path, last_access_time, last_modified_time, 520 proxy_, virtual_path, last_access_time, last_modified_time,
540 callback_factory_.NewCallback(&FileSystemOperation::DidTouchFile)); 521 callback_factory_.NewCallback(&FileSystemOperation::DidTouchFile));
541 } 522 }
542 523
543 void FileSystemOperation::OpenFile(const GURL& path, 524 void FileSystemOperation::OpenFile(const GURL& path,
544 int file_flags, 525 int file_flags,
545 base::ProcessHandle peer_handle) { 526 base::ProcessHandle peer_handle) {
546 #ifndef NDEBUG 527 #ifndef NDEBUG
547 DCHECK(kOperationNone == pending_operation_); 528 DCHECK(kOperationNone == pending_operation_);
548 pending_operation_ = kOperationOpenFile; 529 pending_operation_ = kOperationOpenFile;
549 #endif 530 #endif
550 531
551 peer_handle_ = peer_handle; 532 peer_handle_ = peer_handle;
552 FilePath virtual_path; 533 FilePath virtual_path;
553 GURL origin_url; 534 GURL origin_url;
554 FileSystemType type; 535 FileSystemType type;
555 FileSystemFileUtil* file_system_file_util; 536 FileUtil* file_util;
556 if (file_flags & ( 537 if (file_flags & (
557 (base::PLATFORM_FILE_ENUMERATE | base::PLATFORM_FILE_TEMPORARY | 538 (base::PLATFORM_FILE_ENUMERATE | base::PLATFORM_FILE_TEMPORARY |
558 base::PLATFORM_FILE_HIDDEN))) { 539 base::PLATFORM_FILE_HIDDEN))) {
559 delete this; 540 delete this;
560 return; 541 return;
561 } 542 }
562 if (file_flags & 543 if (file_flags &
563 (base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_OPEN_ALWAYS | 544 (base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_OPEN_ALWAYS |
564 base::PLATFORM_FILE_CREATE_ALWAYS | base::PLATFORM_FILE_OPEN_TRUNCATED | 545 base::PLATFORM_FILE_CREATE_ALWAYS | base::PLATFORM_FILE_OPEN_TRUNCATED |
565 base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_EXCLUSIVE_WRITE | 546 base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_EXCLUSIVE_WRITE |
566 base::PLATFORM_FILE_DELETE_ON_CLOSE | 547 base::PLATFORM_FILE_DELETE_ON_CLOSE |
567 base::PLATFORM_FILE_WRITE_ATTRIBUTES)) { 548 base::PLATFORM_FILE_WRITE_ATTRIBUTES)) {
568 if (!VerifyFileSystemPathForWrite(path, true /* create */, &origin_url, 549 if (!VerifyFileSystemPathForWrite(path, true /* create */, &origin_url,
569 &type, &virtual_path, &file_system_file_util)) { 550 &type, &virtual_path, &file_util)) {
570 delete this; 551 delete this;
571 return; 552 return;
572 } 553 }
573 } else { 554 } else {
574 if (!VerifyFileSystemPathForRead(path, &origin_url, &type, &virtual_path, 555 if (!VerifyFileSystemPathForRead(path, &origin_url, &type, &virtual_path,
575 &file_system_file_util)) { 556 &file_util)) {
576 delete this; 557 delete this;
577 return; 558 return;
578 } 559 }
579 } 560 }
580 file_system_operation_context_.set_src_origin_url(origin_url); 561 file_system_operation_context_.set_src_origin_url(origin_url);
581 file_system_operation_context_.set_src_type(type); 562 file_system_operation_context_.set_src_type(type);
582 file_system_operation_context_.set_src_virtual_path(virtual_path); 563 file_system_operation_context_.set_src_virtual_path(virtual_path);
583 if (!file_system_operation_context_.src_file_system_file_util()) 564 if (!file_system_operation_context_.src_file_util())
584 file_system_operation_context_.set_src_file_system_file_util( 565 file_system_operation_context_.set_src_file_util(file_util);
585 file_system_file_util);
586 file_flags_ = file_flags; 566 file_flags_ = file_flags;
587 567
588 GetUsageAndQuotaThenCallback(origin_url, callback_factory_.NewCallback( 568 GetUsageAndQuotaThenCallback(origin_url, callback_factory_.NewCallback(
589 &FileSystemOperation::DelayedOpenFileForQuota)); 569 &FileSystemOperation::DelayedOpenFileForQuota));
590 } 570 }
591 571
592 void FileSystemOperation::DelayedOpenFileForQuota(quota::QuotaStatusCode status, 572 void FileSystemOperation::DelayedOpenFileForQuota(quota::QuotaStatusCode status,
593 int64 usage, int64 quota) { 573 int64 usage, int64 quota) {
594 if (file_system_context()->IsStorageUnlimited( 574 if (file_system_context()->IsStorageUnlimited(
595 file_system_operation_context()->dest_origin_url()) || 575 file_system_operation_context()->dest_origin_url()) ||
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 if (base::PLATFORM_FILE_OK != rv) { 786 if (base::PLATFORM_FILE_OK != rv) {
807 dispatcher_->DidFail(rv); 787 dispatcher_->DidFail(rv);
808 delete this; 788 delete this;
809 return; 789 return;
810 } 790 }
811 file_writer_delegate_->Start(file.ReleaseValue(), blob_request_.get()); 791 file_writer_delegate_->Start(file.ReleaseValue(), blob_request_.get());
812 } 792 }
813 793
814 bool FileSystemOperation::VerifyFileSystemPathForRead( 794 bool FileSystemOperation::VerifyFileSystemPathForRead(
815 const GURL& path, GURL* origin_url, FileSystemType* type, 795 const GURL& path, GURL* origin_url, FileSystemType* type,
816 FilePath* virtual_path, FileSystemFileUtil** file_system_file_util) { 796 FilePath* virtual_path, FileUtil** file_util) {
817 797
818 // If we have no context, we just allow any operations, for testing. 798 // If we have no context, we just allow any operations, for testing.
819 // TODO(ericu): Revisit this hack for security. 799 // TODO(ericu): Revisit this hack for security.
820 if (!file_system_context()) { 800 if (!file_system_context()) {
821 #ifdef OS_WIN 801 #ifdef OS_WIN
822 // On Windows, the path will look like /C:/foo/bar; we need to remove the 802 // On Windows, the path will look like /C:/foo/bar; we need to remove the
823 // leading slash to make it valid. But if it's empty, we shouldn't do 803 // leading slash to make it valid. But if it's empty, we shouldn't do
824 // anything. 804 // anything.
825 std::string temp = UnescapeURLComponent(path.path(), 805 std::string temp = UnescapeURLComponent(path.path(),
826 UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS); 806 UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS);
827 if (temp.size()) 807 if (temp.size())
828 temp = temp.substr(1); 808 temp = temp.substr(1);
829 *virtual_path = FilePath(UTF8ToWide(temp)).NormalizeWindowsPathSeparators(); 809 *virtual_path = FilePath(UTF8ToWide(temp)).NormalizeWindowsPathSeparators();
830 #else 810 #else
831 *virtual_path = FilePath(path.path()); 811 *virtual_path = FilePath(path.path());
832 #endif 812 #endif
833 *type = file_system_operation_context_.src_type(); 813 *type = file_system_operation_context_.src_type();
834 *origin_url = file_system_operation_context_.src_origin_url(); 814 *origin_url = file_system_operation_context_.src_origin_url();
835 *file_system_file_util = NULL; 815 *file_util = NULL;
836 return true; 816 return true;
837 } 817 }
838 818
839 // We may want do more checks, but for now it just checks if the given 819 // We may want do more checks, but for now it just checks if the given
840 // URL is valid. 820 // URL is valid.
841 if (!CrackFileSystemURL(path, origin_url, type, virtual_path)) { 821 if (!CrackFileSystemURL(path, origin_url, type, virtual_path)) {
842 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_INVALID_URL); 822 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_INVALID_URL);
843 return false; 823 return false;
844 } 824 }
845 if (!file_system_context()->path_manager()->IsAccessAllowed( 825 if (!file_system_context()->path_manager()->IsAccessAllowed(
846 *origin_url, *type, *virtual_path)) { 826 *origin_url, *type, *virtual_path)) {
847 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_SECURITY); 827 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_SECURITY);
848 return false; 828 return false;
849 } 829 }
850 DCHECK(file_system_file_util); 830 DCHECK(file_util);
851 *file_system_file_util = 831 *file_util = file_system_context()->path_manager()->GetFileUtil(*type);
852 file_system_context()->path_manager()->GetFileSystemFileUtil(*type); 832 DCHECK(*file_util);
853 DCHECK(*file_system_file_util);
854 833
855 // We notify this read access whether the read access succeeds or not. 834 // We notify this read access whether the read access succeeds or not.
856 // This must be ok since this is used to let the QM's eviction logic know 835 // This must be ok since this is used to let the QM's eviction logic know
857 // someone is interested in reading the origin data and therefore to indicate 836 // someone is interested in reading the origin data and therefore to indicate
858 // that evicting this origin may not be a good idea. 837 // that evicting this origin may not be a good idea.
859 FileSystemQuotaUtil* quota_util = file_system_context()->GetQuotaUtil(*type); 838 FileSystemQuotaUtil* quota_util = file_system_context()->GetQuotaUtil(*type);
860 if (quota_util) { 839 if (quota_util) {
861 quota_util->NotifyOriginWasAccessedOnIOThread( 840 quota_util->NotifyOriginWasAccessedOnIOThread(
862 file_system_context()->quota_manager_proxy(), 841 file_system_context()->quota_manager_proxy(),
863 *origin_url, 842 *origin_url,
864 *type); 843 *type);
865 } 844 }
866 845
867 return true; 846 return true;
868 } 847 }
869 848
870 bool FileSystemOperation::VerifyFileSystemPathForWrite( 849 bool FileSystemOperation::VerifyFileSystemPathForWrite(
871 const GURL& path, bool create, GURL* origin_url, FileSystemType* type, 850 const GURL& path, bool create, GURL* origin_url, FileSystemType* type,
872 FilePath* virtual_path, FileSystemFileUtil** file_system_file_util) { 851 FilePath* virtual_path, FileUtil** file_util) {
873 852
874 // If we have no context, we just allow any operations, for testing. 853 // If we have no context, we just allow any operations, for testing.
875 // TODO(ericu): Revisit this hack for security. 854 // TODO(ericu): Revisit this hack for security.
876 if (!file_system_context()) { 855 if (!file_system_context()) {
877 #ifdef OS_WIN 856 #ifdef OS_WIN
878 // On Windows, the path will look like /C:/foo/bar; we need to remove the 857 // On Windows, the path will look like /C:/foo/bar; we need to remove the
879 // leading slash to make it valid. But if it's empty, we shouldn't do 858 // leading slash to make it valid. But if it's empty, we shouldn't do
880 // anything. 859 // anything.
881 std::string temp = UnescapeURLComponent(path.path(), 860 std::string temp = UnescapeURLComponent(path.path(),
882 UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS); 861 UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS);
883 if (temp.size()) 862 if (temp.size())
884 temp = temp.substr(1); 863 temp = temp.substr(1);
885 *virtual_path = FilePath(UTF8ToWide(temp)).NormalizeWindowsPathSeparators(); 864 *virtual_path = FilePath(UTF8ToWide(temp)).NormalizeWindowsPathSeparators();
886 #else 865 #else
887 *virtual_path = FilePath(path.path()); 866 *virtual_path = FilePath(path.path());
888 #endif 867 #endif
889 *type = file_system_operation_context_.dest_type(); 868 *type = file_system_operation_context_.dest_type();
890 *origin_url = file_system_operation_context_.dest_origin_url(); 869 *origin_url = file_system_operation_context_.dest_origin_url();
891 *file_system_file_util = NULL; 870 *file_util = NULL;
892 return true; 871 return true;
893 } 872 }
894 873
895 if (!CrackFileSystemURL(path, origin_url, type, virtual_path)) { 874 if (!CrackFileSystemURL(path, origin_url, type, virtual_path)) {
896 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_INVALID_URL); 875 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_INVALID_URL);
897 return false; 876 return false;
898 } 877 }
899 if (!file_system_context()->path_manager()->IsAccessAllowed( 878 if (!file_system_context()->path_manager()->IsAccessAllowed(
900 *origin_url, *type, *virtual_path)) { 879 *origin_url, *type, *virtual_path)) {
901 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_SECURITY); 880 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_SECURITY);
902 return false; 881 return false;
903 } 882 }
904 // Any write access is disallowed on the root path. 883 // Any write access is disallowed on the root path.
905 if (virtual_path->value().length() == 0 || 884 if (virtual_path->value().length() == 0 ||
906 virtual_path->DirName().value() == virtual_path->value()) { 885 virtual_path->DirName().value() == virtual_path->value()) {
907 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_SECURITY); 886 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_SECURITY);
908 return false; 887 return false;
909 } 888 }
910 if (create && file_system_context()->path_manager()->IsRestrictedFileName( 889 if (create && file_system_context()->path_manager()->IsRestrictedFileName(
911 *type, virtual_path->BaseName())) { 890 *type, virtual_path->BaseName())) {
912 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_SECURITY); 891 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_SECURITY);
913 return false; 892 return false;
914 } 893 }
915 DCHECK(file_system_file_util); 894 DCHECK(file_util);
916 *file_system_file_util = 895 *file_util = file_system_context()->path_manager()->GetFileUtil(*type);
917 file_system_context()->path_manager()->GetFileSystemFileUtil(*type); 896 DCHECK(*file_util);
918 DCHECK(*file_system_file_util);
919 897
920 return true; 898 return true;
921 } 899 }
922 900
923 } // namespace fileapi 901 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698