OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef PPAPI_PROXY_PPB_FILE_CHOOSER_PROXY_H_ |
| 6 #define PPAPI_PROXY_PPB_FILE_CHOOSER_PROXY_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "ppapi/c/pp_instance.h" |
| 13 #include "ppapi/cpp/completion_callback.h" |
| 14 #include "ppapi/proxy/interface_proxy.h" |
| 15 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" |
| 16 |
| 17 struct PPB_FileChooser_Dev; |
| 18 |
| 19 namespace pp { |
| 20 namespace proxy { |
| 21 |
| 22 class HostResource; |
| 23 struct PPBFileRef_CreateInfo; |
| 24 |
| 25 class PPB_FileChooser_Proxy : public InterfaceProxy { |
| 26 public: |
| 27 PPB_FileChooser_Proxy(Dispatcher* dispatcher, const void* target_interface); |
| 28 virtual ~PPB_FileChooser_Proxy(); |
| 29 |
| 30 static const Info* GetInfo(); |
| 31 |
| 32 const PPB_FileChooser_Dev* ppb_file_chooser_target() const { |
| 33 return static_cast<const PPB_FileChooser_Dev*>(target_interface()); |
| 34 } |
| 35 |
| 36 // InterfaceProxy implementation. |
| 37 virtual bool OnMessageReceived(const IPC::Message& msg); |
| 38 |
| 39 private: |
| 40 // Plugin -> host message handlers. |
| 41 void OnMsgCreate(PP_Instance instance, |
| 42 int mode, |
| 43 const std::string& accept_mime_types, |
| 44 pp::proxy::HostResource* result); |
| 45 void OnMsgShow(const pp::proxy::HostResource& chooser); |
| 46 |
| 47 // Host -> plugin message handlers. |
| 48 void OnMsgChooseComplete( |
| 49 const pp::proxy::HostResource& chooser, |
| 50 int32_t result_code, |
| 51 const std::vector<PPBFileRef_CreateInfo>& chosen_files); |
| 52 |
| 53 // Called when the show is complete in the host. This will notify the plugin |
| 54 // via IPC and OnMsgChooseComplete will be called there. |
| 55 void OnShowCallback(int32_t result, const HostResource& chooser); |
| 56 |
| 57 CompletionCallbackFactory<PPB_FileChooser_Proxy, |
| 58 ProxyNonThreadSafeRefCount> callback_factory_; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(PPB_FileChooser_Proxy); |
| 61 }; |
| 62 |
| 63 } // namespace proxy |
| 64 } // namespace pp |
| 65 |
| 66 #endif // PPAPI_PROXY_PPB_FILE_CHOOSER_PROXY_H_ |
OLD | NEW |