| 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 #ifndef PPAPI_PROXY_PPB_FILE_CHOOSER_PROXY_H_ | 5 #ifndef PPAPI_PROXY_PPB_FILE_CHOOSER_PROXY_H_ |
| 6 #define PPAPI_PROXY_PPB_FILE_CHOOSER_PROXY_H_ | 6 #define PPAPI_PROXY_PPB_FILE_CHOOSER_PROXY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "ppapi/c/pp_instance.h" | 12 #include "ppapi/c/pp_instance.h" |
| 13 #include "ppapi/proxy/interface_proxy.h" | 13 #include "ppapi/proxy/interface_proxy.h" |
| 14 #include "ppapi/proxy/proxy_array_output.h" |
| 14 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" | 15 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" |
| 16 #include "ppapi/proxy/serialized_var.h" |
| 15 #include "ppapi/thunk/ppb_file_chooser_api.h" | 17 #include "ppapi/thunk/ppb_file_chooser_api.h" |
| 18 #include "ppapi/cpp/output_traits.h" |
| 16 #include "ppapi/utility/completion_callback_factory.h" | 19 #include "ppapi/utility/completion_callback_factory.h" |
| 17 | 20 |
| 18 namespace ppapi { | 21 namespace ppapi { |
| 19 | 22 |
| 20 class HostResource; | 23 class HostResource; |
| 21 struct PPB_FileRef_CreateInfo; | 24 struct PPB_FileRef_CreateInfo; |
| 22 | 25 |
| 23 namespace proxy { | 26 namespace proxy { |
| 24 | 27 |
| 25 class PPB_FileChooser_Proxy : public InterfaceProxy { | 28 class PPB_FileChooser_Proxy : public InterfaceProxy { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 39 | 42 |
| 40 static const ApiID kApiID = API_ID_PPB_FILE_CHOOSER; | 43 static const ApiID kApiID = API_ID_PPB_FILE_CHOOSER; |
| 41 | 44 |
| 42 private: | 45 private: |
| 43 // Plugin -> host message handlers. | 46 // Plugin -> host message handlers. |
| 44 void OnMsgCreate(PP_Instance instance, | 47 void OnMsgCreate(PP_Instance instance, |
| 45 int mode, | 48 int mode, |
| 46 std::string accept_mime_types, | 49 std::string accept_mime_types, |
| 47 ppapi::HostResource* result); | 50 ppapi::HostResource* result); |
| 48 void OnMsgShow(const ppapi::HostResource& chooser, | 51 void OnMsgShow(const ppapi::HostResource& chooser, |
| 49 bool save_as, | 52 PP_Bool save_as, |
| 50 std::string suggested_file_name, | 53 SerializedVarReceiveInput suggested_file_name, |
| 51 bool require_user_gesture); | 54 bool require_user_gesture); |
| 52 | 55 |
| 53 // Host -> plugin message handlers. | 56 // Host -> plugin message handlers. |
| 54 void OnMsgChooseComplete( | 57 void OnMsgChooseComplete( |
| 55 const ppapi::HostResource& chooser, | 58 const ppapi::HostResource& chooser, |
| 56 int32_t result_code, | 59 int32_t result_code, |
| 57 const std::vector<PPB_FileRef_CreateInfo>& chosen_files); | 60 const std::vector<PPB_FileRef_CreateInfo>& chosen_files); |
| 58 | 61 |
| 59 // Called when the show is complete in the host. This will notify the plugin | 62 // Called when the show is complete in the host. This will notify the plugin |
| 60 // via IPC and OnMsgChooseComplete will be called there. | 63 // via IPC and OnMsgChooseComplete will be called there. |
| 61 void OnShowCallback(int32_t result, const ppapi::HostResource& chooser); | 64 void OnShowCallback( |
| 65 int32_t result, |
| 66 scoped_refptr<RefCountedArrayOutputAdapter<PP_Resource> > output, |
| 67 HostResource chooser); |
| 62 | 68 |
| 63 pp::CompletionCallbackFactory<PPB_FileChooser_Proxy, | 69 pp::CompletionCallbackFactory<PPB_FileChooser_Proxy, |
| 64 ProxyNonThreadSafeRefCount> callback_factory_; | 70 ProxyNonThreadSafeRefCount> callback_factory_; |
| 65 | 71 |
| 66 DISALLOW_COPY_AND_ASSIGN(PPB_FileChooser_Proxy); | 72 DISALLOW_COPY_AND_ASSIGN(PPB_FileChooser_Proxy); |
| 67 }; | 73 }; |
| 68 | 74 |
| 69 } // namespace proxy | 75 } // namespace proxy |
| 70 } // namespace ppapi | 76 } // namespace ppapi |
| 71 | 77 |
| 72 #endif // PPAPI_PROXY_PPB_FILE_CHOOSER_PROXY_H_ | 78 #endif // PPAPI_PROXY_PPB_FILE_CHOOSER_PROXY_H_ |
| OLD | NEW |