OLD | NEW |
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 "content/browser/renderer_host/pepper/pepper_file_system_browser_host.h
" | 5 #include "content/browser/renderer_host/pepper/pepper_file_system_browser_host.h
" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "content/public/browser/browser_ppapi_host.h" | 9 #include "content/public/browser/browser_ppapi_host.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
11 #include "content/public/browser/render_process_host.h" | 11 #include "content/public/browser/render_process_host.h" |
12 #include "content/public/browser/storage_partition.h" | 12 #include "content/public/browser/storage_partition.h" |
13 #include "ppapi/c/pp_errors.h" | 13 #include "ppapi/c/pp_errors.h" |
14 #include "ppapi/host/dispatch_host_message.h" | 14 #include "ppapi/host/dispatch_host_message.h" |
15 #include "ppapi/host/ppapi_host.h" | 15 #include "ppapi/host/ppapi_host.h" |
16 #include "ppapi/proxy/ppapi_messages.h" | 16 #include "ppapi/proxy/ppapi_messages.h" |
17 #include "ppapi/shared_impl/file_system_util.h" | 17 #include "ppapi/shared_impl/file_system_util.h" |
18 #include "ppapi/shared_impl/file_type_conversion.h" | 18 #include "ppapi/shared_impl/file_type_conversion.h" |
19 #include "webkit/browser/fileapi/file_system_context.h" | 19 #include "webkit/browser/fileapi/file_system_context.h" |
20 #include "webkit/browser/fileapi/file_system_operation_runner.h" | 20 #include "webkit/browser/fileapi/file_system_operation_runner.h" |
21 #include "webkit/common/fileapi/file_system_util.h" | 21 #include "webkit/common/fileapi/file_system_util.h" |
22 | 22 |
23 namespace content { | 23 namespace content { |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 scoped_refptr<fileapi::FileSystemContext> | 27 scoped_refptr<fileapi::FileSystemContext> |
28 GetFileSystemContextFromRenderId(int render_process_id) { | 28 GetFileSystemContextFromRenderId(int render_process_id) { |
29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
30 RenderProcessHost* render_process_host = | 30 RenderProcessHost* host = RenderProcessHost::FromID(render_process_id); |
31 RenderProcessHost::FromID(render_process_id); | 31 if (!host) |
32 if (!render_process_host) | |
33 return NULL; | 32 return NULL; |
34 StoragePartition* storage_partition = | 33 StoragePartition* storage_partition = host->GetStoragePartition(); |
35 render_process_host->GetStoragePartition(); | |
36 if (!storage_partition) | 34 if (!storage_partition) |
37 return NULL; | 35 return NULL; |
38 return storage_partition->GetFileSystemContext(); | 36 return storage_partition->GetFileSystemContext(); |
39 } | 37 } |
40 | 38 |
41 // TODO(nhiroki): Move this function somewhere else to be shared. | 39 // TODO(nhiroki): Move this function somewhere else to be shared. |
42 std::string IsolatedFileSystemTypeToRootName( | 40 std::string IsolatedFileSystemTypeToRootName( |
43 PP_IsolatedFileSystemType_Private type) { | 41 PP_IsolatedFileSystemType_Private type) { |
44 switch (type) { | 42 switch (type) { |
45 case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_INVALID: | 43 case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_INVALID: |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 BrowserThread::UI, | 236 BrowserThread::UI, |
239 FROM_HERE, | 237 FROM_HERE, |
240 base::Bind(&GetFileSystemContextFromRenderId, render_process_id), | 238 base::Bind(&GetFileSystemContextFromRenderId, render_process_id), |
241 base::Bind(&PepperFileSystemBrowserHost::GotIsolatedFileSystemContext, | 239 base::Bind(&PepperFileSystemBrowserHost::GotIsolatedFileSystemContext, |
242 weak_factory_.GetWeakPtr(), | 240 weak_factory_.GetWeakPtr(), |
243 context->MakeReplyMessageContext())); | 241 context->MakeReplyMessageContext())); |
244 return PP_OK_COMPLETIONPENDING; | 242 return PP_OK_COMPLETIONPENDING; |
245 } | 243 } |
246 | 244 |
247 } // namespace content | 245 } // namespace content |
OLD | NEW |