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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/threading/sequenced_worker_pool.h" | |
13 #include "content/browser/child_process_security_policy_impl.h" | 12 #include "content/browser/child_process_security_policy_impl.h" |
14 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/content_browser_client.h" | 14 #include "content/public/browser/content_browser_client.h" |
16 #include "content/public/common/content_client.h" | 15 #include "content/public/common/content_client.h" |
17 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
18 #include "content/public/common/url_constants.h" | 17 #include "content/public/common/url_constants.h" |
19 #include "webkit/browser/fileapi/external_mount_points.h" | 18 #include "webkit/browser/fileapi/external_mount_points.h" |
20 #include "webkit/browser/fileapi/file_permission_policy.h" | 19 #include "webkit/browser/fileapi/file_permission_policy.h" |
21 #include "webkit/browser/fileapi/file_system_operation_runner.h" | 20 #include "webkit/browser/fileapi/file_system_operation_runner.h" |
22 #include "webkit/browser/fileapi/file_system_options.h" | 21 #include "webkit/browser/fileapi/file_system_options.h" |
(...skipping 22 matching lines...) Expand all Loading... |
45 } | 44 } |
46 | 45 |
47 } // namespace | 46 } // namespace |
48 | 47 |
49 scoped_refptr<fileapi::FileSystemContext> CreateFileSystemContext( | 48 scoped_refptr<fileapi::FileSystemContext> CreateFileSystemContext( |
50 const base::FilePath& profile_path, | 49 const base::FilePath& profile_path, |
51 bool is_incognito, | 50 bool is_incognito, |
52 fileapi::ExternalMountPoints* external_mount_points, | 51 fileapi::ExternalMountPoints* external_mount_points, |
53 quota::SpecialStoragePolicy* special_storage_policy, | 52 quota::SpecialStoragePolicy* special_storage_policy, |
54 quota::QuotaManagerProxy* quota_manager_proxy) { | 53 quota::QuotaManagerProxy* quota_manager_proxy) { |
55 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); | |
56 base::SequencedWorkerPool::SequenceToken media_sequence_token = | |
57 pool->GetNamedSequenceToken(fileapi::kMediaTaskRunnerName); | |
58 | |
59 scoped_ptr<fileapi::FileSystemTaskRunners> task_runners( | 54 scoped_ptr<fileapi::FileSystemTaskRunners> task_runners( |
60 new fileapi::FileSystemTaskRunners( | 55 new fileapi::FileSystemTaskRunners( |
61 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 56 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
62 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), | 57 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE))); |
63 pool->GetSequencedTaskRunner(media_sequence_token))); | |
64 | 58 |
65 // Setting up additional mount point providers. | 59 // Setting up additional mount point providers. |
66 ScopedVector<fileapi::FileSystemMountPointProvider> additional_providers; | 60 ScopedVector<fileapi::FileSystemMountPointProvider> additional_providers; |
67 GetContentClient()->browser()->GetAdditionalFileSystemMountPointProviders( | 61 GetContentClient()->browser()->GetAdditionalFileSystemMountPointProviders( |
68 profile_path, &additional_providers); | 62 profile_path, &additional_providers); |
69 | 63 |
70 return new fileapi::FileSystemContext( | 64 return new fileapi::FileSystemContext( |
71 task_runners.Pass(), | 65 task_runners.Pass(), |
72 external_mount_points, | 66 external_mount_points, |
73 special_storage_policy, | 67 special_storage_policy, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // for the file. (We first need to check if it can already be read not to | 146 // for the file. (We first need to check if it can already be read not to |
153 // overwrite existing permissions) | 147 // overwrite existing permissions) |
154 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( | 148 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( |
155 process_id, *platform_path)) { | 149 process_id, *platform_path)) { |
156 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( | 150 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( |
157 process_id, *platform_path); | 151 process_id, *platform_path); |
158 } | 152 } |
159 } | 153 } |
160 | 154 |
161 } // namespace content | 155 } // namespace content |
OLD | NEW |