| 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 "chrome/browser/chromeos/fileapi/file_system_backend.h" | 5 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 return file_access_permissions_->HasAccessPermission(extension_id, | 141 return file_access_permissions_->HasAccessPermission(extension_id, |
| 142 url.virtual_path()); | 142 url.virtual_path()); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void FileSystemBackend::GrantFullAccessToExtension( | 145 void FileSystemBackend::GrantFullAccessToExtension( |
| 146 const std::string& extension_id) { | 146 const std::string& extension_id) { |
| 147 DCHECK(special_storage_policy_->IsFileHandler(extension_id)); | 147 DCHECK(special_storage_policy_->IsFileHandler(extension_id)); |
| 148 if (!special_storage_policy_->IsFileHandler(extension_id)) | 148 if (!special_storage_policy_->IsFileHandler(extension_id)) |
| 149 return; | 149 return; |
| 150 | 150 file_access_permissions_->GrantFullAccessPermission(extension_id); |
| 151 std::vector<fileapi::MountPoints::MountPointInfo> files; | |
| 152 mount_points_->AddMountPointInfosTo(&files); | |
| 153 system_mount_points_->AddMountPointInfosTo(&files); | |
| 154 | |
| 155 for (size_t i = 0; i < files.size(); ++i) { | |
| 156 file_access_permissions_->GrantAccessPermission( | |
| 157 extension_id, | |
| 158 base::FilePath::FromUTF8Unsafe(files[i].name)); | |
| 159 } | |
| 160 } | 151 } |
| 161 | 152 |
| 162 void FileSystemBackend::GrantFileAccessToExtension( | 153 void FileSystemBackend::GrantFileAccessToExtension( |
| 163 const std::string& extension_id, const base::FilePath& virtual_path) { | 154 const std::string& extension_id, const base::FilePath& virtual_path) { |
| 164 // All we care about here is access from extensions for now. | 155 // All we care about here is access from extensions for now. |
| 165 DCHECK(special_storage_policy_->IsFileHandler(extension_id)); | 156 DCHECK(special_storage_policy_->IsFileHandler(extension_id)); |
| 166 if (!special_storage_policy_->IsFileHandler(extension_id)) | 157 if (!special_storage_policy_->IsFileHandler(extension_id)) |
| 167 return; | 158 return; |
| 168 | 159 |
| 169 std::string id; | 160 std::string id; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 } | 273 } |
| 283 | 274 |
| 284 bool FileSystemBackend::GetVirtualPath( | 275 bool FileSystemBackend::GetVirtualPath( |
| 285 const base::FilePath& filesystem_path, | 276 const base::FilePath& filesystem_path, |
| 286 base::FilePath* virtual_path) { | 277 base::FilePath* virtual_path) { |
| 287 return mount_points_->GetVirtualPath(filesystem_path, virtual_path) || | 278 return mount_points_->GetVirtualPath(filesystem_path, virtual_path) || |
| 288 system_mount_points_->GetVirtualPath(filesystem_path, virtual_path); | 279 system_mount_points_->GetVirtualPath(filesystem_path, virtual_path); |
| 289 } | 280 } |
| 290 | 281 |
| 291 } // namespace chromeos | 282 } // namespace chromeos |
| OLD | NEW |