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_io_host.h" | 5 #include "content/browser/renderer_host/pepper/pepper_file_io_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 "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/files/file_util_proxy.h" | 10 #include "base/files/file_util_proxy.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 99 } |
100 file_message_loop_ = | 100 file_message_loop_ = |
101 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE); | 101 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE); |
102 } | 102 } |
103 | 103 |
104 PepperFileIOHost::~PepperFileIOHost() {} | 104 PepperFileIOHost::~PepperFileIOHost() {} |
105 | 105 |
106 int32_t PepperFileIOHost::OnResourceMessageReceived( | 106 int32_t PepperFileIOHost::OnResourceMessageReceived( |
107 const IPC::Message& msg, | 107 const IPC::Message& msg, |
108 ppapi::host::HostMessageContext* context) { | 108 ppapi::host::HostMessageContext* context) { |
109 IPC_BEGIN_MESSAGE_MAP(PepperFileIOHost, msg) | 109 PPAPI_BEGIN_MESSAGE_MAP(PepperFileIOHost, msg) |
110 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_Open, OnHostMsgOpen) | 110 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_Open, OnHostMsgOpen) |
111 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_Touch, OnHostMsgTouch) | 111 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_Touch, OnHostMsgTouch) |
112 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_SetLength, | 112 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_SetLength, |
113 OnHostMsgSetLength) | 113 OnHostMsgSetLength) |
114 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FileIO_Flush, OnHostMsgFlush) | 114 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FileIO_Flush, |
115 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_Close, OnHostMsgClose) | 115 OnHostMsgFlush) |
116 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FileIO_RequestOSFileHandle, | 116 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_Close, OnHostMsgClose) |
117 OnHostMsgRequestOSFileHandle) | 117 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FileIO_RequestOSFileHandle, |
118 IPC_END_MESSAGE_MAP() | 118 OnHostMsgRequestOSFileHandle) |
| 119 PPAPI_END_MESSAGE_MAP() |
119 return PP_ERROR_FAILED; | 120 return PP_ERROR_FAILED; |
120 } | 121 } |
121 | 122 |
122 PepperFileIOHost::UIThreadStuff::UIThreadStuff() { | 123 PepperFileIOHost::UIThreadStuff::UIThreadStuff() { |
123 resolved_render_process_id = base::kNullProcessId; | 124 resolved_render_process_id = base::kNullProcessId; |
124 } | 125 } |
125 | 126 |
126 PepperFileIOHost::UIThreadStuff::~UIThreadStuff() {} | 127 PepperFileIOHost::UIThreadStuff::~UIThreadStuff() {} |
127 | 128 |
128 int32_t PepperFileIOHost::OnHostMsgOpen( | 129 int32_t PepperFileIOHost::OnHostMsgOpen( |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 | 473 |
473 ppapi::proxy::SerializedHandle file_handle; | 474 ppapi::proxy::SerializedHandle file_handle; |
474 // A non-zero resource id signals NaClIPCAdapter to create a NaClQuotaDesc. | 475 // A non-zero resource id signals NaClIPCAdapter to create a NaClQuotaDesc. |
475 PP_Resource quota_file_io = check_quota_ ? pp_resource() : 0; | 476 PP_Resource quota_file_io = check_quota_ ? pp_resource() : 0; |
476 file_handle.set_file_handle(transit_file, open_flags, quota_file_io); | 477 file_handle.set_file_handle(transit_file, open_flags, quota_file_io); |
477 reply_context->params.AppendHandle(file_handle); | 478 reply_context->params.AppendHandle(file_handle); |
478 return true; | 479 return true; |
479 } | 480 } |
480 | 481 |
481 } // namespace content | 482 } // namespace content |
OLD | NEW |