Chromium Code Reviews| 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_callback_factory.h" | 8 #include "base/memory/scoped_callback_factory.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 scoped_refptr<base::MessageLoopProxy> file_message_loop, | 119 scoped_refptr<base::MessageLoopProxy> file_message_loop, |
| 120 const FilePath& profile_path) | 120 const FilePath& profile_path) |
| 121 : path_manager_(path_manager), | 121 : path_manager_(path_manager), |
| 122 file_message_loop_(file_message_loop), | 122 file_message_loop_(file_message_loop), |
| 123 base_path_(profile_path.Append(kFileSystemDirectory)) { | 123 base_path_(profile_path.Append(kFileSystemDirectory)) { |
| 124 } | 124 } |
| 125 | 125 |
| 126 SandboxMountPointProvider::~SandboxMountPointProvider() { | 126 SandboxMountPointProvider::~SandboxMountPointProvider() { |
| 127 } | 127 } |
| 128 | 128 |
| 129 bool SandboxMountPointProvider::IsAccessAllowed(const GURL& origin_url) { | 129 bool SandboxMountPointProvider::IsAccessAllowed(const GURL& origin_url, |
| 130 const FilePath& unused) { | |
| 130 // We essentially depend on quota to do our access controls. | 131 // We essentially depend on quota to do our access controls. |
| 131 return path_manager_->IsAllowedScheme(origin_url); | 132 return path_manager_->IsAllowedScheme(origin_url); |
| 132 } | 133 } |
| 133 | 134 |
| 135 void SandboxMountPointProvider::GrantAccess(const GURL& origin_url, | |
| 136 const FilePath& virtual_path) { | |
| 137 NOTREACHED(); | |
| 138 } | |
| 139 | |
| 134 class SandboxMountPointProvider::GetFileSystemRootPathTask | 140 class SandboxMountPointProvider::GetFileSystemRootPathTask |
| 135 : public base::RefCountedThreadSafe< | 141 : public base::RefCountedThreadSafe< |
| 136 SandboxMountPointProvider::GetFileSystemRootPathTask> { | 142 SandboxMountPointProvider::GetFileSystemRootPathTask> { |
| 137 public: | 143 public: |
| 138 GetFileSystemRootPathTask( | 144 GetFileSystemRootPathTask( |
| 139 scoped_refptr<base::MessageLoopProxy> file_message_loop, | 145 scoped_refptr<base::MessageLoopProxy> file_message_loop, |
| 140 const std::string& name, | 146 const std::string& name, |
| 141 FileSystemPathManager::GetRootPathCallback* callback) | 147 FileSystemPathManager::GetRootPathCallback* callback) |
| 142 : file_message_loop_(file_message_loop), | 148 : file_message_loop_(file_message_loop), |
| 143 origin_message_loop_proxy_( | 149 origin_message_loop_proxy_( |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 | 210 |
| 205 for (size_t i = 0; i < arraysize(kRestrictedChars); ++i) { | 211 for (size_t i = 0; i < arraysize(kRestrictedChars); ++i) { |
| 206 if (filename.value().find(kRestrictedChars[i]) != | 212 if (filename.value().find(kRestrictedChars[i]) != |
| 207 FilePath::StringType::npos) | 213 FilePath::StringType::npos) |
| 208 return true; | 214 return true; |
| 209 } | 215 } |
| 210 | 216 |
| 211 return false; | 217 return false; |
| 212 } | 218 } |
| 213 | 219 |
| 220 std::vector<FilePath> SandboxMountPointProvider::GetRootDirectories() const { | |
| 221 NOTREACHED(); | |
| 222 return std::vector<FilePath>(); | |
|
ericu
2011/04/08 02:12:14
Please add a TODO(ericu) to implement this and use
zel
2011/04/08 04:16:36
Done.
| |
| 223 } | |
| 224 | |
| 214 void SandboxMountPointProvider::GetFileSystemRootPath( | 225 void SandboxMountPointProvider::GetFileSystemRootPath( |
| 215 const GURL& origin_url, fileapi::FileSystemType type, | 226 const GURL& origin_url, fileapi::FileSystemType type, |
| 216 bool create, FileSystemPathManager::GetRootPathCallback* callback_ptr) { | 227 bool create, FileSystemPathManager::GetRootPathCallback* callback_ptr) { |
| 217 scoped_ptr<FileSystemPathManager::GetRootPathCallback> callback(callback_ptr); | 228 scoped_ptr<FileSystemPathManager::GetRootPathCallback> callback(callback_ptr); |
| 218 std::string name; | 229 std::string name; |
| 219 FilePath origin_base_path; | 230 FilePath origin_base_path; |
| 220 | 231 |
| 221 if (!GetOriginBasePathAndName(origin_url, &origin_base_path, type, &name)) { | 232 if (!GetOriginBasePathAndName(origin_url, &origin_base_path, type, &name)) { |
| 222 callback->Run(false, FilePath(), std::string()); | 233 callback->Run(false, FilePath(), std::string()); |
| 223 return; | 234 return; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 307 | 318 |
| 308 std::string type_string = | 319 std::string type_string = |
| 309 FileSystemPathManager::GetFileSystemTypeString(type); | 320 FileSystemPathManager::GetFileSystemTypeString(type); |
| 310 DCHECK(!type_string.empty()); | 321 DCHECK(!type_string.empty()); |
| 311 if (name) | 322 if (name) |
| 312 *name = origin_identifier + ":" + type_string; | 323 *name = origin_identifier + ":" + type_string; |
| 313 return true; | 324 return true; |
| 314 } | 325 } |
| 315 | 326 |
| 316 } // namespace fileapi | 327 } // namespace fileapi |
| OLD | NEW |