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/extensions/file_manager/private_api_file_syste
m.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_file_syste
m.h" |
6 | 6 |
7 #include <sys/statvfs.h> | 7 #include <sys/statvfs.h> |
8 | 8 |
9 #include "base/posix/eintr_wrapper.h" | 9 #include "base/posix/eintr_wrapper.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 FileManagerPrivateRequestFileSystemFunction::SetupFileSystemAccessPermissions( | 215 FileManagerPrivateRequestFileSystemFunction::SetupFileSystemAccessPermissions( |
216 scoped_refptr<storage::FileSystemContext> file_system_context, | 216 scoped_refptr<storage::FileSystemContext> file_system_context, |
217 int child_id, | 217 int child_id, |
218 Profile* profile, | 218 Profile* profile, |
219 scoped_refptr<const extensions::Extension> extension) { | 219 scoped_refptr<const extensions::Extension> extension) { |
220 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 220 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
221 | 221 |
222 if (!extension.get()) | 222 if (!extension.get()) |
223 return false; | 223 return false; |
224 | 224 |
225 // Make sure that only component extension can access the entire | |
226 // local file system. | |
227 if (extension_->location() != extensions::Manifest::COMPONENT) { | |
228 NOTREACHED() << "Private method access by non-component extension " | |
229 << extension->id(); | |
230 return false; | |
231 } | |
232 | |
233 storage::ExternalFileSystemBackend* backend = | 225 storage::ExternalFileSystemBackend* backend = |
234 file_system_context->external_backend(); | 226 file_system_context->external_backend(); |
235 if (!backend) | 227 if (!backend) |
236 return false; | 228 return false; |
237 | 229 |
238 // Grant full access to File API from this component extension. | 230 // Grant full access to File API from this component extension. |
239 backend->GrantFullAccessToExtension(extension_->id()); | 231 backend->GrantFullAccessToExtension(extension_->id()); |
240 | 232 |
241 // Grant R/W file permissions to the renderer hosting component | 233 // Grant R/W file permissions to the renderer hosting component |
242 // extension for all paths exposed by our local file system backend. | 234 // extension for all paths exposed by our local file system backend. |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 "/" + entry_definition_list->at(i).full_path.AsUTF8Unsafe(); | 665 "/" + entry_definition_list->at(i).full_path.AsUTF8Unsafe(); |
674 entry->file_is_directory = entry_definition_list->at(i).is_directory; | 666 entry->file_is_directory = entry_definition_list->at(i).is_directory; |
675 entries.push_back(entry); | 667 entries.push_back(entry); |
676 } | 668 } |
677 | 669 |
678 results_ = extensions::api::file_manager_private_internal:: | 670 results_ = extensions::api::file_manager_private_internal:: |
679 ResolveIsolatedEntries::Results::Create(entries); | 671 ResolveIsolatedEntries::Results::Create(entries); |
680 SendResponse(true); | 672 SendResponse(true); |
681 } | 673 } |
682 } // namespace extensions | 674 } // namespace extensions |
OLD | NEW |