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 "ppapi/shared_impl/file_system_util.h" | 5 #include "ppapi/shared_impl/file_system_util.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace ppapi { | 9 namespace ppapi { |
10 | 10 |
11 fileapi::FileSystemType PepperFileSystemTypeToFileSystemType( | |
12 PP_FileSystemType type) { | |
13 switch (type) { | |
14 case PP_FILESYSTEMTYPE_LOCALTEMPORARY: | |
15 return fileapi::kFileSystemTypeTemporary; | |
16 case PP_FILESYSTEMTYPE_LOCALPERSISTENT: | |
17 return fileapi::kFileSystemTypePersistent; | |
18 case PP_FILESYSTEMTYPE_EXTERNAL: | |
19 return fileapi::kFileSystemTypeExternal; | |
20 default: | |
21 return fileapi::kFileSystemTypeUnknown; | |
22 } | |
23 } | |
24 | |
25 bool FileSystemTypeIsValid(PP_FileSystemType type) { | 11 bool FileSystemTypeIsValid(PP_FileSystemType type) { |
26 return (type == PP_FILESYSTEMTYPE_LOCALPERSISTENT || | 12 return (type == PP_FILESYSTEMTYPE_LOCALPERSISTENT || |
27 type == PP_FILESYSTEMTYPE_LOCALTEMPORARY || | 13 type == PP_FILESYSTEMTYPE_LOCALTEMPORARY || |
28 type == PP_FILESYSTEMTYPE_EXTERNAL || | 14 type == PP_FILESYSTEMTYPE_EXTERNAL || |
29 type == PP_FILESYSTEMTYPE_ISOLATED); | 15 type == PP_FILESYSTEMTYPE_ISOLATED); |
30 } | 16 } |
31 | 17 |
32 bool FileSystemTypeHasQuota(PP_FileSystemType type) { | 18 bool FileSystemTypeHasQuota(PP_FileSystemType type) { |
33 return (type == PP_FILESYSTEMTYPE_LOCALTEMPORARY || | 19 return (type == PP_FILESYSTEMTYPE_LOCALTEMPORARY || |
34 type == PP_FILESYSTEMTYPE_LOCALPERSISTENT); | 20 type == PP_FILESYSTEMTYPE_LOCALPERSISTENT); |
35 } | 21 } |
36 | 22 |
37 std::string IsolatedFileSystemTypeToRootName( | 23 std::string IsolatedFileSystemTypeToRootName( |
38 PP_IsolatedFileSystemType_Private type) { | 24 PP_IsolatedFileSystemType_Private type) { |
39 switch (type) { | 25 switch (type) { |
40 case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX: | 26 case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX: |
41 return "crxfs"; | 27 return "crxfs"; |
42 case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE: | 28 case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE: |
43 return "pluginprivate"; | 29 return "pluginprivate"; |
44 default: | 30 default: |
45 NOTREACHED() << type; | 31 NOTREACHED() << type; |
46 return std::string(); | 32 return std::string(); |
47 } | 33 } |
48 } | 34 } |
49 | 35 |
50 } // namespace ppapi | 36 } // namespace ppapi |
OLD | NEW |