| OLD | NEW |
| 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/sandbox_mount_point_provider.h" | 5 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_callback_factory.h" | 9 #include "base/memory/scoped_callback_factory.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 | 613 |
| 614 void SandboxMountPointProvider::EndUpdateOriginOnFileThread( | 614 void SandboxMountPointProvider::EndUpdateOriginOnFileThread( |
| 615 const GURL& origin_url, fileapi::FileSystemType type) { | 615 const GURL& origin_url, fileapi::FileSystemType type) { |
| 616 DCHECK(type == fileapi::kFileSystemTypeTemporary || | 616 DCHECK(type == fileapi::kFileSystemTypeTemporary || |
| 617 type == fileapi::kFileSystemTypePersistent); | 617 type == fileapi::kFileSystemTypePersistent); |
| 618 FilePath usage_file_path = GetUsageCachePathForOriginAndType( | 618 FilePath usage_file_path = GetUsageCachePathForOriginAndType( |
| 619 origin_url, type); | 619 origin_url, type); |
| 620 FileSystemUsageCache::DecrementDirty(usage_file_path); | 620 FileSystemUsageCache::DecrementDirty(usage_file_path); |
| 621 } | 621 } |
| 622 | 622 |
| 623 void SandboxMountPointProvider::MarkDirtyOriginOnFileThread( |
| 624 const GURL& origin_url, fileapi::FileSystemType type) { |
| 625 DCHECK(type == fileapi::kFileSystemTypeTemporary || |
| 626 type == fileapi::kFileSystemTypePersistent); |
| 627 FilePath usage_file_path = GetUsageCachePathForOriginAndType( |
| 628 origin_url, type); |
| 629 FileSystemUsageCache::IncrementDirty(usage_file_path); |
| 630 } |
| 631 |
| 623 FileSystemFileUtil* SandboxMountPointProvider::GetFileSystemFileUtil() { | 632 FileSystemFileUtil* SandboxMountPointProvider::GetFileSystemFileUtil() { |
| 624 return sandbox_file_util_.get(); | 633 return sandbox_file_util_.get(); |
| 625 } | 634 } |
| 626 | 635 |
| 627 FilePath SandboxMountPointProvider::GetUsageCachePathForOriginAndType( | 636 FilePath SandboxMountPointProvider::GetUsageCachePathForOriginAndType( |
| 628 const GURL& origin_url, fileapi::FileSystemType type) const { | 637 const GURL& origin_url, fileapi::FileSystemType type) const { |
| 629 FilePath base_path = | 638 FilePath base_path = |
| 630 GetBaseDirectoryForOriginAndType(origin_url, type, false); | 639 GetBaseDirectoryForOriginAndType(origin_url, type, false); |
| 631 if (base_path.empty()) | 640 if (base_path.empty()) |
| 632 return FilePath(); | 641 return FilePath(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 652 | 661 |
| 653 // Creates the root directory. | 662 // Creates the root directory. |
| 654 root = origin_base_path.Append(OldCreateUniqueDirectoryName(origin_url)); | 663 root = origin_base_path.Append(OldCreateUniqueDirectoryName(origin_url)); |
| 655 if (!file_util::CreateDirectory(root)) | 664 if (!file_util::CreateDirectory(root)) |
| 656 return FilePath(); | 665 return FilePath(); |
| 657 | 666 |
| 658 return root; | 667 return root; |
| 659 } | 668 } |
| 660 | 669 |
| 661 } // namespace fileapi | 670 } // namespace fileapi |
| OLD | NEW |