| 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 "content/browser/fileapi/browser_file_system_helper.h" | 5 #include "content/browser/fileapi/browser_file_system_helper.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | |
| 9 #include <string> | 8 #include <string> |
| 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/sequenced_task_runner.h" | 14 #include "base/sequenced_task_runner.h" |
| 15 #include "base/threading/sequenced_worker_pool.h" | 15 #include "base/threading/sequenced_worker_pool.h" |
| 16 #include "content/browser/child_process_security_policy_impl.h" | 16 #include "content/browser/child_process_security_policy_impl.h" |
| 17 #include "content/public/browser/browser_context.h" | 17 #include "content/public/browser/browser_context.h" |
| 18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 19 #include "content/public/browser/content_browser_client.h" | 19 #include "content/public/browser/content_browser_client.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 std::vector<storage::URLRequestAutoMountHandler> | 72 std::vector<storage::URLRequestAutoMountHandler> |
| 73 url_request_auto_mount_handlers; | 73 url_request_auto_mount_handlers; |
| 74 GetContentClient()->browser()->GetURLRequestAutoMountHandlers( | 74 GetContentClient()->browser()->GetURLRequestAutoMountHandlers( |
| 75 &url_request_auto_mount_handlers); | 75 &url_request_auto_mount_handlers); |
| 76 | 76 |
| 77 scoped_refptr<storage::FileSystemContext> file_system_context = | 77 scoped_refptr<storage::FileSystemContext> file_system_context = |
| 78 new storage::FileSystemContext( | 78 new storage::FileSystemContext( |
| 79 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get(), | 79 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get(), |
| 80 file_task_runner.get(), | 80 file_task_runner.get(), |
| 81 BrowserContext::GetMountPoints(browser_context), | 81 BrowserContext::GetMountPoints(browser_context), |
| 82 browser_context->GetSpecialStoragePolicy(), | 82 browser_context->GetSpecialStoragePolicy(), quota_manager_proxy, |
| 83 quota_manager_proxy, | 83 std::move(additional_backends), url_request_auto_mount_handlers, |
| 84 additional_backends.Pass(), | 84 profile_path, CreateBrowserFileSystemOptions(is_incognito)); |
| 85 url_request_auto_mount_handlers, | |
| 86 profile_path, | |
| 87 CreateBrowserFileSystemOptions(is_incognito)); | |
| 88 | 85 |
| 89 std::vector<storage::FileSystemType> types; | 86 std::vector<storage::FileSystemType> types; |
| 90 file_system_context->GetFileSystemTypes(&types); | 87 file_system_context->GetFileSystemTypes(&types); |
| 91 for (size_t i = 0; i < types.size(); ++i) { | 88 for (size_t i = 0; i < types.size(); ++i) { |
| 92 ChildProcessSecurityPolicyImpl::GetInstance() | 89 ChildProcessSecurityPolicyImpl::GetInstance() |
| 93 ->RegisterFileSystemPermissionPolicy( | 90 ->RegisterFileSystemPermissionPolicy( |
| 94 types[i], | 91 types[i], |
| 95 storage::FileSystemContext::GetPermissionPolicy(types[i])); | 92 storage::FileSystemContext::GetPermissionPolicy(types[i])); |
| 96 } | 93 } |
| 97 | 94 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 context->operation_runner()->SyncGetPlatformPath(url, platform_path); | 126 context->operation_runner()->SyncGetPlatformPath(url, platform_path); |
| 130 | 127 |
| 131 // The path is to be attached to URLLoader so we grant read permission | 128 // The path is to be attached to URLLoader so we grant read permission |
| 132 // for the file. (We need to check first because a parent directory may | 129 // for the file. (We need to check first because a parent directory may |
| 133 // already have the permissions and we don't need to grant it to the file.) | 130 // already have the permissions and we don't need to grant it to the file.) |
| 134 if (!policy->CanReadFile(process_id, *platform_path)) | 131 if (!policy->CanReadFile(process_id, *platform_path)) |
| 135 policy->GrantReadFile(process_id, *platform_path); | 132 policy->GrantReadFile(process_id, *platform_path); |
| 136 } | 133 } |
| 137 | 134 |
| 138 } // namespace content | 135 } // namespace content |
| OLD | NEW |