OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/runtime/runtime_api.h" | 5 #include "extensions/browser/api/runtime/runtime_api.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 | 521 |
522 ExtensionFunction::ResponseAction | 522 ExtensionFunction::ResponseAction |
523 RuntimeGetPackageDirectoryEntryFunction::Run() { | 523 RuntimeGetPackageDirectoryEntryFunction::Run() { |
524 fileapi::IsolatedContext* isolated_context = | 524 fileapi::IsolatedContext* isolated_context = |
525 fileapi::IsolatedContext::GetInstance(); | 525 fileapi::IsolatedContext::GetInstance(); |
526 DCHECK(isolated_context); | 526 DCHECK(isolated_context); |
527 | 527 |
528 std::string relative_path = kPackageDirectoryPath; | 528 std::string relative_path = kPackageDirectoryPath; |
529 base::FilePath path = extension_->path(); | 529 base::FilePath path = extension_->path(); |
530 std::string filesystem_id = isolated_context->RegisterFileSystemForPath( | 530 std::string filesystem_id = isolated_context->RegisterFileSystemForPath( |
531 fileapi::kFileSystemTypeNativeLocal, path, &relative_path); | 531 fileapi::kFileSystemTypeNativeLocal, std::string(), path, &relative_path); |
532 | 532 |
533 int renderer_id = render_view_host_->GetProcess()->GetID(); | 533 int renderer_id = render_view_host_->GetProcess()->GetID(); |
534 content::ChildProcessSecurityPolicy* policy = | 534 content::ChildProcessSecurityPolicy* policy = |
535 content::ChildProcessSecurityPolicy::GetInstance(); | 535 content::ChildProcessSecurityPolicy::GetInstance(); |
536 policy->GrantReadFileSystem(renderer_id, filesystem_id); | 536 policy->GrantReadFileSystem(renderer_id, filesystem_id); |
537 base::DictionaryValue* dict = new base::DictionaryValue(); | 537 base::DictionaryValue* dict = new base::DictionaryValue(); |
538 dict->SetString("fileSystemId", filesystem_id); | 538 dict->SetString("fileSystemId", filesystem_id); |
539 dict->SetString("baseName", relative_path); | 539 dict->SetString("baseName", relative_path); |
540 return RespondNow(OneArgument(dict)); | 540 return RespondNow(OneArgument(dict)); |
541 } | 541 } |
542 | 542 |
543 } // namespace extensions | 543 } // namespace extensions |
OLD | NEW |