OLD | NEW |
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/sandbox_mount_point_provider.h" | 5 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 kIncognito, | 57 kIncognito, |
58 kInvalidSchemeError, | 58 kInvalidSchemeError, |
59 kCreateDirectoryError, | 59 kCreateDirectoryError, |
60 kNotFound, | 60 kNotFound, |
61 kUnknownError, | 61 kUnknownError, |
62 kFileSystemErrorMax, | 62 kFileSystemErrorMax, |
63 }; | 63 }; |
64 | 64 |
65 const char kTemporaryOriginsCountLabel[] = "FileSystem.TemporaryOriginsCount"; | 65 const char kTemporaryOriginsCountLabel[] = "FileSystem.TemporaryOriginsCount"; |
66 const char kPersistentOriginsCountLabel[] = "FileSystem.PersistentOriginsCount"; | 66 const char kPersistentOriginsCountLabel[] = "FileSystem.PersistentOriginsCount"; |
| 67 const char kSyncableOriginsCountLabel[] = "FileSystem.SyncableOriginsCount"; |
67 | 68 |
68 // Restricted names. | 69 // Restricted names. |
69 // http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#naming-restrictions | 70 // http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#naming-restrictions |
70 const base::FilePath::CharType* const kRestrictedNames[] = { | 71 const base::FilePath::CharType* const kRestrictedNames[] = { |
71 FILE_PATH_LITERAL("."), FILE_PATH_LITERAL(".."), | 72 FILE_PATH_LITERAL("."), FILE_PATH_LITERAL(".."), |
72 }; | 73 }; |
73 | 74 |
74 // Restricted chars. | 75 // Restricted chars. |
75 const base::FilePath::CharType kRestrictedChars[] = { | 76 const base::FilePath::CharType kRestrictedChars[] = { |
76 FILE_PATH_LITERAL('/'), FILE_PATH_LITERAL('\\'), | 77 FILE_PATH_LITERAL('/'), FILE_PATH_LITERAL('\\'), |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 if (enumerator->HasFileSystemType(type)) | 427 if (enumerator->HasFileSystemType(type)) |
427 origins->insert(origin); | 428 origins->insert(origin); |
428 } | 429 } |
429 switch (type) { | 430 switch (type) { |
430 case kFileSystemTypeTemporary: | 431 case kFileSystemTypeTemporary: |
431 UMA_HISTOGRAM_COUNTS(kTemporaryOriginsCountLabel, origins->size()); | 432 UMA_HISTOGRAM_COUNTS(kTemporaryOriginsCountLabel, origins->size()); |
432 break; | 433 break; |
433 case kFileSystemTypePersistent: | 434 case kFileSystemTypePersistent: |
434 UMA_HISTOGRAM_COUNTS(kPersistentOriginsCountLabel, origins->size()); | 435 UMA_HISTOGRAM_COUNTS(kPersistentOriginsCountLabel, origins->size()); |
435 break; | 436 break; |
| 437 case kFileSystemTypeSyncable: |
| 438 UMA_HISTOGRAM_COUNTS(kSyncableOriginsCountLabel, origins->size()); |
| 439 break; |
436 default: | 440 default: |
437 break; | 441 break; |
438 } | 442 } |
439 } | 443 } |
440 | 444 |
441 void SandboxMountPointProvider::GetOriginsForHostOnFileThread( | 445 void SandboxMountPointProvider::GetOriginsForHostOnFileThread( |
442 fileapi::FileSystemType type, const std::string& host, | 446 fileapi::FileSystemType type, const std::string& host, |
443 std::set<GURL>* origins) { | 447 std::set<GURL>* origins) { |
444 DCHECK(CanHandleType(type)); | 448 DCHECK(CanHandleType(type)); |
445 DCHECK(origins); | 449 DCHECK(origins); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 FileSystemType type, | 642 FileSystemType type, |
639 FileSystemUsageCache* usage_cache) { | 643 FileSystemUsageCache* usage_cache) { |
640 base::PlatformFileError error = base::PLATFORM_FILE_OK; | 644 base::PlatformFileError error = base::PLATFORM_FILE_OK; |
641 base::FilePath usage_cache_path = GetUsageCachePathForOriginAndType( | 645 base::FilePath usage_cache_path = GetUsageCachePathForOriginAndType( |
642 file_util, origin, type, &error); | 646 file_util, origin, type, &error); |
643 if (error == base::PLATFORM_FILE_OK) | 647 if (error == base::PLATFORM_FILE_OK) |
644 usage_cache->IncrementDirty(usage_cache_path); | 648 usage_cache->IncrementDirty(usage_cache_path); |
645 } | 649 } |
646 | 650 |
647 } // namespace fileapi | 651 } // namespace fileapi |
OLD | NEW |