| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 15 matching lines...) Expand all Loading... |
| 26 namespace proxy { | 26 namespace proxy { |
| 27 | 27 |
| 28 class PPB_FileChooser_Proxy : public InterfaceProxy { | 28 class PPB_FileChooser_Proxy : public InterfaceProxy { |
| 29 public: | 29 public: |
| 30 explicit PPB_FileChooser_Proxy(Dispatcher* dispatcher); | 30 explicit PPB_FileChooser_Proxy(Dispatcher* dispatcher); |
| 31 virtual ~PPB_FileChooser_Proxy(); | 31 virtual ~PPB_FileChooser_Proxy(); |
| 32 | 32 |
| 33 static PP_Resource CreateProxyResource( | 33 static PP_Resource CreateProxyResource( |
| 34 PP_Instance instance, | 34 PP_Instance instance, |
| 35 PP_FileChooserMode_Dev mode, | 35 PP_FileChooserMode_Dev mode, |
| 36 const char* accept_mime_types); | 36 const char* accept_types); |
| 37 | 37 |
| 38 // InterfaceProxy implementation. | 38 // InterfaceProxy implementation. |
| 39 virtual bool OnMessageReceived(const IPC::Message& msg); | 39 virtual bool OnMessageReceived(const IPC::Message& msg); |
| 40 | 40 |
| 41 static const ApiID kApiID = API_ID_PPB_FILE_CHOOSER; | 41 static const ApiID kApiID = API_ID_PPB_FILE_CHOOSER; |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 // Plugin -> host message handlers. | 44 // Plugin -> host message handlers. |
| 45 void OnMsgCreate(PP_Instance instance, | 45 void OnMsgCreate(PP_Instance instance, |
| 46 int mode, | 46 int mode, |
| 47 std::string accept_mime_types, | 47 std::string accept_types, |
| 48 ppapi::HostResource* result); | 48 ppapi::HostResource* result); |
| 49 void OnMsgShow(const ppapi::HostResource& chooser, | 49 void OnMsgShow(const ppapi::HostResource& chooser, |
| 50 PP_Bool save_as, | 50 PP_Bool save_as, |
| 51 SerializedVarReceiveInput suggested_file_name, | 51 SerializedVarReceiveInput suggested_file_name, |
| 52 bool require_user_gesture); | 52 bool require_user_gesture); |
| 53 | 53 |
| 54 // Host -> plugin message handlers. | 54 // Host -> plugin message handlers. |
| 55 void OnMsgChooseComplete( | 55 void OnMsgChooseComplete( |
| 56 const ppapi::HostResource& chooser, | 56 const ppapi::HostResource& chooser, |
| 57 int32_t result_code, | 57 int32_t result_code, |
| 58 const std::vector<PPB_FileRef_CreateInfo>& chosen_files); | 58 const std::vector<PPB_FileRef_CreateInfo>& chosen_files); |
| 59 | 59 |
| 60 // Called when the show is complete in the host. This will notify the plugin | 60 // Called when the show is complete in the host. This will notify the plugin |
| 61 // via IPC and OnMsgChooseComplete will be called there. | 61 // via IPC and OnMsgChooseComplete will be called there. |
| 62 void OnShowCallback( | 62 void OnShowCallback( |
| 63 int32_t result, | 63 int32_t result, |
| 64 scoped_refptr<RefCountedArrayOutputAdapter<PP_Resource> > output, | 64 scoped_refptr<RefCountedArrayOutputAdapter<PP_Resource> > output, |
| 65 HostResource chooser); | 65 HostResource chooser); |
| 66 | 66 |
| 67 pp::CompletionCallbackFactory<PPB_FileChooser_Proxy, | 67 pp::CompletionCallbackFactory<PPB_FileChooser_Proxy, |
| 68 ProxyNonThreadSafeRefCount> callback_factory_; | 68 ProxyNonThreadSafeRefCount> callback_factory_; |
| 69 | 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(PPB_FileChooser_Proxy); | 70 DISALLOW_COPY_AND_ASSIGN(PPB_FileChooser_Proxy); |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 } // namespace proxy | 73 } // namespace proxy |
| 74 } // namespace ppapi | 74 } // namespace ppapi |
| 75 | 75 |
| 76 #endif // PPAPI_PROXY_PPB_FILE_CHOOSER_PROXY_H_ | 76 #endif // PPAPI_PROXY_PPB_FILE_CHOOSER_PROXY_H_ |
| OLD | NEW |