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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 const std::string& accept_mime_types, | 187 const std::string& accept_mime_types, |
188 HostResource* result) { | 188 HostResource* result) { |
189 PP_FileChooserOptions_Dev options; | 189 PP_FileChooserOptions_Dev options; |
190 options.mode = static_cast<PP_FileChooserMode_Dev>(mode); | 190 options.mode = static_cast<PP_FileChooserMode_Dev>(mode); |
191 options.accept_mime_types = accept_mime_types.c_str(); | 191 options.accept_mime_types = accept_mime_types.c_str(); |
192 result->SetHostResource( | 192 result->SetHostResource( |
193 instance, ppb_file_chooser_target()->Create(instance, &options)); | 193 instance, ppb_file_chooser_target()->Create(instance, &options)); |
194 } | 194 } |
195 | 195 |
196 void PPB_FileChooser_Proxy::OnMsgShow(const HostResource& chooser) { | 196 void PPB_FileChooser_Proxy::OnMsgShow(const HostResource& chooser) { |
197 CompletionCallback callback = callback_factory_.NewCallback( | 197 CompletionCallback callback = callback_factory_.NewOptionalCallback( |
198 &PPB_FileChooser_Proxy::OnShowCallback, chooser); | 198 &PPB_FileChooser_Proxy::OnShowCallback, chooser); |
199 | 199 |
200 int32_t result = ppb_file_chooser_target()->Show( | 200 int32_t result = ppb_file_chooser_target()->Show( |
201 chooser.host_resource(), callback.pp_completion_callback()); | 201 chooser.host_resource(), callback.pp_completion_callback()); |
202 if (result != PP_OK_COMPLETIONPENDING) | 202 if (result != PP_OK_COMPLETIONPENDING) |
203 callback.Run(result); | 203 callback.Run(result); |
204 } | 204 } |
205 | 205 |
206 void PPB_FileChooser_Proxy::OnMsgChooseComplete( | 206 void PPB_FileChooser_Proxy::OnMsgChooseComplete( |
207 const HostResource& chooser, | 207 const HostResource& chooser, |
(...skipping 26 matching lines...) Expand all Loading... |
234 files.push_back(cur_create_info); | 234 files.push_back(cur_create_info); |
235 } | 235 } |
236 } | 236 } |
237 | 237 |
238 dispatcher()->Send(new PpapiMsg_PPBFileChooser_ChooseComplete( | 238 dispatcher()->Send(new PpapiMsg_PPBFileChooser_ChooseComplete( |
239 INTERFACE_ID_PPB_FILE_CHOOSER, chooser, result, files)); | 239 INTERFACE_ID_PPB_FILE_CHOOSER, chooser, result, files)); |
240 } | 240 } |
241 | 241 |
242 } // namespace proxy | 242 } // namespace proxy |
243 } // namespace pp | 243 } // namespace pp |
OLD | NEW |