OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ppapi/proxy/ppb_file_system_proxy.h" | 5 #include "ppapi/proxy/ppb_file_system_proxy.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/task.h" | 8 #include "base/task.h" |
9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
10 #include "ppapi/c/ppb_file_system.h" | 10 #include "ppapi/c/ppb_file_system.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 137 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
138 if (!dispatcher) | 138 if (!dispatcher) |
139 return PP_ERROR_BADARGUMENT; | 139 return PP_ERROR_BADARGUMENT; |
140 | 140 |
141 HostResource result; | 141 HostResource result; |
142 dispatcher->Send(new PpapiHostMsg_PPBFileSystem_Create( | 142 dispatcher->Send(new PpapiHostMsg_PPBFileSystem_Create( |
143 INTERFACE_ID_PPB_FILE_SYSTEM, instance, type, &result)); | 143 INTERFACE_ID_PPB_FILE_SYSTEM, instance, type, &result)); |
144 if (result.is_null()) | 144 if (result.is_null()) |
145 return 0; | 145 return 0; |
146 | 146 |
147 linked_ptr<FileSystem> object(new FileSystem(result, type)); | 147 return PluginResourceTracker::GetInstance()->AddResource( |
148 return PluginResourceTracker::GetInstance()->AddResource(object); | 148 new FileSystem(result, type)); |
149 } | 149 } |
150 | 150 |
151 bool PPB_FileSystem_Proxy::OnMessageReceived(const IPC::Message& msg) { | 151 bool PPB_FileSystem_Proxy::OnMessageReceived(const IPC::Message& msg) { |
152 bool handled = true; | 152 bool handled = true; |
153 IPC_BEGIN_MESSAGE_MAP(PPB_FileSystem_Proxy, msg) | 153 IPC_BEGIN_MESSAGE_MAP(PPB_FileSystem_Proxy, msg) |
154 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileSystem_Create, OnMsgCreate) | 154 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileSystem_Create, OnMsgCreate) |
155 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileSystem_Open, OnMsgOpen) | 155 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileSystem_Open, OnMsgOpen) |
156 IPC_MESSAGE_HANDLER(PpapiMsg_PPBFileSystem_OpenComplete, OnMsgOpenComplete) | 156 IPC_MESSAGE_HANDLER(PpapiMsg_PPBFileSystem_OpenComplete, OnMsgOpenComplete) |
157 IPC_MESSAGE_UNHANDLED(handled = false) | 157 IPC_MESSAGE_UNHANDLED(handled = false) |
158 IPC_END_MESSAGE_MAP() | 158 IPC_END_MESSAGE_MAP() |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 191 |
192 void PPB_FileSystem_Proxy::OpenCompleteInHost( | 192 void PPB_FileSystem_Proxy::OpenCompleteInHost( |
193 int32_t result, | 193 int32_t result, |
194 const HostResource& host_resource) { | 194 const HostResource& host_resource) { |
195 dispatcher()->Send(new PpapiMsg_PPBFileSystem_OpenComplete( | 195 dispatcher()->Send(new PpapiMsg_PPBFileSystem_OpenComplete( |
196 INTERFACE_ID_PPB_FILE_SYSTEM, host_resource, result)); | 196 INTERFACE_ID_PPB_FILE_SYSTEM, host_resource, result)); |
197 } | 197 } |
198 | 198 |
199 } // namespace proxy | 199 } // namespace proxy |
200 } // namespace pp | 200 } // namespace pp |
OLD | NEW |