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

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

Issue 18344013: fileapi: Rename FileSystemMountProvider to FileSystemBackend (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments 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_thread.h" 15 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/content_browser_client.h" 16 #include "content/public/browser/content_browser_client.h"
17 #include "content/public/common/content_client.h" 17 #include "content/public/common/content_client.h"
18 #include "content/public/common/content_switches.h" 18 #include "content/public/common/content_switches.h"
19 #include "content/public/common/url_constants.h" 19 #include "content/public/common/url_constants.h"
20 #include "webkit/browser/fileapi/external_mount_points.h" 20 #include "webkit/browser/fileapi/external_mount_points.h"
21 #include "webkit/browser/fileapi/file_permission_policy.h" 21 #include "webkit/browser/fileapi/file_permission_policy.h"
22 #include "webkit/browser/fileapi/file_system_mount_point_provider.h" 22 #include "webkit/browser/fileapi/file_system_backend.h"
23 #include "webkit/browser/fileapi/file_system_operation_runner.h" 23 #include "webkit/browser/fileapi/file_system_operation_runner.h"
24 #include "webkit/browser/fileapi/file_system_options.h" 24 #include "webkit/browser/fileapi/file_system_options.h"
25 #include "webkit/browser/fileapi/file_system_task_runners.h" 25 #include "webkit/browser/fileapi/file_system_task_runners.h"
26 #include "webkit/browser/quota/quota_manager.h" 26 #include "webkit/browser/quota/quota_manager.h"
27 27
28 namespace content { 28 namespace content {
29 29
30 namespace { 30 namespace {
31 31
32 using fileapi::FileSystemOptions; 32 using fileapi::FileSystemOptions;
(...skipping 24 matching lines...) Expand all
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::FileSystemMountPointProvider> additional_providers; 67 ScopedVector<fileapi::FileSystemBackend> additional_providers;
68 GetContentClient()->browser()->GetAdditionalFileSystemMountPointProviders( 68 GetContentClient()->browser()->GetAdditionalFileSystemBackends(
69 profile_path, 69 profile_path,
70 special_storage_policy, 70 special_storage_policy,
71 external_mount_points, 71 external_mount_points,
72 &additional_providers); 72 &additional_providers);
73 73
74 scoped_refptr<fileapi::FileSystemContext> file_system_context = 74 scoped_refptr<fileapi::FileSystemContext> file_system_context =
75 new fileapi::FileSystemContext( 75 new fileapi::FileSystemContext(
76 task_runners.Pass(), 76 task_runners.Pass(),
77 external_mount_points, 77 external_mount_points,
78 special_storage_policy, 78 special_storage_policy,
(...skipping 19 matching lines...) Expand all
98 const fileapi::FileSystemURL& url, int permissions, 98 const fileapi::FileSystemURL& url, int permissions,
99 base::PlatformFileError* error) { 99 base::PlatformFileError* error) {
100 DCHECK(error); 100 DCHECK(error);
101 *error = base::PLATFORM_FILE_OK; 101 *error = base::PLATFORM_FILE_OK;
102 102
103 if (!url.is_valid()) { 103 if (!url.is_valid()) {
104 *error = base::PLATFORM_FILE_ERROR_INVALID_URL; 104 *error = base::PLATFORM_FILE_ERROR_INVALID_URL;
105 return false; 105 return false;
106 } 106 }
107 107
108 fileapi::FileSystemMountPointProvider* mount_point_provider = 108 fileapi::FileSystemBackend* mount_point_provider =
109 context->GetMountPointProvider(url.type()); 109 context->GetFileSystemBackend(url.type());
110 if (!mount_point_provider) { 110 if (!mount_point_provider) {
111 *error = base::PLATFORM_FILE_ERROR_INVALID_URL; 111 *error = base::PLATFORM_FILE_ERROR_INVALID_URL;
112 return false; 112 return false;
113 } 113 }
114 114
115 base::FilePath file_path; 115 base::FilePath file_path;
116 ChildProcessSecurityPolicyImpl* policy = 116 ChildProcessSecurityPolicyImpl* policy =
117 ChildProcessSecurityPolicyImpl::GetInstance(); 117 ChildProcessSecurityPolicyImpl::GetInstance();
118 118
119 if (policy->HasPermissionsForFileSystemFile(process_id, url, permissions)) 119 if (policy->HasPermissionsForFileSystemFile(process_id, url, permissions))
(...skipping 29 matching lines...) Expand all
149 // for the file. (We first need to check if it can already be read not to 149 // for the file. (We first need to check if it can already be read not to
150 // overwrite existing permissions) 150 // overwrite existing permissions)
151 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( 151 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(
152 process_id, *platform_path)) { 152 process_id, *platform_path)) {
153 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( 153 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile(
154 process_id, *platform_path); 154 process_id, *platform_path);
155 } 155 }
156 } 156 }
157 157
158 } // namespace content 158 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698