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_AUDIO_PROXY_H_ | 5 #ifndef PPAPI_PROXY_PPB_AUDIO_PROXY_H_ |
6 #define PPAPI_PROXY_PPB_AUDIO_PROXY_H_ | 6 #define PPAPI_PROXY_PPB_AUDIO_PROXY_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 struct PPB_Audio; | 23 struct PPB_Audio; |
24 | 24 |
25 namespace ppapi { | 25 namespace ppapi { |
26 | 26 |
27 class HostResource; | 27 class HostResource; |
28 | 28 |
29 namespace proxy { | 29 namespace proxy { |
30 | 30 |
31 class PPB_Audio_Proxy : public InterfaceProxy { | 31 class PPB_Audio_Proxy : public InterfaceProxy { |
32 public: | 32 public: |
33 PPB_Audio_Proxy(Dispatcher* dispatcher); | 33 PPB_Audio_Proxy(Dispatcher* dispatcher, const void* target_interface); |
34 virtual ~PPB_Audio_Proxy(); | 34 virtual ~PPB_Audio_Proxy(); |
35 | 35 |
| 36 static const Info* GetInfo(); |
| 37 |
36 // Creates an Audio object in the plugin process. | 38 // Creates an Audio object in the plugin process. |
37 static PP_Resource CreateProxyResource(PP_Instance instance_id, | 39 static PP_Resource CreateProxyResource(PP_Instance instance_id, |
38 PP_Resource config_id, | 40 PP_Resource config_id, |
39 PPB_Audio_Callback audio_callback, | 41 PPB_Audio_Callback audio_callback, |
40 void* user_data); | 42 void* user_data); |
41 | 43 |
42 | 44 |
| 45 const PPB_Audio* ppb_audio_target() const { |
| 46 return static_cast<const PPB_Audio*>(target_interface()); |
| 47 } |
| 48 |
43 // InterfaceProxy implementation. | 49 // InterfaceProxy implementation. |
44 virtual bool OnMessageReceived(const IPC::Message& msg); | 50 virtual bool OnMessageReceived(const IPC::Message& msg); |
45 | 51 |
46 static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_AUDIO; | |
47 | |
48 private: | 52 private: |
49 // Plugin->renderer message handlers. | 53 // Plugin->renderer message handlers. |
50 void OnMsgCreate(PP_Instance instance_id, | 54 void OnMsgCreate(PP_Instance instance_id, |
51 int32_t sample_rate, | 55 int32_t sample_rate, |
52 uint32_t sample_frame_count, | 56 uint32_t sample_frame_count, |
53 ppapi::HostResource* result); | 57 ppapi::HostResource* result); |
54 void OnMsgStartOrStop(const ppapi::HostResource& audio_id, bool play); | 58 void OnMsgStartOrStop(const ppapi::HostResource& audio_id, bool play); |
55 | 59 |
56 // Renderer->plugin message handlers. | 60 // Renderer->plugin message handlers. |
57 void OnMsgNotifyAudioStreamCreated(const ppapi::HostResource& audio_id, | 61 void OnMsgNotifyAudioStreamCreated(const ppapi::HostResource& audio_id, |
(...skipping 22 matching lines...) Expand all Loading... |
80 pp::CompletionCallbackFactory<PPB_Audio_Proxy, | 84 pp::CompletionCallbackFactory<PPB_Audio_Proxy, |
81 ProxyNonThreadSafeRefCount> callback_factory_; | 85 ProxyNonThreadSafeRefCount> callback_factory_; |
82 | 86 |
83 DISALLOW_COPY_AND_ASSIGN(PPB_Audio_Proxy); | 87 DISALLOW_COPY_AND_ASSIGN(PPB_Audio_Proxy); |
84 }; | 88 }; |
85 | 89 |
86 } // namespace proxy | 90 } // namespace proxy |
87 } // namespace ppapi | 91 } // namespace ppapi |
88 | 92 |
89 #endif // PPAPI_PROXY_PPB_AUDIO_PROXY_H_ | 93 #endif // PPAPI_PROXY_PPB_AUDIO_PROXY_H_ |
OLD | NEW |