| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/renderer/pepper/pepper_file_system_host.h" | 5 #include "content/renderer/pepper/pepper_file_system_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/child/child_thread.h" | 9 #include "content/child/child_thread.h" |
| 10 #include "content/child/fileapi/file_system_dispatcher.h" | 10 #include "content/child/fileapi/file_system_dispatcher.h" |
| 11 #include "content/common/pepper_file_util.h" |
| 11 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 12 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| 12 #include "content/public/renderer/render_view.h" | 13 #include "content/public/renderer/render_view.h" |
| 13 #include "content/public/renderer/renderer_ppapi_host.h" | 14 #include "content/public/renderer/renderer_ppapi_host.h" |
| 14 #include "ppapi/c/pp_errors.h" | 15 #include "ppapi/c/pp_errors.h" |
| 15 #include "ppapi/host/dispatch_host_message.h" | 16 #include "ppapi/host/dispatch_host_message.h" |
| 16 #include "ppapi/host/ppapi_host.h" | 17 #include "ppapi/host/ppapi_host.h" |
| 17 #include "ppapi/proxy/ppapi_messages.h" | 18 #include "ppapi/proxy/ppapi_messages.h" |
| 18 #include "ppapi/shared_impl/file_system_util.h" | 19 #include "ppapi/shared_impl/file_system_util.h" |
| 19 #include "ppapi/shared_impl/file_type_conversion.h" | 20 #include "ppapi/shared_impl/file_type_conversion.h" |
| 20 #include "third_party/WebKit/public/web/WebDocument.h" | 21 #include "third_party/WebKit/public/web/WebDocument.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 86 |
| 86 int32_t PepperFileSystemHost::OnHostMsgOpen( | 87 int32_t PepperFileSystemHost::OnHostMsgOpen( |
| 87 ppapi::host::HostMessageContext* context, | 88 ppapi::host::HostMessageContext* context, |
| 88 int64_t expected_size) { | 89 int64_t expected_size) { |
| 89 // Not allow multiple opens. | 90 // Not allow multiple opens. |
| 90 if (called_open_) | 91 if (called_open_) |
| 91 return PP_ERROR_INPROGRESS; | 92 return PP_ERROR_INPROGRESS; |
| 92 called_open_ = true; | 93 called_open_ = true; |
| 93 | 94 |
| 94 fileapi::FileSystemType file_system_type = | 95 fileapi::FileSystemType file_system_type = |
| 95 ppapi::PepperFileSystemTypeToFileSystemType(type_); | 96 PepperFileSystemTypeToFileSystemType(type_); |
| 96 if (file_system_type == fileapi::kFileSystemTypeUnknown) | 97 if (file_system_type == fileapi::kFileSystemTypeUnknown) |
| 97 return PP_ERROR_FAILED; | 98 return PP_ERROR_FAILED; |
| 98 | 99 |
| 99 GURL document_url = renderer_ppapi_host_->GetDocumentURL(pp_instance()); | 100 GURL document_url = renderer_ppapi_host_->GetDocumentURL(pp_instance()); |
| 100 if (!document_url.is_valid()) | 101 if (!document_url.is_valid()) |
| 101 return PP_ERROR_FAILED; | 102 return PP_ERROR_FAILED; |
| 102 | 103 |
| 103 FileSystemDispatcher* file_system_dispatcher = | 104 FileSystemDispatcher* file_system_dispatcher = |
| 104 ChildThread::current()->file_system_dispatcher(); | 105 ChildThread::current()->file_system_dispatcher(); |
| 105 reply_context_ = context->MakeReplyMessageContext(); | 106 reply_context_ = context->MakeReplyMessageContext(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 135 const std::string root_name = ppapi::IsolatedFileSystemTypeToRootName(type); | 136 const std::string root_name = ppapi::IsolatedFileSystemTypeToRootName(type); |
| 136 if (root_name.empty()) | 137 if (root_name.empty()) |
| 137 return PP_ERROR_BADARGUMENT; | 138 return PP_ERROR_BADARGUMENT; |
| 138 root_url_ = GURL(fileapi::GetIsolatedFileSystemRootURIString( | 139 root_url_ = GURL(fileapi::GetIsolatedFileSystemRootURIString( |
| 139 url.GetOrigin(), fsid, root_name)); | 140 url.GetOrigin(), fsid, root_name)); |
| 140 opened_ = true; | 141 opened_ = true; |
| 141 return PP_OK; | 142 return PP_OK; |
| 142 } | 143 } |
| 143 | 144 |
| 144 } // namespace content | 145 } // namespace content |
| OLD | NEW |