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

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

Issue 14096022: Make MountPointProvider pluggable from outside webkit/fileapi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix etc Created 7 years, 8 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"
(...skipping 29 matching lines...) Expand all
40 if (CommandLine::ForCurrentProcess()->HasSwitch( 40 if (CommandLine::ForCurrentProcess()->HasSwitch(
41 switches::kAllowFileAccessFromFiles)) { 41 switches::kAllowFileAccessFromFiles)) {
42 additional_allowed_schemes.push_back(chrome::kFileScheme); 42 additional_allowed_schemes.push_back(chrome::kFileScheme);
43 } 43 }
44 return FileSystemOptions(profile_mode, additional_allowed_schemes); 44 return FileSystemOptions(profile_mode, additional_allowed_schemes);
45 } 45 }
46 46
47 } // namespace 47 } // namespace
48 48
49 scoped_refptr<fileapi::FileSystemContext> CreateFileSystemContext( 49 scoped_refptr<fileapi::FileSystemContext> CreateFileSystemContext(
50 const base::FilePath& profile_path, bool is_incognito, 50 const base::FilePath& profile_path,
51 fileapi::ExternalMountPoints* external_mount_points, 51 bool is_incognito,
52 quota::SpecialStoragePolicy* special_storage_policy, 52 fileapi::ExternalMountPoints* external_mount_points,
53 quota::QuotaManagerProxy* quota_manager_proxy) { 53 quota::SpecialStoragePolicy* special_storage_policy,
54 quota::QuotaManagerProxy* quota_manager_proxy) {
54 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); 55 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool();
55 base::SequencedWorkerPool::SequenceToken media_sequence_token = 56 base::SequencedWorkerPool::SequenceToken media_sequence_token =
56 pool->GetNamedSequenceToken(fileapi::kMediaTaskRunnerName); 57 pool->GetNamedSequenceToken(fileapi::kMediaTaskRunnerName);
57 58
58 scoped_ptr<fileapi::FileSystemTaskRunners> task_runners( 59 scoped_ptr<fileapi::FileSystemTaskRunners> task_runners(
59 new fileapi::FileSystemTaskRunners( 60 new fileapi::FileSystemTaskRunners(
60 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 61 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
61 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), 62 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE),
62 pool->GetSequencedTaskRunner(media_sequence_token))); 63 pool->GetSequencedTaskRunner(media_sequence_token)));
63 64
65 // Setting up additional mount point providers.
66 ScopedVector<fileapi::FileSystemMountPointProvider> additional_providers;
64 return new fileapi::FileSystemContext( 67 return new fileapi::FileSystemContext(
65 task_runners.Pass(), 68 task_runners.Pass(),
66 external_mount_points, 69 external_mount_points,
67 special_storage_policy, 70 special_storage_policy,
68 quota_manager_proxy, 71 quota_manager_proxy,
72 ScopedVector<fileapi::FileSystemMountPointProvider>(),
69 profile_path, 73 profile_path,
70 CreateBrowserFileSystemOptions(is_incognito)); 74 CreateBrowserFileSystemOptions(is_incognito));
71 } 75 }
72 76
73 bool CheckFileSystemPermissionsForProcess( 77 bool CheckFileSystemPermissionsForProcess(
74 fileapi::FileSystemContext* context, int process_id, 78 fileapi::FileSystemContext* context, int process_id,
75 const fileapi::FileSystemURL& url, int permissions, 79 const fileapi::FileSystemURL& url, int permissions,
76 base::PlatformFileError* error) { 80 base::PlatformFileError* error) {
77 DCHECK(error); 81 DCHECK(error);
78 *error = base::PLATFORM_FILE_OK; 82 *error = base::PLATFORM_FILE_OK;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // for the file. (We first need to check if it can already be read not to 161 // for the file. (We first need to check if it can already be read not to
158 // overwrite existing permissions) 162 // overwrite existing permissions)
159 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( 163 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(
160 process_id, *platform_path)) { 164 process_id, *platform_path)) {
161 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( 165 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile(
162 process_id, *platform_path); 166 process_id, *platform_path);
163 } 167 }
164 } 168 }
165 169
166 } // namespace content 170 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/drive_file_system_util_unittest.cc ('k') | content/browser/fileapi/fileapi_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698