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_type_conversion.h" | 18 #include "ppapi/shared_impl/file_type_conversion.h" |
18 #include "webkit/browser/fileapi/file_system_context.h" | 19 #include "webkit/browser/fileapi/file_system_context.h" |
19 #include "webkit/browser/fileapi/file_system_operation_runner.h" | 20 #include "webkit/browser/fileapi/file_system_operation_runner.h" |
20 #include "webkit/common/fileapi/file_system_util.h" | 21 #include "webkit/common/fileapi/file_system_util.h" |
21 | 22 |
22 namespace content { | 23 namespace content { |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
26 scoped_refptr<fileapi::FileSystemContext> | 27 scoped_refptr<fileapi::FileSystemContext> |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 ppapi::host::HostMessageContext* context, | 101 ppapi::host::HostMessageContext* context, |
101 int64_t /* unused */) { | 102 int64_t /* unused */) { |
102 // TODO(raymes): The file system size is now unused by FileSystemDispatcher. | 103 // TODO(raymes): The file system size is now unused by FileSystemDispatcher. |
103 // Figure out why. Why is the file system size signed? | 104 // Figure out why. Why is the file system size signed? |
104 | 105 |
105 // Not allow multiple opens. | 106 // Not allow multiple opens. |
106 if (called_open_) | 107 if (called_open_) |
107 return PP_ERROR_INPROGRESS; | 108 return PP_ERROR_INPROGRESS; |
108 called_open_ = true; | 109 called_open_ = true; |
109 | 110 |
110 fileapi::FileSystemType file_system_type; | 111 fileapi::FileSystemType file_system_type = |
111 switch (type_) { | 112 ppapi::PepperFileSystemTypeToFileSystemType(type_); |
112 case PP_FILESYSTEMTYPE_LOCALTEMPORARY: | 113 if (file_system_type == fileapi::kFileSystemTypeUnknown) |
113 file_system_type = fileapi::kFileSystemTypeTemporary; | 114 return PP_ERROR_FAILED; |
114 break; | |
115 case PP_FILESYSTEMTYPE_LOCALPERSISTENT: | |
116 file_system_type = fileapi::kFileSystemTypePersistent; | |
117 break; | |
118 case PP_FILESYSTEMTYPE_EXTERNAL: | |
119 file_system_type = fileapi::kFileSystemTypeExternal; | |
120 break; | |
121 default: | |
122 return PP_ERROR_FAILED; | |
123 } | |
124 | 115 |
125 int render_process_id = 0; | 116 int render_process_id = 0; |
126 int unused; | 117 int unused; |
127 if (!browser_ppapi_host_->GetRenderViewIDsForInstance(pp_instance(), | 118 if (!browser_ppapi_host_->GetRenderViewIDsForInstance(pp_instance(), |
128 &render_process_id, | 119 &render_process_id, |
129 &unused)) { | 120 &unused)) { |
130 return PP_ERROR_FAILED; | 121 return PP_ERROR_FAILED; |
131 } | 122 } |
132 BrowserThread::PostTaskAndReplyWithResult( | 123 BrowserThread::PostTaskAndReplyWithResult( |
133 BrowserThread::UI, | 124 BrowserThread::UI, |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 BrowserThread::UI, | 218 BrowserThread::UI, |
228 FROM_HERE, | 219 FROM_HERE, |
229 base::Bind(&GetFileSystemContextFromRenderId, render_process_id), | 220 base::Bind(&GetFileSystemContextFromRenderId, render_process_id), |
230 base::Bind(&PepperFileSystemBrowserHost::GotIsolatedFileSystemContext, | 221 base::Bind(&PepperFileSystemBrowserHost::GotIsolatedFileSystemContext, |
231 weak_factory_.GetWeakPtr(), | 222 weak_factory_.GetWeakPtr(), |
232 context->MakeReplyMessageContext())); | 223 context->MakeReplyMessageContext())); |
233 return PP_OK_COMPLETIONPENDING; | 224 return PP_OK_COMPLETIONPENDING; |
234 } | 225 } |
235 | 226 |
236 } // namespace content | 227 } // namespace content |
OLD | NEW |