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_chooser_proxy.h" | 5 #include "ppapi/proxy/ppb_file_chooser_proxy.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 | 8 |
9 #include "ppapi/c/dev/ppb_file_chooser_dev.h" | 9 #include "ppapi/c/dev/ppb_file_chooser_dev.h" |
10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 HostResource result; | 157 HostResource result; |
158 dispatcher->Send(new PpapiHostMsg_PPBFileChooser_Create( | 158 dispatcher->Send(new PpapiHostMsg_PPBFileChooser_Create( |
159 INTERFACE_ID_PPB_FILE_CHOOSER, instance, | 159 INTERFACE_ID_PPB_FILE_CHOOSER, instance, |
160 options->mode, | 160 options->mode, |
161 options->accept_mime_types ? options->accept_mime_types : std::string(), | 161 options->accept_mime_types ? options->accept_mime_types : std::string(), |
162 &result)); | 162 &result)); |
163 | 163 |
164 if (result.is_null()) | 164 if (result.is_null()) |
165 return 0; | 165 return 0; |
166 linked_ptr<FileChooser> object(new FileChooser(result)); | 166 return PluginResourceTracker::GetInstance()->AddResource( |
167 return PluginResourceTracker::GetInstance()->AddResource(object); | 167 new FileChooser(result)); |
168 } | 168 } |
169 | 169 |
170 bool PPB_FileChooser_Proxy::OnMessageReceived(const IPC::Message& msg) { | 170 bool PPB_FileChooser_Proxy::OnMessageReceived(const IPC::Message& msg) { |
171 bool handled = true; | 171 bool handled = true; |
172 IPC_BEGIN_MESSAGE_MAP(PPB_FileChooser_Proxy, msg) | 172 IPC_BEGIN_MESSAGE_MAP(PPB_FileChooser_Proxy, msg) |
173 // Plugin -> host messages. | 173 // Plugin -> host messages. |
174 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileChooser_Create, OnMsgCreate) | 174 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileChooser_Create, OnMsgCreate) |
175 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileChooser_Show, OnMsgShow) | 175 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileChooser_Show, OnMsgShow) |
176 | 176 |
177 // Host -> plugin messages. | 177 // Host -> plugin messages. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 files.push_back(cur_create_info); | 232 files.push_back(cur_create_info); |
233 } | 233 } |
234 } | 234 } |
235 | 235 |
236 dispatcher()->Send(new PpapiMsg_PPBFileChooser_ChooseComplete( | 236 dispatcher()->Send(new PpapiMsg_PPBFileChooser_ChooseComplete( |
237 INTERFACE_ID_PPB_FILE_CHOOSER, chooser, result, files)); | 237 INTERFACE_ID_PPB_FILE_CHOOSER, chooser, result, files)); |
238 } | 238 } |
239 | 239 |
240 } // namespace proxy | 240 } // namespace proxy |
241 } // namespace pp | 241 } // namespace pp |
OLD | NEW |