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 25 matching lines...) Expand all Loading... |
36 bool make_ancestors) { | 36 bool make_ancestors) { |
37 // This operation isn't supported for external filesystems. | 37 // This operation isn't supported for external filesystems. |
38 return PP_ERROR_NOACCESS; | 38 return PP_ERROR_NOACCESS; |
39 } | 39 } |
40 | 40 |
41 int32_t PepperExternalFileRefBackend::Touch( | 41 int32_t PepperExternalFileRefBackend::Touch( |
42 ppapi::host::ReplyMessageContext reply_context, | 42 ppapi::host::ReplyMessageContext reply_context, |
43 PP_Time last_access_time, | 43 PP_Time last_access_time, |
44 PP_Time last_modified_time) { | 44 PP_Time last_modified_time) { |
45 IPC::Message reply_msg = PpapiPluginMsg_FileRef_TouchReply(); | 45 IPC::Message reply_msg = PpapiPluginMsg_FileRef_TouchReply(); |
46 base::FileUtilProxy::Touch(task_runner_, path_, | 46 base::FileUtilProxy::Touch( |
| 47 task_runner_.get(), |
| 48 path_, |
47 ppapi::PPTimeToTime(last_access_time), | 49 ppapi::PPTimeToTime(last_access_time), |
48 ppapi::PPTimeToTime(last_modified_time), | 50 ppapi::PPTimeToTime(last_modified_time), |
49 base::Bind(&PepperExternalFileRefBackend::DidFinish, | 51 base::Bind(&PepperExternalFileRefBackend::DidFinish, |
50 weak_factory_.GetWeakPtr(), reply_context, reply_msg)); | 52 weak_factory_.GetWeakPtr(), |
| 53 reply_context, |
| 54 reply_msg)); |
51 return PP_OK_COMPLETIONPENDING; | 55 return PP_OK_COMPLETIONPENDING; |
52 } | 56 } |
53 | 57 |
54 int32_t PepperExternalFileRefBackend::Delete( | 58 int32_t PepperExternalFileRefBackend::Delete( |
55 ppapi::host::ReplyMessageContext reply_context) { | 59 ppapi::host::ReplyMessageContext reply_context) { |
56 // This operation isn't supported for external filesystems. | 60 // This operation isn't supported for external filesystems. |
57 return PP_ERROR_NOACCESS; | 61 return PP_ERROR_NOACCESS; |
58 } | 62 } |
59 | 63 |
60 int32_t PepperExternalFileRefBackend::Rename( | 64 int32_t PepperExternalFileRefBackend::Rename( |
61 ppapi::host::ReplyMessageContext reply_context, | 65 ppapi::host::ReplyMessageContext reply_context, |
62 PepperFileRefHost* new_file_ref) { | 66 PepperFileRefHost* new_file_ref) { |
63 // This operation isn't supported for external filesystems. | 67 // This operation isn't supported for external filesystems. |
64 return PP_ERROR_NOACCESS; | 68 return PP_ERROR_NOACCESS; |
65 } | 69 } |
66 | 70 |
67 int32_t PepperExternalFileRefBackend::Query( | 71 int32_t PepperExternalFileRefBackend::Query( |
68 ppapi::host::ReplyMessageContext reply_context) { | 72 ppapi::host::ReplyMessageContext reply_context) { |
69 bool ok = base::FileUtilProxy::GetFileInfo(task_runner_, path_, | 73 bool ok = base::FileUtilProxy::GetFileInfo( |
| 74 task_runner_.get(), |
| 75 path_, |
70 base::Bind(&PepperExternalFileRefBackend::GetMetadataComplete, | 76 base::Bind(&PepperExternalFileRefBackend::GetMetadataComplete, |
71 weak_factory_.GetWeakPtr(), reply_context)); | 77 weak_factory_.GetWeakPtr(), |
| 78 reply_context)); |
72 DCHECK(ok); | 79 DCHECK(ok); |
73 return PP_OK_COMPLETIONPENDING; | 80 return PP_OK_COMPLETIONPENDING; |
74 } | 81 } |
75 | 82 |
76 int32_t PepperExternalFileRefBackend::ReadDirectoryEntries( | 83 int32_t PepperExternalFileRefBackend::ReadDirectoryEntries( |
77 ppapi::host::ReplyMessageContext context) { | 84 ppapi::host::ReplyMessageContext context) { |
78 // This operation isn't supported for external filesystems. | 85 // This operation isn't supported for external filesystems. |
79 return PP_ERROR_NOACCESS; | 86 return PP_ERROR_NOACCESS; |
80 } | 87 } |
81 | 88 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 file_info, PP_FILESYSTEMTYPE_EXTERNAL, &pp_file_info); | 126 file_info, PP_FILESYSTEMTYPE_EXTERNAL, &pp_file_info); |
120 } else { | 127 } else { |
121 memset(&pp_file_info, 0, sizeof(pp_file_info)); | 128 memset(&pp_file_info, 0, sizeof(pp_file_info)); |
122 } | 129 } |
123 | 130 |
124 host_->SendReply(reply_context, | 131 host_->SendReply(reply_context, |
125 PpapiPluginMsg_FileRef_QueryReply(pp_file_info)); | 132 PpapiPluginMsg_FileRef_QueryReply(pp_file_info)); |
126 } | 133 } |
127 | 134 |
128 } // namespace content | 135 } // namespace content |
OLD | NEW |