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_external_file_ref_backend.
h" | 5 #include "content/browser/renderer_host/pepper/pepper_external_file_ref_backend.
h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util_proxy.h" | 8 #include "base/files/file_util_proxy.h" |
9 #include "content/browser/child_process_security_policy_impl.h" | 9 #include "content/browser/child_process_security_policy_impl.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 int32_t PepperExternalFileRefBackend::ReadDirectoryEntries( | 83 int32_t PepperExternalFileRefBackend::ReadDirectoryEntries( |
84 ppapi::host::ReplyMessageContext context) { | 84 ppapi::host::ReplyMessageContext context) { |
85 // This operation isn't supported for external filesystems. | 85 // This operation isn't supported for external filesystems. |
86 return PP_ERROR_NOACCESS; | 86 return PP_ERROR_NOACCESS; |
87 } | 87 } |
88 | 88 |
89 int32_t PepperExternalFileRefBackend::GetAbsolutePath( | 89 int32_t PepperExternalFileRefBackend::GetAbsolutePath( |
90 ppapi::host::ReplyMessageContext reply_context) { | 90 ppapi::host::ReplyMessageContext reply_context) { |
91 host_->SendReply(reply_context, | 91 host_->SendReply(reply_context, |
92 PpapiPluginMsg_FileRef_GetAbsolutePathReply(path_.AsUTF8Unsafe())); | 92 PpapiPluginMsg_FileRef_GetAbsolutePathReply(path_.AsUTF8Unsafe())); |
93 return PP_OK; | 93 |
| 94 // Use PP_OK_COMPLETIONPENDING instead of PP_OK since we've already sent our |
| 95 // reply above. |
| 96 return PP_OK_COMPLETIONPENDING; |
94 } | 97 } |
95 | 98 |
96 fileapi::FileSystemURL PepperExternalFileRefBackend::GetFileSystemURL() const { | 99 fileapi::FileSystemURL PepperExternalFileRefBackend::GetFileSystemURL() const { |
97 return fileapi::FileSystemURL(); | 100 return fileapi::FileSystemURL(); |
98 } | 101 } |
99 | 102 |
100 std::string PepperExternalFileRefBackend::GetFileSystemURLSpec() const { | |
101 return std::string(); | |
102 } | |
103 | |
104 base::FilePath PepperExternalFileRefBackend::GetExternalPath() const { | |
105 return path_; | |
106 } | |
107 | |
108 int32_t PepperExternalFileRefBackend::CanRead() const { | 103 int32_t PepperExternalFileRefBackend::CanRead() const { |
109 if (!ChildProcessSecurityPolicyImpl::GetInstance()-> | 104 if (!ChildProcessSecurityPolicyImpl::GetInstance()-> |
110 CanReadFile(render_process_id_, path_)) { | 105 CanReadFile(render_process_id_, path_)) { |
111 return PP_ERROR_NOACCESS; | 106 return PP_ERROR_NOACCESS; |
112 } | 107 } |
113 return PP_OK; | 108 return PP_OK; |
114 } | 109 } |
115 | 110 |
116 int32_t PepperExternalFileRefBackend::CanWrite() const { | 111 int32_t PepperExternalFileRefBackend::CanWrite() const { |
117 if (!ChildProcessSecurityPolicyImpl::GetInstance()-> | 112 if (!ChildProcessSecurityPolicyImpl::GetInstance()-> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 file_info, PP_FILESYSTEMTYPE_EXTERNAL, &pp_file_info); | 154 file_info, PP_FILESYSTEMTYPE_EXTERNAL, &pp_file_info); |
160 } else { | 155 } else { |
161 memset(&pp_file_info, 0, sizeof(pp_file_info)); | 156 memset(&pp_file_info, 0, sizeof(pp_file_info)); |
162 } | 157 } |
163 | 158 |
164 host_->SendReply(reply_context, | 159 host_->SendReply(reply_context, |
165 PpapiPluginMsg_FileRef_QueryReply(pp_file_info)); | 160 PpapiPluginMsg_FileRef_QueryReply(pp_file_info)); |
166 } | 161 } |
167 | 162 |
168 } // namespace content | 163 } // namespace content |
OLD | NEW |