| 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_DEVICE_ENUMERATION_RESOURCE_HELPER_H_ | 5 #ifndef PPAPI_PROXY_DEVICE_ENUMERATION_RESOURCE_HELPER_H_ |
| 6 #define PPAPI_PROXY_DEVICE_ENUMERATION_RESOURCE_HELPER_H_ | 6 #define PPAPI_PROXY_DEVICE_ENUMERATION_RESOURCE_HELPER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 class PluginResource; | 30 class PluginResource; |
| 31 class ResourceMessageReplyParams; | 31 class ResourceMessageReplyParams; |
| 32 | 32 |
| 33 class PPAPI_PROXY_EXPORT DeviceEnumerationResourceHelper | 33 class PPAPI_PROXY_EXPORT DeviceEnumerationResourceHelper |
| 34 : public base::SupportsWeakPtr<DeviceEnumerationResourceHelper> { | 34 : public base::SupportsWeakPtr<DeviceEnumerationResourceHelper> { |
| 35 public: | 35 public: |
| 36 // |owner| must outlive this object. | 36 // |owner| must outlive this object. |
| 37 explicit DeviceEnumerationResourceHelper(PluginResource* owner); | 37 explicit DeviceEnumerationResourceHelper(PluginResource* owner); |
| 38 ~DeviceEnumerationResourceHelper(); | 38 ~DeviceEnumerationResourceHelper(); |
| 39 | 39 |
| 40 int32_t EnumerateDevices0_2(PP_Resource* devices, | |
| 41 scoped_refptr<TrackedCallback> callback); | |
| 42 int32_t EnumerateDevices(const PP_ArrayOutput& output, | 40 int32_t EnumerateDevices(const PP_ArrayOutput& output, |
| 43 scoped_refptr<TrackedCallback> callback); | 41 scoped_refptr<TrackedCallback> callback); |
| 44 int32_t EnumerateDevicesSync(const PP_ArrayOutput& output); | 42 int32_t EnumerateDevicesSync(const PP_ArrayOutput& output); |
| 45 int32_t MonitorDeviceChange(PP_MonitorDeviceChangeCallback callback, | 43 int32_t MonitorDeviceChange(PP_MonitorDeviceChangeCallback callback, |
| 46 void* user_data); | 44 void* user_data); |
| 47 | 45 |
| 48 // Returns true if the message has been handled. | 46 // Returns true if the message has been handled. |
| 49 bool HandleReply(const ResourceMessageReplyParams& params, | 47 bool HandleReply(const ResourceMessageReplyParams& params, |
| 50 const IPC::Message& msg); | 48 const IPC::Message& msg); |
| 51 | 49 |
| 52 void LastPluginRefWasDeleted(); | 50 void LastPluginRefWasDeleted(); |
| 53 | 51 |
| 54 private: | 52 private: |
| 55 void OnPluginMsgEnumerateDevicesReply0_2( | |
| 56 PP_Resource* devices_resource, | |
| 57 scoped_refptr<TrackedCallback> callback, | |
| 58 const ResourceMessageReplyParams& params, | |
| 59 const std::vector<DeviceRefData>& devices); | |
| 60 void OnPluginMsgEnumerateDevicesReply( | 53 void OnPluginMsgEnumerateDevicesReply( |
| 61 const PP_ArrayOutput& output, | 54 const PP_ArrayOutput& output, |
| 62 scoped_refptr<TrackedCallback> callback, | 55 scoped_refptr<TrackedCallback> callback, |
| 63 const ResourceMessageReplyParams& params, | 56 const ResourceMessageReplyParams& params, |
| 64 const std::vector<DeviceRefData>& devices); | 57 const std::vector<DeviceRefData>& devices); |
| 65 void OnPluginMsgNotifyDeviceChange(const ResourceMessageReplyParams& params, | 58 void OnPluginMsgNotifyDeviceChange(const ResourceMessageReplyParams& params, |
| 66 uint32_t callback_id, | 59 uint32_t callback_id, |
| 67 const std::vector<DeviceRefData>& devices); | 60 const std::vector<DeviceRefData>& devices); |
| 68 | 61 |
| 69 int32_t WriteToArrayOutput(const std::vector<DeviceRefData>& devices, | 62 int32_t WriteToArrayOutput(const std::vector<DeviceRefData>& devices, |
| 70 const PP_ArrayOutput& output); | 63 const PP_ArrayOutput& output); |
| 71 | 64 |
| 72 // Not owned by this object. | 65 // Not owned by this object. |
| 73 PluginResource* owner_; | 66 PluginResource* owner_; |
| 74 | 67 |
| 75 bool pending_enumerate_devices_; | 68 bool pending_enumerate_devices_; |
| 76 | 69 |
| 77 uint32_t monitor_callback_id_; | 70 uint32_t monitor_callback_id_; |
| 78 scoped_ptr<ThreadAwareCallback<PP_MonitorDeviceChangeCallback> > | 71 scoped_ptr<ThreadAwareCallback<PP_MonitorDeviceChangeCallback> > |
| 79 monitor_callback_; | 72 monitor_callback_; |
| 80 void* monitor_user_data_; | 73 void* monitor_user_data_; |
| 81 | 74 |
| 82 DISALLOW_COPY_AND_ASSIGN(DeviceEnumerationResourceHelper); | 75 DISALLOW_COPY_AND_ASSIGN(DeviceEnumerationResourceHelper); |
| 83 }; | 76 }; |
| 84 | 77 |
| 85 } // namespace proxy | 78 } // namespace proxy |
| 86 } // namespace ppapi | 79 } // namespace ppapi |
| 87 | 80 |
| 88 #endif // PPAPI_PROXY_DEVICE_ENUMERATION_RESOURCE_HELPER_H_ | 81 #endif // PPAPI_PROXY_DEVICE_ENUMERATION_RESOURCE_HELPER_H_ |
| OLD | NEW |