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/browser/renderer_host/pepper/pepper_file_io_host.h" | 9 #include "content/browser/renderer_host/pepper/pepper_file_io_host.h" |
10 #include "content/browser/renderer_host/pepper/quota_reservation.h" | 10 #include "content/browser/renderer_host/pepper/quota_reservation.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 else | 213 else |
214 callback.Run(); | 214 callback.Run(); |
215 } | 215 } |
216 | 216 |
217 void PepperFileSystemBrowserHost::OpenFileSystem( | 217 void PepperFileSystemBrowserHost::OpenFileSystem( |
218 ppapi::host::ReplyMessageContext reply_context, | 218 ppapi::host::ReplyMessageContext reply_context, |
219 fileapi::FileSystemType file_system_type, | 219 fileapi::FileSystemType file_system_type, |
220 scoped_refptr<fileapi::FileSystemContext> file_system_context) { | 220 scoped_refptr<fileapi::FileSystemContext> file_system_context) { |
221 if (!file_system_context.get()) { | 221 if (!file_system_context.get()) { |
222 OpenFileSystemComplete( | 222 OpenFileSystemComplete( |
223 reply_context, GURL(), std::string(), base::PLATFORM_FILE_ERROR_FAILED); | 223 reply_context, GURL(), std::string(), base::File::FILE_ERROR_FAILED); |
224 return; | 224 return; |
225 } | 225 } |
226 | 226 |
227 SetFileSystemContext(file_system_context); | 227 SetFileSystemContext(file_system_context); |
228 | 228 |
229 GURL origin = browser_ppapi_host_->GetDocumentURLForInstance( | 229 GURL origin = browser_ppapi_host_->GetDocumentURLForInstance( |
230 pp_instance()).GetOrigin(); | 230 pp_instance()).GetOrigin(); |
231 file_system_context_->OpenFileSystem(origin, file_system_type, | 231 file_system_context_->OpenFileSystem(origin, file_system_type, |
232 fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, | 232 fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, |
233 base::Bind(&PepperFileSystemBrowserHost::OpenFileSystemComplete, | 233 base::Bind(&PepperFileSystemBrowserHost::OpenFileSystemComplete, |
234 weak_factory_.GetWeakPtr(), | 234 weak_factory_.GetWeakPtr(), |
235 reply_context)); | 235 reply_context)); |
236 } | 236 } |
237 | 237 |
238 void PepperFileSystemBrowserHost::OpenFileSystemComplete( | 238 void PepperFileSystemBrowserHost::OpenFileSystemComplete( |
239 ppapi::host::ReplyMessageContext reply_context, | 239 ppapi::host::ReplyMessageContext reply_context, |
240 const GURL& root, | 240 const GURL& root, |
241 const std::string& /* unused */, | 241 const std::string& /* unused */, |
242 base::PlatformFileError error) { | 242 base::File::Error error) { |
243 int32 pp_error = ppapi::PlatformFileErrorToPepperError(error); | 243 int32 pp_error = ppapi::FileErrorToPepperError(error); |
244 if (pp_error == PP_OK) { | 244 if (pp_error == PP_OK) { |
245 opened_ = true; | 245 opened_ = true; |
246 root_url_ = root; | 246 root_url_ = root; |
247 | 247 |
248 if (ShouldCreateQuotaReservation()) { | 248 if (ShouldCreateQuotaReservation()) { |
249 CreateQuotaReservation( | 249 CreateQuotaReservation( |
250 base::Bind(&PepperFileSystemBrowserHost::SendReplyForFileSystem, | 250 base::Bind(&PepperFileSystemBrowserHost::SendReplyForFileSystem, |
251 weak_factory_.GetWeakPtr(), | 251 weak_factory_.GetWeakPtr(), |
252 reply_context, | 252 reply_context, |
253 static_cast<int32_t>(PP_OK))); | 253 static_cast<int32_t>(PP_OK))); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 origin, fileapi::kFileSystemTypePluginPrivate, fsid, plugin_id, | 312 origin, fileapi::kFileSystemTypePluginPrivate, fsid, plugin_id, |
313 fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, | 313 fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, |
314 base::Bind( | 314 base::Bind( |
315 &PepperFileSystemBrowserHost::OpenPluginPrivateFileSystemComplete, | 315 &PepperFileSystemBrowserHost::OpenPluginPrivateFileSystemComplete, |
316 weak_factory_.GetWeakPtr(), reply_context, fsid)); | 316 weak_factory_.GetWeakPtr(), reply_context, fsid)); |
317 } | 317 } |
318 | 318 |
319 void PepperFileSystemBrowserHost::OpenPluginPrivateFileSystemComplete( | 319 void PepperFileSystemBrowserHost::OpenPluginPrivateFileSystemComplete( |
320 ppapi::host::ReplyMessageContext reply_context, | 320 ppapi::host::ReplyMessageContext reply_context, |
321 const std::string& fsid, | 321 const std::string& fsid, |
322 base::PlatformFileError error) { | 322 base::File::Error error) { |
323 int32 pp_error = ppapi::PlatformFileErrorToPepperError(error); | 323 int32 pp_error = ppapi::FileErrorToPepperError(error); |
324 if (pp_error == PP_OK) | 324 if (pp_error == PP_OK) |
325 opened_ = true; | 325 opened_ = true; |
326 SendReplyForIsolatedFileSystem(reply_context, fsid, pp_error); | 326 SendReplyForIsolatedFileSystem(reply_context, fsid, pp_error); |
327 } | 327 } |
328 | 328 |
329 int32_t PepperFileSystemBrowserHost::OnHostMsgInitIsolatedFileSystem( | 329 int32_t PepperFileSystemBrowserHost::OnHostMsgInitIsolatedFileSystem( |
330 ppapi::host::HostMessageContext* context, | 330 ppapi::host::HostMessageContext* context, |
331 const std::string& fsid, | 331 const std::string& fsid, |
332 PP_IsolatedFileSystemType_Private type) { | 332 PP_IsolatedFileSystemType_Private type) { |
333 // Do not allow multiple opens. | 333 // Do not allow multiple opens. |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 if (!IsAsciiAlpha(*it) && !IsAsciiDigit(*it) && | 504 if (!IsAsciiAlpha(*it) && !IsAsciiDigit(*it) && |
505 *it != '.' && *it != '_' && *it != '-') { | 505 *it != '.' && *it != '_' && *it != '-') { |
506 LOG(WARNING) << "Failed to generate a plugin id."; | 506 LOG(WARNING) << "Failed to generate a plugin id."; |
507 return std::string(); | 507 return std::string(); |
508 } | 508 } |
509 } | 509 } |
510 return output; | 510 return output; |
511 } | 511 } |
512 | 512 |
513 } // namespace content | 513 } // namespace content |
OLD | NEW |