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

Side by Side Diff: chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/renderer_host/pepper/pepper_isolated_file_system_messag e_filter.h" 5 #include "chrome/browser/renderer_host/pepper/pepper_isolated_file_system_messag e_filter.h"
6 6
7 #include "chrome/browser/browser_process.h" 7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/profiles/profile_manager.h" 10 #include "chrome/browser/profiles/profile_manager.h"
11 #include "chrome/common/chrome_switches.h" 11 #include "chrome/common/chrome_switches.h"
12 #include "chrome/common/pepper_permission_util.h" 12 #include "chrome/common/pepper_permission_util.h"
13 #include "content/public/browser/browser_ppapi_host.h" 13 #include "content/public/browser/browser_ppapi_host.h"
14 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/child_process_security_policy.h" 15 #include "content/public/browser/child_process_security_policy.h"
16 #include "content/public/browser/render_view_host.h" 16 #include "content/public/browser/render_view_host.h"
17 #include "extensions/browser/extension_system.h" 17 #include "extensions/browser/extension_system.h"
18 #include "extensions/common/constants.h" 18 #include "extensions/common/constants.h"
19 #include "extensions/common/extension.h" 19 #include "extensions/common/extension.h"
20 #include "extensions/common/extension_set.h" 20 #include "extensions/common/extension_set.h"
21 #include "ppapi/c/pp_errors.h" 21 #include "ppapi/c/pp_errors.h"
22 #include "ppapi/host/dispatch_host_message.h" 22 #include "ppapi/host/dispatch_host_message.h"
23 #include "ppapi/host/host_message_context.h" 23 #include "ppapi/host/host_message_context.h"
24 #include "ppapi/host/ppapi_host.h" 24 #include "ppapi/host/ppapi_host.h"
25 #include "ppapi/proxy/ppapi_messages.h" 25 #include "ppapi/proxy/ppapi_messages.h"
26 #include "ppapi/shared_impl/file_system_util.h" 26 #include "ppapi/shared_impl/file_system_util.h"
27 #include "webkit/browser/fileapi/isolated_context.h" 27 #include "storage/browser/fileapi/isolated_context.h"
28 28
29 namespace chrome { 29 namespace chrome {
30 30
31 namespace { 31 namespace {
32 32
33 const char* kPredefinedAllowedCrxFsOrigins[] = { 33 const char* kPredefinedAllowedCrxFsOrigins[] = {
34 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/234789 34 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/234789
35 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/234789 35 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/234789
36 }; 36 };
37 37
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 if (!extension_service) 108 if (!extension_service)
109 return std::string(); 109 return std::string();
110 110
111 const extensions::Extension* extension = 111 const extensions::Extension* extension =
112 extension_service->GetExtensionById(document_url_.host(), false); 112 extension_service->GetExtensionById(document_url_.host(), false);
113 if (!extension) 113 if (!extension)
114 return std::string(); 114 return std::string();
115 115
116 // First level directory for isolated filesystem to lookup. 116 // First level directory for isolated filesystem to lookup.
117 std::string kFirstLevelDirectory("crxfs"); 117 std::string kFirstLevelDirectory("crxfs");
118 return fileapi::IsolatedContext::GetInstance()->RegisterFileSystemForPath( 118 return storage::IsolatedContext::GetInstance()->RegisterFileSystemForPath(
119 fileapi::kFileSystemTypeNativeLocal, 119 storage::kFileSystemTypeNativeLocal,
120 std::string(), 120 std::string(),
121 extension->path(), 121 extension->path(),
122 &kFirstLevelDirectory); 122 &kFirstLevelDirectory);
123 } 123 }
124 124
125 int32_t PepperIsolatedFileSystemMessageFilter::OnOpenFileSystem( 125 int32_t PepperIsolatedFileSystemMessageFilter::OnOpenFileSystem(
126 ppapi::host::HostMessageContext* context, 126 ppapi::host::HostMessageContext* context,
127 PP_IsolatedFileSystemType_Private type) { 127 PP_IsolatedFileSystemType_Private type) {
128 switch (type) { 128 switch (type) {
129 case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_INVALID: 129 case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_INVALID:
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 int32_t PepperIsolatedFileSystemMessageFilter::OpenPluginPrivateFileSystem( 178 int32_t PepperIsolatedFileSystemMessageFilter::OpenPluginPrivateFileSystem(
179 ppapi::host::HostMessageContext* context) { 179 ppapi::host::HostMessageContext* context) {
180 DCHECK(ppapi_host_); 180 DCHECK(ppapi_host_);
181 // Only plugins with private permission can open the filesystem. 181 // Only plugins with private permission can open the filesystem.
182 if (!ppapi_host_->permissions().HasPermission(ppapi::PERMISSION_PRIVATE)) 182 if (!ppapi_host_->permissions().HasPermission(ppapi::PERMISSION_PRIVATE))
183 return PP_ERROR_NOACCESS; 183 return PP_ERROR_NOACCESS;
184 184
185 const std::string& root_name = ppapi::IsolatedFileSystemTypeToRootName( 185 const std::string& root_name = ppapi::IsolatedFileSystemTypeToRootName(
186 PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE); 186 PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE);
187 const std::string& fsid = 187 const std::string& fsid =
188 fileapi::IsolatedContext::GetInstance()->RegisterFileSystemForVirtualPath( 188 storage::IsolatedContext::GetInstance()->RegisterFileSystemForVirtualPath(
189 fileapi::kFileSystemTypePluginPrivate, root_name, base::FilePath()); 189 storage::kFileSystemTypePluginPrivate, root_name, base::FilePath());
190 190
191 // Grant full access of isolated filesystem to renderer process. 191 // Grant full access of isolated filesystem to renderer process.
192 content::ChildProcessSecurityPolicy* policy = 192 content::ChildProcessSecurityPolicy* policy =
193 content::ChildProcessSecurityPolicy::GetInstance(); 193 content::ChildProcessSecurityPolicy::GetInstance();
194 policy->GrantCreateReadWriteFileSystem(render_process_id_, fsid); 194 policy->GrantCreateReadWriteFileSystem(render_process_id_, fsid);
195 195
196 context->reply_msg = PpapiPluginMsg_IsolatedFileSystem_BrowserOpenReply(fsid); 196 context->reply_msg = PpapiPluginMsg_IsolatedFileSystem_BrowserOpenReply(fsid);
197 return PP_OK; 197 return PP_OK;
198 } 198 }
199 199
200 } // namespace chrome 200 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl_io_data.cc ('k') | chrome/browser/sessions/session_data_deleter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698