| 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 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 class HostResource; | 22 class HostResource; |
| 23 struct PPB_FileRef_CreateInfo; | 23 struct PPB_FileRef_CreateInfo; |
| 24 | 24 |
| 25 namespace proxy { | 25 namespace proxy { |
| 26 | 26 |
| 27 class SerializedVarReceiveInput; | 27 class SerializedVarReceiveInput; |
| 28 | 28 |
| 29 class PPB_FileChooser_Proxy : public InterfaceProxy { | 29 class PPB_FileChooser_Proxy : public InterfaceProxy { |
| 30 public: | 30 public: |
| 31 PPB_FileChooser_Proxy(Dispatcher* dispatcher); | 31 PPB_FileChooser_Proxy(Dispatcher* dispatcher, const void* target_interface); |
| 32 virtual ~PPB_FileChooser_Proxy(); | 32 virtual ~PPB_FileChooser_Proxy(); |
| 33 | 33 |
| 34 static const Info* GetInfo(); |
| 35 static const Info* GetInfo0_4(); |
| 36 |
| 34 static PP_Resource CreateProxyResource( | 37 static PP_Resource CreateProxyResource( |
| 35 PP_Instance instance, | 38 PP_Instance instance, |
| 36 PP_FileChooserMode_Dev mode, | 39 PP_FileChooserMode_Dev mode, |
| 37 const PP_Var& accept_mime_types); | 40 const PP_Var& accept_mime_types); |
| 38 | 41 |
| 42 const PPB_FileChooser_Dev* ppb_file_chooser_target() const { |
| 43 return static_cast<const PPB_FileChooser_Dev*>(target_interface()); |
| 44 } |
| 45 |
| 39 // InterfaceProxy implementation. | 46 // InterfaceProxy implementation. |
| 40 virtual bool OnMessageReceived(const IPC::Message& msg); | 47 virtual bool OnMessageReceived(const IPC::Message& msg); |
| 41 | 48 |
| 42 static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_FILE_CHOOSER; | |
| 43 | |
| 44 private: | 49 private: |
| 45 // Plugin -> host message handlers. | 50 // Plugin -> host message handlers. |
| 46 void OnMsgCreate(PP_Instance instance, | 51 void OnMsgCreate(PP_Instance instance, |
| 47 int mode, | 52 int mode, |
| 48 SerializedVarReceiveInput accept_mime_types, | 53 SerializedVarReceiveInput accept_mime_types, |
| 49 ppapi::HostResource* result); | 54 ppapi::HostResource* result); |
| 50 void OnMsgShow(const ppapi::HostResource& chooser); | 55 void OnMsgShow(const ppapi::HostResource& chooser); |
| 51 | 56 |
| 52 // Host -> plugin message handlers. | 57 // Host -> plugin message handlers. |
| 53 void OnMsgChooseComplete( | 58 void OnMsgChooseComplete( |
| 54 const ppapi::HostResource& chooser, | 59 const ppapi::HostResource& chooser, |
| 55 int32_t result_code, | 60 int32_t result_code, |
| 56 const std::vector<PPB_FileRef_CreateInfo>& chosen_files); | 61 const std::vector<PPB_FileRef_CreateInfo>& chosen_files); |
| 57 | 62 |
| 58 // Called when the show is complete in the host. This will notify the plugin | 63 // Called when the show is complete in the host. This will notify the plugin |
| 59 // via IPC and OnMsgChooseComplete will be called there. | 64 // via IPC and OnMsgChooseComplete will be called there. |
| 60 void OnShowCallback(int32_t result, const ppapi::HostResource& chooser); | 65 void OnShowCallback(int32_t result, const ppapi::HostResource& chooser); |
| 61 | 66 |
| 62 pp::CompletionCallbackFactory<PPB_FileChooser_Proxy, | 67 pp::CompletionCallbackFactory<PPB_FileChooser_Proxy, |
| 63 ProxyNonThreadSafeRefCount> callback_factory_; | 68 ProxyNonThreadSafeRefCount> callback_factory_; |
| 64 | 69 |
| 65 DISALLOW_COPY_AND_ASSIGN(PPB_FileChooser_Proxy); | 70 DISALLOW_COPY_AND_ASSIGN(PPB_FileChooser_Proxy); |
| 66 }; | 71 }; |
| 67 | 72 |
| 68 } // namespace proxy | 73 } // namespace proxy |
| 69 } // namespace ppapi | 74 } // namespace ppapi |
| 70 | 75 |
| 71 #endif // PPAPI_PROXY_PPB_FILE_CHOOSER_PROXY_H_ | 76 #endif // PPAPI_PROXY_PPB_FILE_CHOOSER_PROXY_H_ |
| OLD | NEW |