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