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/chromeos/fileapi/cros_mount_point_provider.h" | 5 #include "webkit/chromeos/fileapi/cros_mount_point_provider.h" |
6 | 6 |
7 #include "base/chromeos/chromeos_version.h" | 7 #include "base/chromeos/chromeos_version.h" |
8 #include "base/logging.h" | 8 #include "base/logging.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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 if (!mount_points_->GetRegisteredPath(mount_name, &root_path) && | 82 if (!mount_points_->GetRegisteredPath(mount_name, &root_path) && |
83 !system_mount_points_->GetRegisteredPath(mount_name, &root_path)) { | 83 !system_mount_points_->GetRegisteredPath(mount_name, &root_path)) { |
84 return FilePath(); | 84 return FilePath(); |
85 } | 85 } |
86 | 86 |
87 return root_path.DirName(); | 87 return root_path.DirName(); |
88 } | 88 } |
89 | 89 |
90 bool CrosMountPointProvider::IsAccessAllowed( | 90 bool CrosMountPointProvider::IsAccessAllowed( |
91 const fileapi::FileSystemURL& url) { | 91 const fileapi::FileSystemURL& url) { |
92 if (!CanHandleURL(url)) | 92 if (!url.is_valid()) |
93 return false; | 93 return false; |
94 | 94 |
95 // No extra check is needed for isolated file systems. | |
96 if (url.mount_type() == fileapi::kFileSystemTypeIsolated) | |
97 return true; | |
98 | |
99 // Permit access to mount points from internal WebUI. | 95 // Permit access to mount points from internal WebUI. |
100 const GURL& origin_url = url.origin(); | 96 const GURL& origin_url = url.origin(); |
101 if (origin_url.SchemeIs(kChromeUIScheme)) | 97 if (origin_url.SchemeIs(kChromeUIScheme)) |
102 return true; | 98 return true; |
103 | 99 |
| 100 // No extra check is needed for isolated file systems. |
| 101 if (url.mount_type() == fileapi::kFileSystemTypeIsolated) |
| 102 return true; |
| 103 |
| 104 if (!CanHandleURL(url)) |
| 105 return false; |
| 106 |
104 std::string extension_id = origin_url.host(); | 107 std::string extension_id = origin_url.host(); |
105 // Check first to make sure this extension has fileBrowserHander permissions. | 108 // Check first to make sure this extension has fileBrowserHander permissions. |
106 if (!special_storage_policy_->IsFileHandler(extension_id)) | 109 if (!special_storage_policy_->IsFileHandler(extension_id)) |
107 return false; | 110 return false; |
108 | 111 |
109 return file_access_permissions_->HasAccessPermission(extension_id, | 112 return file_access_permissions_->HasAccessPermission(extension_id, |
110 url.virtual_path()); | 113 url.virtual_path()); |
111 } | 114 } |
112 | 115 |
113 // TODO(zelidrag): Share this code with SandboxMountPointProvider impl. | 116 // TODO(zelidrag): Share this code with SandboxMountPointProvider impl. |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 fileapi::RemoteFileSystemProxyInterface* CrosMountPointProvider::GetRemoteProxy( | 315 fileapi::RemoteFileSystemProxyInterface* CrosMountPointProvider::GetRemoteProxy( |
313 const std::string& mount_name) const { | 316 const std::string& mount_name) const { |
314 fileapi::RemoteFileSystemProxyInterface* proxy = | 317 fileapi::RemoteFileSystemProxyInterface* proxy = |
315 mount_points_->GetRemoteFileSystemProxy(mount_name); | 318 mount_points_->GetRemoteFileSystemProxy(mount_name); |
316 if (proxy) | 319 if (proxy) |
317 return proxy; | 320 return proxy; |
318 return system_mount_points_->GetRemoteFileSystemProxy(mount_name); | 321 return system_mount_points_->GetRemoteFileSystemProxy(mount_name); |
319 } | 322 } |
320 | 323 |
321 } // namespace chromeos | 324 } // namespace chromeos |
OLD | NEW |