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