| OLD | NEW |
| 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/sandbox_file_system_backend_delegate.h" | 5 #include "webkit/browser/fileapi/sandbox_file_system_backend_delegate.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 private: | 106 private: |
| 107 scoped_ptr<ObfuscatedFileUtil::AbstractOriginEnumerator> enum_; | 107 scoped_ptr<ObfuscatedFileUtil::AbstractOriginEnumerator> enum_; |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 void OpenFileSystemOnFileTaskRunner( | 110 void OpenFileSystemOnFileTaskRunner( |
| 111 ObfuscatedFileUtil* file_util, | 111 ObfuscatedFileUtil* file_util, |
| 112 const GURL& origin_url, | 112 const GURL& origin_url, |
| 113 FileSystemType type, | 113 FileSystemType type, |
| 114 OpenFileSystemMode mode, | 114 OpenFileSystemMode mode, |
| 115 base::PlatformFileError* error_ptr) { | 115 base::File::Error* error_ptr) { |
| 116 DCHECK(error_ptr); | 116 DCHECK(error_ptr); |
| 117 const bool create = (mode == OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT); | 117 const bool create = (mode == OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT); |
| 118 file_util->GetDirectoryForOriginAndType( | 118 file_util->GetDirectoryForOriginAndType( |
| 119 origin_url, SandboxFileSystemBackendDelegate::GetTypeString(type), | 119 origin_url, SandboxFileSystemBackendDelegate::GetTypeString(type), |
| 120 create, error_ptr); | 120 create, error_ptr); |
| 121 if (*error_ptr != base::PLATFORM_FILE_OK) { | 121 if (*error_ptr != base::File::FILE_OK) { |
| 122 UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemLabel, | 122 UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemLabel, |
| 123 kCreateDirectoryError, | 123 kCreateDirectoryError, |
| 124 kFileSystemErrorMax); | 124 kFileSystemErrorMax); |
| 125 } else { | 125 } else { |
| 126 UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemLabel, kOK, kFileSystemErrorMax); | 126 UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemLabel, kOK, kFileSystemErrorMax); |
| 127 } | 127 } |
| 128 // The reference of file_util will be derefed on the FILE thread | 128 // The reference of file_util will be derefed on the FILE thread |
| 129 // when the storage of this callback gets deleted regardless of whether | 129 // when the storage of this callback gets deleted regardless of whether |
| 130 // this method is called or not. | 130 // this method is called or not. |
| 131 } | 131 } |
| 132 | 132 |
| 133 void DidOpenFileSystem( | 133 void DidOpenFileSystem( |
| 134 base::WeakPtr<SandboxFileSystemBackendDelegate> delegate, | 134 base::WeakPtr<SandboxFileSystemBackendDelegate> delegate, |
| 135 const base::Callback<void(base::PlatformFileError error)>& callback, | 135 const base::Callback<void(base::File::Error error)>& callback, |
| 136 base::PlatformFileError* error) { | 136 base::File::Error* error) { |
| 137 if (delegate.get()) | 137 if (delegate.get()) |
| 138 delegate.get()->CollectOpenFileSystemMetrics(*error); | 138 delegate.get()->CollectOpenFileSystemMetrics(*error); |
| 139 callback.Run(*error); | 139 callback.Run(*error); |
| 140 } | 140 } |
| 141 | 141 |
| 142 template <typename T> | 142 template <typename T> |
| 143 void DeleteSoon(base::SequencedTaskRunner* runner, T* ptr) { | 143 void DeleteSoon(base::SequencedTaskRunner* runner, T* ptr) { |
| 144 if (!runner->DeleteSoon(FROM_HERE, ptr)) | 144 if (!runner->DeleteSoon(FROM_HERE, ptr)) |
| 145 delete ptr; | 145 delete ptr; |
| 146 } | 146 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 SandboxFileSystemBackendDelegate::OriginEnumerator* | 229 SandboxFileSystemBackendDelegate::OriginEnumerator* |
| 230 SandboxFileSystemBackendDelegate::CreateOriginEnumerator() { | 230 SandboxFileSystemBackendDelegate::CreateOriginEnumerator() { |
| 231 return new ObfuscatedOriginEnumerator(obfuscated_file_util()); | 231 return new ObfuscatedOriginEnumerator(obfuscated_file_util()); |
| 232 } | 232 } |
| 233 | 233 |
| 234 base::FilePath | 234 base::FilePath |
| 235 SandboxFileSystemBackendDelegate::GetBaseDirectoryForOriginAndType( | 235 SandboxFileSystemBackendDelegate::GetBaseDirectoryForOriginAndType( |
| 236 const GURL& origin_url, | 236 const GURL& origin_url, |
| 237 FileSystemType type, | 237 FileSystemType type, |
| 238 bool create) { | 238 bool create) { |
| 239 base::PlatformFileError error = base::PLATFORM_FILE_OK; | 239 base::File::Error error = base::File::FILE_OK; |
| 240 base::FilePath path = obfuscated_file_util()->GetDirectoryForOriginAndType( | 240 base::FilePath path = obfuscated_file_util()->GetDirectoryForOriginAndType( |
| 241 origin_url, GetTypeString(type), create, &error); | 241 origin_url, GetTypeString(type), create, &error); |
| 242 if (error != base::PLATFORM_FILE_OK) | 242 if (error != base::File::FILE_OK) |
| 243 return base::FilePath(); | 243 return base::FilePath(); |
| 244 return path; | 244 return path; |
| 245 } | 245 } |
| 246 | 246 |
| 247 void SandboxFileSystemBackendDelegate::OpenFileSystem( | 247 void SandboxFileSystemBackendDelegate::OpenFileSystem( |
| 248 const GURL& origin_url, | 248 const GURL& origin_url, |
| 249 FileSystemType type, | 249 FileSystemType type, |
| 250 OpenFileSystemMode mode, | 250 OpenFileSystemMode mode, |
| 251 const OpenFileSystemCallback& callback, | 251 const OpenFileSystemCallback& callback, |
| 252 const GURL& root_url) { | 252 const GURL& root_url) { |
| 253 if (!IsAllowedScheme(origin_url)) { | 253 if (!IsAllowedScheme(origin_url)) { |
| 254 callback.Run(GURL(), std::string(), base::PLATFORM_FILE_ERROR_SECURITY); | 254 callback.Run(GURL(), std::string(), base::File::FILE_ERROR_SECURITY); |
| 255 return; | 255 return; |
| 256 } | 256 } |
| 257 | 257 |
| 258 std::string name = GetFileSystemName(origin_url, type); | 258 std::string name = GetFileSystemName(origin_url, type); |
| 259 | 259 |
| 260 base::PlatformFileError* error_ptr = new base::PlatformFileError; | 260 base::File::Error* error_ptr = new base::File::Error; |
| 261 file_task_runner_->PostTaskAndReply( | 261 file_task_runner_->PostTaskAndReply( |
| 262 FROM_HERE, | 262 FROM_HERE, |
| 263 base::Bind(&OpenFileSystemOnFileTaskRunner, | 263 base::Bind(&OpenFileSystemOnFileTaskRunner, |
| 264 obfuscated_file_util(), origin_url, type, mode, | 264 obfuscated_file_util(), origin_url, type, mode, |
| 265 base::Unretained(error_ptr)), | 265 base::Unretained(error_ptr)), |
| 266 base::Bind(&DidOpenFileSystem, | 266 base::Bind(&DidOpenFileSystem, |
| 267 weak_factory_.GetWeakPtr(), | 267 weak_factory_.GetWeakPtr(), |
| 268 base::Bind(callback, root_url, name), | 268 base::Bind(callback, root_url, name), |
| 269 base::Owned(error_ptr))); | 269 base::Owned(error_ptr))); |
| 270 | 270 |
| 271 io_thread_checker_.DetachFromThread(); | 271 io_thread_checker_.DetachFromThread(); |
| 272 is_filesystem_opened_ = true; | 272 is_filesystem_opened_ = true; |
| 273 } | 273 } |
| 274 | 274 |
| 275 scoped_ptr<FileSystemOperationContext> | 275 scoped_ptr<FileSystemOperationContext> |
| 276 SandboxFileSystemBackendDelegate::CreateFileSystemOperationContext( | 276 SandboxFileSystemBackendDelegate::CreateFileSystemOperationContext( |
| 277 const FileSystemURL& url, | 277 const FileSystemURL& url, |
| 278 FileSystemContext* context, | 278 FileSystemContext* context, |
| 279 base::PlatformFileError* error_code) const { | 279 base::File::Error* error_code) const { |
| 280 if (!IsAccessValid(url)) { | 280 if (!IsAccessValid(url)) { |
| 281 *error_code = base::PLATFORM_FILE_ERROR_SECURITY; | 281 *error_code = base::File::FILE_ERROR_SECURITY; |
| 282 return scoped_ptr<FileSystemOperationContext>(); | 282 return scoped_ptr<FileSystemOperationContext>(); |
| 283 } | 283 } |
| 284 | 284 |
| 285 const UpdateObserverList* update_observers = GetUpdateObservers(url.type()); | 285 const UpdateObserverList* update_observers = GetUpdateObservers(url.type()); |
| 286 const ChangeObserverList* change_observers = GetChangeObservers(url.type()); | 286 const ChangeObserverList* change_observers = GetChangeObservers(url.type()); |
| 287 DCHECK(update_observers); | 287 DCHECK(update_observers); |
| 288 | 288 |
| 289 scoped_ptr<FileSystemOperationContext> operation_context( | 289 scoped_ptr<FileSystemOperationContext> operation_context( |
| 290 new FileSystemOperationContext(context)); | 290 new FileSystemOperationContext(context)); |
| 291 operation_context->set_update_observers(*update_observers); | 291 operation_context->set_update_observers(*update_observers); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 315 FileSystemContext* context, | 315 FileSystemContext* context, |
| 316 FileSystemType type) const { | 316 FileSystemType type) const { |
| 317 if (!IsAccessValid(url)) | 317 if (!IsAccessValid(url)) |
| 318 return scoped_ptr<FileStreamWriter>(); | 318 return scoped_ptr<FileStreamWriter>(); |
| 319 const UpdateObserverList* observers = GetUpdateObservers(type); | 319 const UpdateObserverList* observers = GetUpdateObservers(type); |
| 320 DCHECK(observers); | 320 DCHECK(observers); |
| 321 return scoped_ptr<FileStreamWriter>( | 321 return scoped_ptr<FileStreamWriter>( |
| 322 new SandboxFileStreamWriter(context, url, offset, *observers)); | 322 new SandboxFileStreamWriter(context, url, offset, *observers)); |
| 323 } | 323 } |
| 324 | 324 |
| 325 base::PlatformFileError | 325 base::File::Error |
| 326 SandboxFileSystemBackendDelegate::DeleteOriginDataOnFileTaskRunner( | 326 SandboxFileSystemBackendDelegate::DeleteOriginDataOnFileTaskRunner( |
| 327 FileSystemContext* file_system_context, | 327 FileSystemContext* file_system_context, |
| 328 quota::QuotaManagerProxy* proxy, | 328 quota::QuotaManagerProxy* proxy, |
| 329 const GURL& origin_url, | 329 const GURL& origin_url, |
| 330 FileSystemType type) { | 330 FileSystemType type) { |
| 331 DCHECK(file_task_runner_->RunsTasksOnCurrentThread()); | 331 DCHECK(file_task_runner_->RunsTasksOnCurrentThread()); |
| 332 int64 usage = GetOriginUsageOnFileTaskRunner( | 332 int64 usage = GetOriginUsageOnFileTaskRunner( |
| 333 file_system_context, origin_url, type); | 333 file_system_context, origin_url, type); |
| 334 usage_cache()->CloseCacheFiles(); | 334 usage_cache()->CloseCacheFiles(); |
| 335 bool result = obfuscated_file_util()->DeleteDirectoryForOriginAndType( | 335 bool result = obfuscated_file_util()->DeleteDirectoryForOriginAndType( |
| 336 origin_url, GetTypeString(type)); | 336 origin_url, GetTypeString(type)); |
| 337 if (result && proxy) { | 337 if (result && proxy) { |
| 338 proxy->NotifyStorageModified( | 338 proxy->NotifyStorageModified( |
| 339 quota::QuotaClient::kFileSystem, | 339 quota::QuotaClient::kFileSystem, |
| 340 origin_url, | 340 origin_url, |
| 341 FileSystemTypeToQuotaStorageType(type), | 341 FileSystemTypeToQuotaStorageType(type), |
| 342 -usage); | 342 -usage); |
| 343 } | 343 } |
| 344 | 344 |
| 345 if (result) | 345 if (result) |
| 346 return base::PLATFORM_FILE_OK; | 346 return base::File::FILE_OK; |
| 347 return base::PLATFORM_FILE_ERROR_FAILED; | 347 return base::File::FILE_ERROR_FAILED; |
| 348 } | 348 } |
| 349 | 349 |
| 350 void SandboxFileSystemBackendDelegate::GetOriginsForTypeOnFileTaskRunner( | 350 void SandboxFileSystemBackendDelegate::GetOriginsForTypeOnFileTaskRunner( |
| 351 FileSystemType type, std::set<GURL>* origins) { | 351 FileSystemType type, std::set<GURL>* origins) { |
| 352 DCHECK(file_task_runner_->RunsTasksOnCurrentThread()); | 352 DCHECK(file_task_runner_->RunsTasksOnCurrentThread()); |
| 353 DCHECK(origins); | 353 DCHECK(origins); |
| 354 scoped_ptr<OriginEnumerator> enumerator(CreateOriginEnumerator()); | 354 scoped_ptr<OriginEnumerator> enumerator(CreateOriginEnumerator()); |
| 355 GURL origin; | 355 GURL origin; |
| 356 while (!(origin = enumerator->Next()).is_empty()) { | 356 while (!(origin = enumerator->Next()).is_empty()) { |
| 357 if (enumerator->HasFileSystemType(type)) | 357 if (enumerator->HasFileSystemType(type)) |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 } | 487 } |
| 488 | 488 |
| 489 void SandboxFileSystemBackendDelegate::RegisterQuotaUpdateObserver( | 489 void SandboxFileSystemBackendDelegate::RegisterQuotaUpdateObserver( |
| 490 FileSystemType type) { | 490 FileSystemType type) { |
| 491 AddFileUpdateObserver(type, quota_observer_.get(), file_task_runner_.get()); | 491 AddFileUpdateObserver(type, quota_observer_.get(), file_task_runner_.get()); |
| 492 } | 492 } |
| 493 | 493 |
| 494 void SandboxFileSystemBackendDelegate::InvalidateUsageCache( | 494 void SandboxFileSystemBackendDelegate::InvalidateUsageCache( |
| 495 const GURL& origin, | 495 const GURL& origin, |
| 496 FileSystemType type) { | 496 FileSystemType type) { |
| 497 base::PlatformFileError error = base::PLATFORM_FILE_OK; | 497 base::File::Error error = base::File::FILE_OK; |
| 498 base::FilePath usage_file_path = GetUsageCachePathForOriginAndType( | 498 base::FilePath usage_file_path = GetUsageCachePathForOriginAndType( |
| 499 obfuscated_file_util(), origin, type, &error); | 499 obfuscated_file_util(), origin, type, &error); |
| 500 if (error != base::PLATFORM_FILE_OK) | 500 if (error != base::File::FILE_OK) |
| 501 return; | 501 return; |
| 502 usage_cache()->IncrementDirty(usage_file_path); | 502 usage_cache()->IncrementDirty(usage_file_path); |
| 503 } | 503 } |
| 504 | 504 |
| 505 void SandboxFileSystemBackendDelegate::StickyInvalidateUsageCache( | 505 void SandboxFileSystemBackendDelegate::StickyInvalidateUsageCache( |
| 506 const GURL& origin, | 506 const GURL& origin, |
| 507 FileSystemType type) { | 507 FileSystemType type) { |
| 508 sticky_dirty_origins_.insert(std::make_pair(origin, type)); | 508 sticky_dirty_origins_.insert(std::make_pair(origin, type)); |
| 509 quota_observer()->SetUsageCacheEnabled(origin, type, false); | 509 quota_observer()->SetUsageCacheEnabled(origin, type, false); |
| 510 InvalidateUsageCache(origin, type); | 510 InvalidateUsageCache(origin, type); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 file_system_options_.additional_allowed_schemes()[i].c_str())) | 561 file_system_options_.additional_allowed_schemes()[i].c_str())) |
| 562 return true; | 562 return true; |
| 563 } | 563 } |
| 564 return false; | 564 return false; |
| 565 } | 565 } |
| 566 | 566 |
| 567 base::FilePath | 567 base::FilePath |
| 568 SandboxFileSystemBackendDelegate::GetUsageCachePathForOriginAndType( | 568 SandboxFileSystemBackendDelegate::GetUsageCachePathForOriginAndType( |
| 569 const GURL& origin_url, | 569 const GURL& origin_url, |
| 570 FileSystemType type) { | 570 FileSystemType type) { |
| 571 base::PlatformFileError error; | 571 base::File::Error error; |
| 572 base::FilePath path = GetUsageCachePathForOriginAndType( | 572 base::FilePath path = GetUsageCachePathForOriginAndType( |
| 573 obfuscated_file_util(), origin_url, type, &error); | 573 obfuscated_file_util(), origin_url, type, &error); |
| 574 if (error != base::PLATFORM_FILE_OK) | 574 if (error != base::File::FILE_OK) |
| 575 return base::FilePath(); | 575 return base::FilePath(); |
| 576 return path; | 576 return path; |
| 577 } | 577 } |
| 578 | 578 |
| 579 // static | 579 // static |
| 580 base::FilePath | 580 base::FilePath |
| 581 SandboxFileSystemBackendDelegate::GetUsageCachePathForOriginAndType( | 581 SandboxFileSystemBackendDelegate::GetUsageCachePathForOriginAndType( |
| 582 ObfuscatedFileUtil* sandbox_file_util, | 582 ObfuscatedFileUtil* sandbox_file_util, |
| 583 const GURL& origin_url, | 583 const GURL& origin_url, |
| 584 FileSystemType type, | 584 FileSystemType type, |
| 585 base::PlatformFileError* error_out) { | 585 base::File::Error* error_out) { |
| 586 DCHECK(error_out); | 586 DCHECK(error_out); |
| 587 *error_out = base::PLATFORM_FILE_OK; | 587 *error_out = base::File::FILE_OK; |
| 588 base::FilePath base_path = sandbox_file_util->GetDirectoryForOriginAndType( | 588 base::FilePath base_path = sandbox_file_util->GetDirectoryForOriginAndType( |
| 589 origin_url, GetTypeString(type), false /* create */, error_out); | 589 origin_url, GetTypeString(type), false /* create */, error_out); |
| 590 if (*error_out != base::PLATFORM_FILE_OK) | 590 if (*error_out != base::File::FILE_OK) |
| 591 return base::FilePath(); | 591 return base::FilePath(); |
| 592 return base_path.Append(FileSystemUsageCache::kUsageFileName); | 592 return base_path.Append(FileSystemUsageCache::kUsageFileName); |
| 593 } | 593 } |
| 594 | 594 |
| 595 int64 SandboxFileSystemBackendDelegate::RecalculateUsage( | 595 int64 SandboxFileSystemBackendDelegate::RecalculateUsage( |
| 596 FileSystemContext* context, | 596 FileSystemContext* context, |
| 597 const GURL& origin, | 597 const GURL& origin, |
| 598 FileSystemType type) { | 598 FileSystemType type) { |
| 599 FileSystemOperationContext operation_context(context); | 599 FileSystemOperationContext operation_context(context); |
| 600 FileSystemURL url = context->CreateCrackedFileSystemURL( | 600 FileSystemURL url = context->CreateCrackedFileSystemURL( |
| 601 origin, type, base::FilePath()); | 601 origin, type, base::FilePath()); |
| 602 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> enumerator( | 602 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> enumerator( |
| 603 obfuscated_file_util()->CreateFileEnumerator( | 603 obfuscated_file_util()->CreateFileEnumerator( |
| 604 &operation_context, url, true)); | 604 &operation_context, url, true)); |
| 605 | 605 |
| 606 base::FilePath file_path_each; | 606 base::FilePath file_path_each; |
| 607 int64 usage = 0; | 607 int64 usage = 0; |
| 608 | 608 |
| 609 while (!(file_path_each = enumerator->Next()).empty()) { | 609 while (!(file_path_each = enumerator->Next()).empty()) { |
| 610 usage += enumerator->Size(); | 610 usage += enumerator->Size(); |
| 611 usage += ObfuscatedFileUtil::ComputeFilePathCost(file_path_each); | 611 usage += ObfuscatedFileUtil::ComputeFilePathCost(file_path_each); |
| 612 } | 612 } |
| 613 | 613 |
| 614 return usage; | 614 return usage; |
| 615 } | 615 } |
| 616 | 616 |
| 617 void SandboxFileSystemBackendDelegate::CollectOpenFileSystemMetrics( | 617 void SandboxFileSystemBackendDelegate::CollectOpenFileSystemMetrics( |
| 618 base::PlatformFileError error_code) { | 618 base::File::Error error_code) { |
| 619 base::Time now = base::Time::Now(); | 619 base::Time now = base::Time::Now(); |
| 620 bool throttled = now < next_release_time_for_open_filesystem_stat_; | 620 bool throttled = now < next_release_time_for_open_filesystem_stat_; |
| 621 if (!throttled) { | 621 if (!throttled) { |
| 622 next_release_time_for_open_filesystem_stat_ = | 622 next_release_time_for_open_filesystem_stat_ = |
| 623 now + base::TimeDelta::FromHours(kMinimumStatsCollectionIntervalHours); | 623 now + base::TimeDelta::FromHours(kMinimumStatsCollectionIntervalHours); |
| 624 } | 624 } |
| 625 | 625 |
| 626 #define REPORT(report_value) \ | 626 #define REPORT(report_value) \ |
| 627 UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemDetailLabel, \ | 627 UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemDetailLabel, \ |
| 628 (report_value), \ | 628 (report_value), \ |
| 629 kFileSystemErrorMax); \ | 629 kFileSystemErrorMax); \ |
| 630 if (!throttled) { \ | 630 if (!throttled) { \ |
| 631 UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemDetailNonThrottledLabel, \ | 631 UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemDetailNonThrottledLabel, \ |
| 632 (report_value), \ | 632 (report_value), \ |
| 633 kFileSystemErrorMax); \ | 633 kFileSystemErrorMax); \ |
| 634 } | 634 } |
| 635 | 635 |
| 636 switch (error_code) { | 636 switch (error_code) { |
| 637 case base::PLATFORM_FILE_OK: | 637 case base::File::FILE_OK: |
| 638 REPORT(kOK); | 638 REPORT(kOK); |
| 639 break; | 639 break; |
| 640 case base::PLATFORM_FILE_ERROR_INVALID_URL: | 640 case base::File::FILE_ERROR_INVALID_URL: |
| 641 REPORT(kInvalidSchemeError); | 641 REPORT(kInvalidSchemeError); |
| 642 break; | 642 break; |
| 643 case base::PLATFORM_FILE_ERROR_NOT_FOUND: | 643 case base::File::FILE_ERROR_NOT_FOUND: |
| 644 REPORT(kNotFound); | 644 REPORT(kNotFound); |
| 645 break; | 645 break; |
| 646 case base::PLATFORM_FILE_ERROR_FAILED: | 646 case base::File::FILE_ERROR_FAILED: |
| 647 default: | 647 default: |
| 648 REPORT(kUnknownError); | 648 REPORT(kUnknownError); |
| 649 break; | 649 break; |
| 650 } | 650 } |
| 651 #undef REPORT | 651 #undef REPORT |
| 652 } | 652 } |
| 653 | 653 |
| 654 ObfuscatedFileUtil* SandboxFileSystemBackendDelegate::obfuscated_file_util() { | 654 ObfuscatedFileUtil* SandboxFileSystemBackendDelegate::obfuscated_file_util() { |
| 655 return static_cast<ObfuscatedFileUtil*>(sync_file_util()); | 655 return static_cast<ObfuscatedFileUtil*>(sync_file_util()); |
| 656 } | 656 } |
| 657 | 657 |
| 658 // Declared in obfuscated_file_util.h. | 658 // Declared in obfuscated_file_util.h. |
| 659 // static | 659 // static |
| 660 ObfuscatedFileUtil* ObfuscatedFileUtil::CreateForTesting( | 660 ObfuscatedFileUtil* ObfuscatedFileUtil::CreateForTesting( |
| 661 quota::SpecialStoragePolicy* special_storage_policy, | 661 quota::SpecialStoragePolicy* special_storage_policy, |
| 662 const base::FilePath& file_system_directory, | 662 const base::FilePath& file_system_directory, |
| 663 base::SequencedTaskRunner* file_task_runner) { | 663 base::SequencedTaskRunner* file_task_runner) { |
| 664 return new ObfuscatedFileUtil(special_storage_policy, | 664 return new ObfuscatedFileUtil(special_storage_policy, |
| 665 file_system_directory, | 665 file_system_directory, |
| 666 file_task_runner, | 666 file_task_runner, |
| 667 base::Bind(&GetTypeStringForURL), | 667 base::Bind(&GetTypeStringForURL), |
| 668 GetKnownTypeStrings(), | 668 GetKnownTypeStrings(), |
| 669 NULL); | 669 NULL); |
| 670 } | 670 } |
| 671 | 671 |
| 672 } // namespace fileapi | 672 } // namespace fileapi |
| OLD | NEW |