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" |
(...skipping 21 matching lines...) Expand all Loading... |
32 if (('A' <= *it && *it <= 'F') || ('0' <= *it && *it <= '9')) | 32 if (('A' <= *it && *it <= 'F') || ('0' <= *it && *it <= '9')) |
33 continue; | 33 continue; |
34 return false; | 34 return false; |
35 } | 35 } |
36 return true; | 36 return true; |
37 } | 37 } |
38 | 38 |
39 scoped_refptr<fileapi::FileSystemContext> | 39 scoped_refptr<fileapi::FileSystemContext> |
40 GetFileSystemContextFromRenderId(int render_process_id) { | 40 GetFileSystemContextFromRenderId(int render_process_id) { |
41 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 41 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
42 RenderProcessHost* render_process_host = | 42 RenderProcessHost* host = RenderProcessHost::FromID(render_process_id); |
43 RenderProcessHost::FromID(render_process_id); | 43 if (!host) |
44 if (!render_process_host) | |
45 return NULL; | 44 return NULL; |
46 StoragePartition* storage_partition = | 45 StoragePartition* storage_partition = host->GetStoragePartition(); |
47 render_process_host->GetStoragePartition(); | |
48 if (!storage_partition) | 46 if (!storage_partition) |
49 return NULL; | 47 return NULL; |
50 return storage_partition->GetFileSystemContext(); | 48 return storage_partition->GetFileSystemContext(); |
51 } | 49 } |
52 | 50 |
53 } // namespace | 51 } // namespace |
54 | 52 |
55 PepperFileSystemBrowserHost::PepperFileSystemBrowserHost(BrowserPpapiHost* host, | 53 PepperFileSystemBrowserHost::PepperFileSystemBrowserHost(BrowserPpapiHost* host, |
56 PP_Instance instance, | 54 PP_Instance instance, |
57 PP_Resource resource, | 55 PP_Resource resource, |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 BrowserThread::UI, | 218 BrowserThread::UI, |
221 FROM_HERE, | 219 FROM_HERE, |
222 base::Bind(&GetFileSystemContextFromRenderId, render_process_id), | 220 base::Bind(&GetFileSystemContextFromRenderId, render_process_id), |
223 base::Bind(&PepperFileSystemBrowserHost::GotIsolatedFileSystemContext, | 221 base::Bind(&PepperFileSystemBrowserHost::GotIsolatedFileSystemContext, |
224 weak_factory_.GetWeakPtr(), | 222 weak_factory_.GetWeakPtr(), |
225 context->MakeReplyMessageContext())); | 223 context->MakeReplyMessageContext())); |
226 return PP_OK_COMPLETIONPENDING; | 224 return PP_OK_COMPLETIONPENDING; |
227 } | 225 } |
228 | 226 |
229 } // namespace content | 227 } // namespace content |
OLD | NEW |