Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: content/browser/fileapi/browser_file_system_helper.cc

Issue 18667002: Pass BrowserContext to drive::MountPointProviderDelegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/sequenced_task_runner.h" 12 #include "base/sequenced_task_runner.h"
13 #include "base/threading/sequenced_worker_pool.h" 13 #include "base/threading/sequenced_worker_pool.h"
14 #include "content/browser/child_process_security_policy_impl.h" 14 #include "content/browser/child_process_security_policy_impl.h"
15 #include "content/public/browser/browser_context.h"
15 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/content_browser_client.h" 17 #include "content/public/browser/content_browser_client.h"
17 #include "content/public/common/content_client.h" 18 #include "content/public/common/content_client.h"
18 #include "content/public/common/content_switches.h" 19 #include "content/public/common/content_switches.h"
19 #include "content/public/common/url_constants.h" 20 #include "content/public/common/url_constants.h"
20 #include "webkit/browser/fileapi/external_mount_points.h" 21 #include "webkit/browser/fileapi/external_mount_points.h"
21 #include "webkit/browser/fileapi/file_permission_policy.h" 22 #include "webkit/browser/fileapi/file_permission_policy.h"
22 #include "webkit/browser/fileapi/file_system_backend.h" 23 #include "webkit/browser/fileapi/file_system_backend.h"
23 #include "webkit/browser/fileapi/file_system_operation_runner.h" 24 #include "webkit/browser/fileapi/file_system_operation_runner.h"
24 #include "webkit/browser/fileapi/file_system_options.h" 25 #include "webkit/browser/fileapi/file_system_options.h"
(...skipping 16 matching lines...) Expand all
41 if (CommandLine::ForCurrentProcess()->HasSwitch( 42 if (CommandLine::ForCurrentProcess()->HasSwitch(
42 switches::kAllowFileAccessFromFiles)) { 43 switches::kAllowFileAccessFromFiles)) {
43 additional_allowed_schemes.push_back(chrome::kFileScheme); 44 additional_allowed_schemes.push_back(chrome::kFileScheme);
44 } 45 }
45 return FileSystemOptions(profile_mode, additional_allowed_schemes); 46 return FileSystemOptions(profile_mode, additional_allowed_schemes);
46 } 47 }
47 48
48 } // namespace 49 } // namespace
49 50
50 scoped_refptr<fileapi::FileSystemContext> CreateFileSystemContext( 51 scoped_refptr<fileapi::FileSystemContext> CreateFileSystemContext(
52 BrowserContext* browser_context,
51 const base::FilePath& profile_path, 53 const base::FilePath& profile_path,
52 bool is_incognito, 54 bool is_incognito,
53 fileapi::ExternalMountPoints* external_mount_points,
54 quota::SpecialStoragePolicy* special_storage_policy,
55 quota::QuotaManagerProxy* quota_manager_proxy) { 55 quota::QuotaManagerProxy* quota_manager_proxy) {
56 56
57 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); 57 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool();
58 scoped_refptr<base::SequencedTaskRunner> file_task_runner = 58 scoped_refptr<base::SequencedTaskRunner> file_task_runner =
59 pool->GetSequencedTaskRunner(pool->GetNamedSequenceToken("FileAPI")); 59 pool->GetSequencedTaskRunner(pool->GetNamedSequenceToken("FileAPI"));
60 60
61 scoped_ptr<fileapi::FileSystemTaskRunners> task_runners( 61 scoped_ptr<fileapi::FileSystemTaskRunners> task_runners(
62 new fileapi::FileSystemTaskRunners( 62 new fileapi::FileSystemTaskRunners(
63 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get(), 63 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get(),
64 file_task_runner.get())); 64 file_task_runner.get()));
65 65
66 // Setting up additional mount point providers. 66 // Setting up additional mount point providers.
67 ScopedVector<fileapi::FileSystemBackend> additional_providers; 67 ScopedVector<fileapi::FileSystemBackend> additional_providers;
68 GetContentClient()->browser()->GetAdditionalFileSystemBackends( 68 GetContentClient()->browser()->GetAdditionalFileSystemBackends(
69 browser_context,
69 profile_path, 70 profile_path,
70 special_storage_policy,
71 external_mount_points,
72 &additional_providers); 71 &additional_providers);
73 72
74 scoped_refptr<fileapi::FileSystemContext> file_system_context = 73 scoped_refptr<fileapi::FileSystemContext> file_system_context =
75 new fileapi::FileSystemContext( 74 new fileapi::FileSystemContext(
76 task_runners.Pass(), 75 task_runners.Pass(),
77 external_mount_points, 76 BrowserContext::GetMountPoints(browser_context),
78 special_storage_policy, 77 browser_context->GetSpecialStoragePolicy(),
79 quota_manager_proxy, 78 quota_manager_proxy,
80 additional_providers.Pass(), 79 additional_providers.Pass(),
81 profile_path, 80 profile_path,
82 CreateBrowserFileSystemOptions(is_incognito)); 81 CreateBrowserFileSystemOptions(is_incognito));
83 82
84 std::vector<fileapi::FileSystemType> types; 83 std::vector<fileapi::FileSystemType> types;
85 file_system_context->GetFileSystemTypes(&types); 84 file_system_context->GetFileSystemTypes(&types);
86 for (size_t i = 0; i < types.size(); ++i) { 85 for (size_t i = 0; i < types.size(); ++i) {
87 ChildProcessSecurityPolicyImpl::GetInstance()-> 86 ChildProcessSecurityPolicyImpl::GetInstance()->
88 RegisterFileSystemPermissionPolicy( 87 RegisterFileSystemPermissionPolicy(
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // for the file. (We first need to check if it can already be read not to 148 // for the file. (We first need to check if it can already be read not to
150 // overwrite existing permissions) 149 // overwrite existing permissions)
151 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( 150 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(
152 process_id, *platform_path)) { 151 process_id, *platform_path)) {
153 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( 152 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile(
154 process_id, *platform_path); 153 process_id, *platform_path);
155 } 154 }
156 } 155 }
157 156
158 } // namespace content 157 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/fileapi/browser_file_system_helper.h ('k') | content/browser/storage_partition_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698