| 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 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_PATH_MANAGER_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_PATH_MANAGER_H_ |
| 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_PATH_MANAGER_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_PATH_MANAGER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "webkit/fileapi/file_system_types.h" | 12 #include "webkit/fileapi/file_system_types.h" |
| 13 #include "webkit/quota/special_storage_policy.h" | 13 #include "webkit/quota/special_storage_policy.h" |
| 14 | 14 |
| 15 class GURL; | 15 class GURL; |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class MessageLoopProxy; | 18 class MessageLoopProxy; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace fileapi { | 21 namespace fileapi { |
| 22 | 22 |
| 23 class FileSystemMountPointProvider; | 23 class ExternalFileSystemMountPointProvider; |
| 24 class SandboxMountPointProvider; | 24 class SandboxMountPointProvider; |
| 25 | 25 |
| 26 // TODO(kinuko): Probably this module must be called FileSystemPathUtil | 26 // TODO(kinuko): Probably this module must be called FileSystemPathUtil |
| 27 // or something similar. | 27 // or something similar. |
| 28 | 28 |
| 29 // An interface to construct or crack sandboxed filesystem paths. | 29 // An interface to construct or crack sandboxed filesystem paths. |
| 30 // Currently each sandboxed filesystem path looks like: | 30 // Currently each sandboxed filesystem path looks like: |
| 31 // | 31 // |
| 32 // <profile_dir>/FileSystem/<origin_identifier>/<type>/chrome-<unique>/... | 32 // <profile_dir>/FileSystem/<origin_identifier>/<type>/chrome-<unique>/... |
| 33 // | 33 // |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 bool IsAllowedScheme(const GURL& url) const; | 74 bool IsAllowedScheme(const GURL& url) const; |
| 75 | 75 |
| 76 // Returns the string for the given |type|. | 76 // Returns the string for the given |type|. |
| 77 // Returns an empty string if the |type| is invalid. | 77 // Returns an empty string if the |type| is invalid. |
| 78 static std::string GetFileSystemTypeString(fileapi::FileSystemType type); | 78 static std::string GetFileSystemTypeString(fileapi::FileSystemType type); |
| 79 | 79 |
| 80 // Checks if a given |name| contains any restricted names/chars in it. | 80 // Checks if a given |name| contains any restricted names/chars in it. |
| 81 bool IsRestrictedFileName(FileSystemType type, | 81 bool IsRestrictedFileName(FileSystemType type, |
| 82 const FilePath& filename); | 82 const FilePath& filename); |
| 83 | 83 |
| 84 // Checks if an origin has access to a particular filesystem type. | 84 // Checks if an origin has access to a particular filesystem type and |
| 85 bool IsAllowedFileSystemType(GURL origin, FileSystemType type); | 85 // file element represented by |virtual_path|. |
| 86 bool IsAccessAllowed(const GURL& origin, FileSystemType type, |
| 87 const FilePath& virtual_path); |
| 86 | 88 |
| 87 SandboxMountPointProvider* sandbox_provider() const { | 89 SandboxMountPointProvider* sandbox_provider() const { |
| 88 return sandbox_provider_.get(); | 90 return sandbox_provider_.get(); |
| 89 } | 91 } |
| 90 | 92 |
| 93 ExternalFileSystemMountPointProvider* external_provider() const { |
| 94 return external_provider_.get(); |
| 95 } |
| 96 |
| 91 bool is_incognito() const { | 97 bool is_incognito() const { |
| 92 return is_incognito_; | 98 return is_incognito_; |
| 93 } | 99 } |
| 94 | 100 |
| 95 private: | 101 private: |
| 96 const bool is_incognito_; | 102 const bool is_incognito_; |
| 97 const bool allow_file_access_from_files_; | 103 const bool allow_file_access_from_files_; |
| 98 scoped_ptr<SandboxMountPointProvider> sandbox_provider_; | 104 scoped_ptr<SandboxMountPointProvider> sandbox_provider_; |
| 99 scoped_ptr<FileSystemMountPointProvider> local_provider_; | 105 scoped_ptr<ExternalFileSystemMountPointProvider> external_provider_; |
| 100 | 106 |
| 101 DISALLOW_COPY_AND_ASSIGN(FileSystemPathManager); | 107 DISALLOW_COPY_AND_ASSIGN(FileSystemPathManager); |
| 102 }; | 108 }; |
| 103 | 109 |
| 104 } // namespace fileapi | 110 } // namespace fileapi |
| 105 | 111 |
| 106 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_PATH_MANAGER_H_ | 112 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_PATH_MANAGER_H_ |
| OLD | NEW |