cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / ppapi / proxy / device_enumeration_resource_helper.h
bloba2574ec6461bfdd566bf8843fce7748a7af92bf6
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
3 // found in the LICENSE file.
5 #ifndef PPAPI_PROXY_DEVICE_ENUMERATION_RESOURCE_HELPER_H_
6 #define PPAPI_PROXY_DEVICE_ENUMERATION_RESOURCE_HELPER_H_
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h"
13 #include "ppapi/c/dev/ppb_device_ref_dev.h"
14 #include "ppapi/proxy/ppapi_proxy_export.h"
15 #include "ppapi/shared_impl/thread_aware_callback.h"
17 namespace IPC {
18 class Message;
21 struct PP_ArrayOutput;
23 namespace ppapi {
25 struct DeviceRefData;
26 class TrackedCallback;
28 namespace proxy {
30 class PluginResource;
31 class ResourceMessageReplyParams;
33 class PPAPI_PROXY_EXPORT DeviceEnumerationResourceHelper
34 : public base::SupportsWeakPtr<DeviceEnumerationResourceHelper> {
35 public:
36 // |owner| must outlive this object.
37 explicit DeviceEnumerationResourceHelper(PluginResource* owner);
38 ~DeviceEnumerationResourceHelper();
40 int32_t EnumerateDevices0_2(PP_Resource* devices,
41 scoped_refptr<TrackedCallback> callback);
42 int32_t EnumerateDevices(const PP_ArrayOutput& output,
43 scoped_refptr<TrackedCallback> callback);
44 int32_t EnumerateDevicesSync(const PP_ArrayOutput& output);
45 int32_t MonitorDeviceChange(PP_MonitorDeviceChangeCallback callback,
46 void* user_data);
48 // Returns true if the message has been handled.
49 bool HandleReply(const ResourceMessageReplyParams& params,
50 const IPC::Message& msg);
52 void LastPluginRefWasDeleted();
54 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(
61 const PP_ArrayOutput& output,
62 scoped_refptr<TrackedCallback> callback,
63 const ResourceMessageReplyParams& params,
64 const std::vector<DeviceRefData>& devices);
65 void OnPluginMsgNotifyDeviceChange(const ResourceMessageReplyParams& params,
66 uint32_t callback_id,
67 const std::vector<DeviceRefData>& devices);
69 int32_t WriteToArrayOutput(const std::vector<DeviceRefData>& devices,
70 const PP_ArrayOutput& output);
72 // Not owned by this object.
73 PluginResource* owner_;
75 bool pending_enumerate_devices_;
77 uint32_t monitor_callback_id_;
78 scoped_ptr<ThreadAwareCallback<PP_MonitorDeviceChangeCallback> >
79 monitor_callback_;
80 void* monitor_user_data_;
82 DISALLOW_COPY_AND_ASSIGN(DeviceEnumerationResourceHelper);
85 } // namespace proxy
86 } // namespace ppapi
88 #endif // PPAPI_PROXY_DEVICE_ENUMERATION_RESOURCE_HELPER_H_